o Fix issue with python 2.4. Fix with small changes from Hoffman
obtained from BitTornado forum http://forums.degreez.net/viewtopic.php?t=3581&sid=2428d7d8dff1871f7fb2118548bdc86c o Bump PORTREVISION to force update o Remove BROKEN
This commit is contained in:
parent
9f8a9a5721
commit
bcba0638b2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=123480
12 changed files with 396 additions and 18 deletions
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= BitTorrent
|
PORTNAME= BitTorrent
|
||||||
PORTVERSION= 3.4.2
|
PORTVERSION= 3.4.2
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
PORTEPOCH= 1
|
PORTEPOCH= 1
|
||||||
CATEGORIES?= net python
|
CATEGORIES?= net python
|
||||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
||||||
|
@ -18,8 +18,6 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||||
MAINTAINER= lioux@FreeBSD.org
|
MAINTAINER= lioux@FreeBSD.org
|
||||||
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
||||||
|
|
||||||
BROKEN= Does not work with python 2.4
|
|
||||||
|
|
||||||
USE_PYTHON= yes
|
USE_PYTHON= yes
|
||||||
USE_PYDISTUTILS= yes
|
USE_PYDISTUTILS= yes
|
||||||
USE_REINPLACE= yes
|
USE_REINPLACE= yes
|
||||||
|
@ -46,6 +44,10 @@ pre-everything::
|
||||||
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
post-extract:
|
||||||
|
# patch to work with python 2.4
|
||||||
|
@${CP} ${FILESDIR}/zurllib.py ${WRKSRC}/BitTorrent
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${FIND} ${WRKSRC} -type f | \
|
@${FIND} ${WRKSRC} -type f | \
|
||||||
${XARGS} -x -n 10 \
|
${XARGS} -x -n 10 \
|
||||||
|
|
61
net-p2p/py-bittorrent-devel/files/zurllib.py
Normal file
61
net-p2p/py-bittorrent-devel/files/zurllib.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# Written by John Hoffman
|
||||||
|
# see LICENSE.txt for license information
|
||||||
|
|
||||||
|
from httplib import HTTPConnection
|
||||||
|
from urlparse import urlparse
|
||||||
|
import socket
|
||||||
|
from gzip import GzipFile
|
||||||
|
from StringIO import StringIO
|
||||||
|
from urllib import quote, unquote
|
||||||
|
from __init__ import version
|
||||||
|
|
||||||
|
MAX_REDIRECTS = 10
|
||||||
|
|
||||||
|
class urlopen:
|
||||||
|
def __init__(self, url):
|
||||||
|
self.tries = 0
|
||||||
|
self._open(url)
|
||||||
|
|
||||||
|
def _open(self, url):
|
||||||
|
self.tries += 1
|
||||||
|
if self.tries > MAX_REDIRECTS:
|
||||||
|
raise IOError, ('http error', 500,
|
||||||
|
"Internal Server Error: Redirect Recursion")
|
||||||
|
(scheme, netloc, path, pars, query, fragment) = urlparse(url)
|
||||||
|
if scheme != 'http':
|
||||||
|
raise IOError, ('url error', 'unknown url type', scheme, url)
|
||||||
|
url = path
|
||||||
|
if pars:
|
||||||
|
url += ';'+pars
|
||||||
|
if query:
|
||||||
|
url += '?'+query
|
||||||
|
# if fragment:
|
||||||
|
self.connection = HTTPConnection(netloc)
|
||||||
|
self.connection.request('GET', url, None,
|
||||||
|
{ 'User-Agent': 'BitTorrent/' + version,
|
||||||
|
'Accept-Encoding': 'gzip' } )
|
||||||
|
self.response = self.connection.getresponse()
|
||||||
|
status = self.response.status
|
||||||
|
if status in (301,302):
|
||||||
|
try:
|
||||||
|
self.connection.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self._open(self.response.getheader('Location'))
|
||||||
|
return
|
||||||
|
if status != 200:
|
||||||
|
raise IOError, ('http error', status, self.response.reason)
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
data = self.response.read()
|
||||||
|
if self.response.getheader('Content-Encoding','').find('gzip') >= 0:
|
||||||
|
try:
|
||||||
|
compressed = StringIO(data)
|
||||||
|
f = GzipFile(fileobj = compressed)
|
||||||
|
data = f.read()
|
||||||
|
except:
|
||||||
|
raise IOError, ('http error', 'got corrupt response')
|
||||||
|
return data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.connection.close()
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= BitTorrent
|
PORTNAME= BitTorrent
|
||||||
PORTVERSION= 3.4.2
|
PORTVERSION= 3.4.2
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
PORTEPOCH= 1
|
PORTEPOCH= 1
|
||||||
CATEGORIES?= net python
|
CATEGORIES?= net python
|
||||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
||||||
|
@ -18,8 +18,6 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||||
MAINTAINER= lioux@FreeBSD.org
|
MAINTAINER= lioux@FreeBSD.org
|
||||||
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
||||||
|
|
||||||
BROKEN= Does not work with python 2.4
|
|
||||||
|
|
||||||
USE_PYTHON= yes
|
USE_PYTHON= yes
|
||||||
USE_PYDISTUTILS= yes
|
USE_PYDISTUTILS= yes
|
||||||
USE_REINPLACE= yes
|
USE_REINPLACE= yes
|
||||||
|
@ -46,6 +44,10 @@ pre-everything::
|
||||||
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
post-extract:
|
||||||
|
# patch to work with python 2.4
|
||||||
|
@${CP} ${FILESDIR}/zurllib.py ${WRKSRC}/BitTorrent
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${FIND} ${WRKSRC} -type f | \
|
@${FIND} ${WRKSRC} -type f | \
|
||||||
${XARGS} -x -n 10 \
|
${XARGS} -x -n 10 \
|
||||||
|
|
61
net-p2p/py-bittorrent/files/zurllib.py
Normal file
61
net-p2p/py-bittorrent/files/zurllib.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# Written by John Hoffman
|
||||||
|
# see LICENSE.txt for license information
|
||||||
|
|
||||||
|
from httplib import HTTPConnection
|
||||||
|
from urlparse import urlparse
|
||||||
|
import socket
|
||||||
|
from gzip import GzipFile
|
||||||
|
from StringIO import StringIO
|
||||||
|
from urllib import quote, unquote
|
||||||
|
from __init__ import version
|
||||||
|
|
||||||
|
MAX_REDIRECTS = 10
|
||||||
|
|
||||||
|
class urlopen:
|
||||||
|
def __init__(self, url):
|
||||||
|
self.tries = 0
|
||||||
|
self._open(url)
|
||||||
|
|
||||||
|
def _open(self, url):
|
||||||
|
self.tries += 1
|
||||||
|
if self.tries > MAX_REDIRECTS:
|
||||||
|
raise IOError, ('http error', 500,
|
||||||
|
"Internal Server Error: Redirect Recursion")
|
||||||
|
(scheme, netloc, path, pars, query, fragment) = urlparse(url)
|
||||||
|
if scheme != 'http':
|
||||||
|
raise IOError, ('url error', 'unknown url type', scheme, url)
|
||||||
|
url = path
|
||||||
|
if pars:
|
||||||
|
url += ';'+pars
|
||||||
|
if query:
|
||||||
|
url += '?'+query
|
||||||
|
# if fragment:
|
||||||
|
self.connection = HTTPConnection(netloc)
|
||||||
|
self.connection.request('GET', url, None,
|
||||||
|
{ 'User-Agent': 'BitTorrent/' + version,
|
||||||
|
'Accept-Encoding': 'gzip' } )
|
||||||
|
self.response = self.connection.getresponse()
|
||||||
|
status = self.response.status
|
||||||
|
if status in (301,302):
|
||||||
|
try:
|
||||||
|
self.connection.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self._open(self.response.getheader('Location'))
|
||||||
|
return
|
||||||
|
if status != 200:
|
||||||
|
raise IOError, ('http error', status, self.response.reason)
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
data = self.response.read()
|
||||||
|
if self.response.getheader('Content-Encoding','').find('gzip') >= 0:
|
||||||
|
try:
|
||||||
|
compressed = StringIO(data)
|
||||||
|
f = GzipFile(fileobj = compressed)
|
||||||
|
data = f.read()
|
||||||
|
except:
|
||||||
|
raise IOError, ('http error', 'got corrupt response')
|
||||||
|
return data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.connection.close()
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= BitTorrent
|
PORTNAME= BitTorrent
|
||||||
PORTVERSION= 3.4.2
|
PORTVERSION= 3.4.2
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
PORTEPOCH= 1
|
PORTEPOCH= 1
|
||||||
CATEGORIES?= net python
|
CATEGORIES?= net python
|
||||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
||||||
|
@ -18,8 +18,6 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||||
MAINTAINER= lioux@FreeBSD.org
|
MAINTAINER= lioux@FreeBSD.org
|
||||||
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
||||||
|
|
||||||
BROKEN= Does not work with python 2.4
|
|
||||||
|
|
||||||
USE_PYTHON= yes
|
USE_PYTHON= yes
|
||||||
USE_PYDISTUTILS= yes
|
USE_PYDISTUTILS= yes
|
||||||
USE_REINPLACE= yes
|
USE_REINPLACE= yes
|
||||||
|
@ -46,6 +44,10 @@ pre-everything::
|
||||||
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
post-extract:
|
||||||
|
# patch to work with python 2.4
|
||||||
|
@${CP} ${FILESDIR}/zurllib.py ${WRKSRC}/BitTorrent
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${FIND} ${WRKSRC} -type f | \
|
@${FIND} ${WRKSRC} -type f | \
|
||||||
${XARGS} -x -n 10 \
|
${XARGS} -x -n 10 \
|
||||||
|
|
61
net-p2p/py-kenosis-bittorrent/files/zurllib.py
Normal file
61
net-p2p/py-kenosis-bittorrent/files/zurllib.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# Written by John Hoffman
|
||||||
|
# see LICENSE.txt for license information
|
||||||
|
|
||||||
|
from httplib import HTTPConnection
|
||||||
|
from urlparse import urlparse
|
||||||
|
import socket
|
||||||
|
from gzip import GzipFile
|
||||||
|
from StringIO import StringIO
|
||||||
|
from urllib import quote, unquote
|
||||||
|
from __init__ import version
|
||||||
|
|
||||||
|
MAX_REDIRECTS = 10
|
||||||
|
|
||||||
|
class urlopen:
|
||||||
|
def __init__(self, url):
|
||||||
|
self.tries = 0
|
||||||
|
self._open(url)
|
||||||
|
|
||||||
|
def _open(self, url):
|
||||||
|
self.tries += 1
|
||||||
|
if self.tries > MAX_REDIRECTS:
|
||||||
|
raise IOError, ('http error', 500,
|
||||||
|
"Internal Server Error: Redirect Recursion")
|
||||||
|
(scheme, netloc, path, pars, query, fragment) = urlparse(url)
|
||||||
|
if scheme != 'http':
|
||||||
|
raise IOError, ('url error', 'unknown url type', scheme, url)
|
||||||
|
url = path
|
||||||
|
if pars:
|
||||||
|
url += ';'+pars
|
||||||
|
if query:
|
||||||
|
url += '?'+query
|
||||||
|
# if fragment:
|
||||||
|
self.connection = HTTPConnection(netloc)
|
||||||
|
self.connection.request('GET', url, None,
|
||||||
|
{ 'User-Agent': 'BitTorrent/' + version,
|
||||||
|
'Accept-Encoding': 'gzip' } )
|
||||||
|
self.response = self.connection.getresponse()
|
||||||
|
status = self.response.status
|
||||||
|
if status in (301,302):
|
||||||
|
try:
|
||||||
|
self.connection.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self._open(self.response.getheader('Location'))
|
||||||
|
return
|
||||||
|
if status != 200:
|
||||||
|
raise IOError, ('http error', status, self.response.reason)
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
data = self.response.read()
|
||||||
|
if self.response.getheader('Content-Encoding','').find('gzip') >= 0:
|
||||||
|
try:
|
||||||
|
compressed = StringIO(data)
|
||||||
|
f = GzipFile(fileobj = compressed)
|
||||||
|
data = f.read()
|
||||||
|
except:
|
||||||
|
raise IOError, ('http error', 'got corrupt response')
|
||||||
|
return data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.connection.close()
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= BitTorrent
|
PORTNAME= BitTorrent
|
||||||
PORTVERSION= 3.4.2
|
PORTVERSION= 3.4.2
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
PORTEPOCH= 1
|
PORTEPOCH= 1
|
||||||
CATEGORIES?= net python
|
CATEGORIES?= net python
|
||||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
||||||
|
@ -18,8 +18,6 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||||
MAINTAINER= lioux@FreeBSD.org
|
MAINTAINER= lioux@FreeBSD.org
|
||||||
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
||||||
|
|
||||||
BROKEN= Does not work with python 2.4
|
|
||||||
|
|
||||||
USE_PYTHON= yes
|
USE_PYTHON= yes
|
||||||
USE_PYDISTUTILS= yes
|
USE_PYDISTUTILS= yes
|
||||||
USE_REINPLACE= yes
|
USE_REINPLACE= yes
|
||||||
|
@ -46,6 +44,10 @@ pre-everything::
|
||||||
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
post-extract:
|
||||||
|
# patch to work with python 2.4
|
||||||
|
@${CP} ${FILESDIR}/zurllib.py ${WRKSRC}/BitTorrent
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${FIND} ${WRKSRC} -type f | \
|
@${FIND} ${WRKSRC} -type f | \
|
||||||
${XARGS} -x -n 10 \
|
${XARGS} -x -n 10 \
|
||||||
|
|
61
net/py-bittorrent-devel/files/zurllib.py
Normal file
61
net/py-bittorrent-devel/files/zurllib.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# Written by John Hoffman
|
||||||
|
# see LICENSE.txt for license information
|
||||||
|
|
||||||
|
from httplib import HTTPConnection
|
||||||
|
from urlparse import urlparse
|
||||||
|
import socket
|
||||||
|
from gzip import GzipFile
|
||||||
|
from StringIO import StringIO
|
||||||
|
from urllib import quote, unquote
|
||||||
|
from __init__ import version
|
||||||
|
|
||||||
|
MAX_REDIRECTS = 10
|
||||||
|
|
||||||
|
class urlopen:
|
||||||
|
def __init__(self, url):
|
||||||
|
self.tries = 0
|
||||||
|
self._open(url)
|
||||||
|
|
||||||
|
def _open(self, url):
|
||||||
|
self.tries += 1
|
||||||
|
if self.tries > MAX_REDIRECTS:
|
||||||
|
raise IOError, ('http error', 500,
|
||||||
|
"Internal Server Error: Redirect Recursion")
|
||||||
|
(scheme, netloc, path, pars, query, fragment) = urlparse(url)
|
||||||
|
if scheme != 'http':
|
||||||
|
raise IOError, ('url error', 'unknown url type', scheme, url)
|
||||||
|
url = path
|
||||||
|
if pars:
|
||||||
|
url += ';'+pars
|
||||||
|
if query:
|
||||||
|
url += '?'+query
|
||||||
|
# if fragment:
|
||||||
|
self.connection = HTTPConnection(netloc)
|
||||||
|
self.connection.request('GET', url, None,
|
||||||
|
{ 'User-Agent': 'BitTorrent/' + version,
|
||||||
|
'Accept-Encoding': 'gzip' } )
|
||||||
|
self.response = self.connection.getresponse()
|
||||||
|
status = self.response.status
|
||||||
|
if status in (301,302):
|
||||||
|
try:
|
||||||
|
self.connection.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self._open(self.response.getheader('Location'))
|
||||||
|
return
|
||||||
|
if status != 200:
|
||||||
|
raise IOError, ('http error', status, self.response.reason)
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
data = self.response.read()
|
||||||
|
if self.response.getheader('Content-Encoding','').find('gzip') >= 0:
|
||||||
|
try:
|
||||||
|
compressed = StringIO(data)
|
||||||
|
f = GzipFile(fileobj = compressed)
|
||||||
|
data = f.read()
|
||||||
|
except:
|
||||||
|
raise IOError, ('http error', 'got corrupt response')
|
||||||
|
return data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.connection.close()
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= BitTorrent
|
PORTNAME= BitTorrent
|
||||||
PORTVERSION= 3.4.2
|
PORTVERSION= 3.4.2
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
PORTEPOCH= 1
|
PORTEPOCH= 1
|
||||||
CATEGORIES?= net python
|
CATEGORIES?= net python
|
||||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
||||||
|
@ -18,8 +18,6 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||||
MAINTAINER= lioux@FreeBSD.org
|
MAINTAINER= lioux@FreeBSD.org
|
||||||
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
||||||
|
|
||||||
BROKEN= Does not work with python 2.4
|
|
||||||
|
|
||||||
USE_PYTHON= yes
|
USE_PYTHON= yes
|
||||||
USE_PYDISTUTILS= yes
|
USE_PYDISTUTILS= yes
|
||||||
USE_REINPLACE= yes
|
USE_REINPLACE= yes
|
||||||
|
@ -46,6 +44,10 @@ pre-everything::
|
||||||
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
post-extract:
|
||||||
|
# patch to work with python 2.4
|
||||||
|
@${CP} ${FILESDIR}/zurllib.py ${WRKSRC}/BitTorrent
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${FIND} ${WRKSRC} -type f | \
|
@${FIND} ${WRKSRC} -type f | \
|
||||||
${XARGS} -x -n 10 \
|
${XARGS} -x -n 10 \
|
||||||
|
|
61
net/py-bittorrent/files/zurllib.py
Normal file
61
net/py-bittorrent/files/zurllib.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# Written by John Hoffman
|
||||||
|
# see LICENSE.txt for license information
|
||||||
|
|
||||||
|
from httplib import HTTPConnection
|
||||||
|
from urlparse import urlparse
|
||||||
|
import socket
|
||||||
|
from gzip import GzipFile
|
||||||
|
from StringIO import StringIO
|
||||||
|
from urllib import quote, unquote
|
||||||
|
from __init__ import version
|
||||||
|
|
||||||
|
MAX_REDIRECTS = 10
|
||||||
|
|
||||||
|
class urlopen:
|
||||||
|
def __init__(self, url):
|
||||||
|
self.tries = 0
|
||||||
|
self._open(url)
|
||||||
|
|
||||||
|
def _open(self, url):
|
||||||
|
self.tries += 1
|
||||||
|
if self.tries > MAX_REDIRECTS:
|
||||||
|
raise IOError, ('http error', 500,
|
||||||
|
"Internal Server Error: Redirect Recursion")
|
||||||
|
(scheme, netloc, path, pars, query, fragment) = urlparse(url)
|
||||||
|
if scheme != 'http':
|
||||||
|
raise IOError, ('url error', 'unknown url type', scheme, url)
|
||||||
|
url = path
|
||||||
|
if pars:
|
||||||
|
url += ';'+pars
|
||||||
|
if query:
|
||||||
|
url += '?'+query
|
||||||
|
# if fragment:
|
||||||
|
self.connection = HTTPConnection(netloc)
|
||||||
|
self.connection.request('GET', url, None,
|
||||||
|
{ 'User-Agent': 'BitTorrent/' + version,
|
||||||
|
'Accept-Encoding': 'gzip' } )
|
||||||
|
self.response = self.connection.getresponse()
|
||||||
|
status = self.response.status
|
||||||
|
if status in (301,302):
|
||||||
|
try:
|
||||||
|
self.connection.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self._open(self.response.getheader('Location'))
|
||||||
|
return
|
||||||
|
if status != 200:
|
||||||
|
raise IOError, ('http error', status, self.response.reason)
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
data = self.response.read()
|
||||||
|
if self.response.getheader('Content-Encoding','').find('gzip') >= 0:
|
||||||
|
try:
|
||||||
|
compressed = StringIO(data)
|
||||||
|
f = GzipFile(fileobj = compressed)
|
||||||
|
data = f.read()
|
||||||
|
except:
|
||||||
|
raise IOError, ('http error', 'got corrupt response')
|
||||||
|
return data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.connection.close()
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= BitTorrent
|
PORTNAME= BitTorrent
|
||||||
PORTVERSION= 3.4.2
|
PORTVERSION= 3.4.2
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
PORTEPOCH= 1
|
PORTEPOCH= 1
|
||||||
CATEGORIES?= net python
|
CATEGORIES?= net python
|
||||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED}
|
||||||
|
@ -18,8 +18,6 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
|
||||||
MAINTAINER= lioux@FreeBSD.org
|
MAINTAINER= lioux@FreeBSD.org
|
||||||
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
COMMENT?= A peer-to-peer tool for distributing files written in Python
|
||||||
|
|
||||||
BROKEN= Does not work with python 2.4
|
|
||||||
|
|
||||||
USE_PYTHON= yes
|
USE_PYTHON= yes
|
||||||
USE_PYDISTUTILS= yes
|
USE_PYDISTUTILS= yes
|
||||||
USE_REINPLACE= yes
|
USE_REINPLACE= yes
|
||||||
|
@ -46,6 +44,10 @@ pre-everything::
|
||||||
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
@${ECHO_MSG} '===> Define WITHOUT_GUI to disable GUI installation'
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
post-extract:
|
||||||
|
# patch to work with python 2.4
|
||||||
|
@${CP} ${FILESDIR}/zurllib.py ${WRKSRC}/BitTorrent
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${FIND} ${WRKSRC} -type f | \
|
@${FIND} ${WRKSRC} -type f | \
|
||||||
${XARGS} -x -n 10 \
|
${XARGS} -x -n 10 \
|
||||||
|
|
61
net/py-kenosis-bittorrent/files/zurllib.py
Normal file
61
net/py-kenosis-bittorrent/files/zurllib.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# Written by John Hoffman
|
||||||
|
# see LICENSE.txt for license information
|
||||||
|
|
||||||
|
from httplib import HTTPConnection
|
||||||
|
from urlparse import urlparse
|
||||||
|
import socket
|
||||||
|
from gzip import GzipFile
|
||||||
|
from StringIO import StringIO
|
||||||
|
from urllib import quote, unquote
|
||||||
|
from __init__ import version
|
||||||
|
|
||||||
|
MAX_REDIRECTS = 10
|
||||||
|
|
||||||
|
class urlopen:
|
||||||
|
def __init__(self, url):
|
||||||
|
self.tries = 0
|
||||||
|
self._open(url)
|
||||||
|
|
||||||
|
def _open(self, url):
|
||||||
|
self.tries += 1
|
||||||
|
if self.tries > MAX_REDIRECTS:
|
||||||
|
raise IOError, ('http error', 500,
|
||||||
|
"Internal Server Error: Redirect Recursion")
|
||||||
|
(scheme, netloc, path, pars, query, fragment) = urlparse(url)
|
||||||
|
if scheme != 'http':
|
||||||
|
raise IOError, ('url error', 'unknown url type', scheme, url)
|
||||||
|
url = path
|
||||||
|
if pars:
|
||||||
|
url += ';'+pars
|
||||||
|
if query:
|
||||||
|
url += '?'+query
|
||||||
|
# if fragment:
|
||||||
|
self.connection = HTTPConnection(netloc)
|
||||||
|
self.connection.request('GET', url, None,
|
||||||
|
{ 'User-Agent': 'BitTorrent/' + version,
|
||||||
|
'Accept-Encoding': 'gzip' } )
|
||||||
|
self.response = self.connection.getresponse()
|
||||||
|
status = self.response.status
|
||||||
|
if status in (301,302):
|
||||||
|
try:
|
||||||
|
self.connection.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self._open(self.response.getheader('Location'))
|
||||||
|
return
|
||||||
|
if status != 200:
|
||||||
|
raise IOError, ('http error', status, self.response.reason)
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
data = self.response.read()
|
||||||
|
if self.response.getheader('Content-Encoding','').find('gzip') >= 0:
|
||||||
|
try:
|
||||||
|
compressed = StringIO(data)
|
||||||
|
f = GzipFile(fileobj = compressed)
|
||||||
|
data = f.read()
|
||||||
|
except:
|
||||||
|
raise IOError, ('http error', 'got corrupt response')
|
||||||
|
return data
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.connection.close()
|
Loading…
Reference in a new issue