diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-09-06 09:34:32 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-09-06 09:34:32 -0400 |
commit | 7c6fcc08e5960234e99ba2e764766b5a0358038c (patch) | |
tree | d992536a7ec67e070dab50df421726c4db63b9c3 | |
parent | bb6bcc421feb339c8cb876edc1f3eb18159aa6a0 (diff) | |
parent | 705e6255fca83f5ff2b194e6529968017cefaaa3 (diff) | |
download | external_python_setuptools-7c6fcc08e5960234e99ba2e764766b5a0358038c.tar.gz external_python_setuptools-7c6fcc08e5960234e99ba2e764766b5a0358038c.tar.bz2 external_python_setuptools-7c6fcc08e5960234e99ba2e764766b5a0358038c.zip |
Merge
-rw-r--r-- | setuptools/compat.py | 4 | ||||
-rwxr-xr-x | setuptools/package_index.py | 2 | ||||
-rw-r--r-- | setuptools/py26compat.py | 19 |
3 files changed, 22 insertions, 3 deletions
diff --git a/setuptools/compat.py b/setuptools/compat.py index 3a961c0e..860c39f3 100644 --- a/setuptools/compat.py +++ b/setuptools/compat.py @@ -26,7 +26,7 @@ if sys.version_info[0] < 3: reduce = reduce unichr = unichr unicode = unicode - from urllib import url2pathname + from urllib import url2pathname, splittag import urllib2 from urllib2 import urlopen, HTTPError, URLError, unquote, splituser from urlparse import urlparse, urlunparse, urljoin, urlsplit, urlunsplit @@ -74,7 +74,7 @@ else: from urllib.request import urlopen, url2pathname from urllib.parse import ( urlparse, urlunparse, unquote, splituser, urljoin, urlsplit, - urlunsplit, + urlunsplit, splittag, ) xrange = range filterfalse = itertools.filterfalse diff --git a/setuptools/package_index.py b/setuptools/package_index.py index d949063e..a6672c70 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -660,7 +660,7 @@ class PackageIndex(Environment): fp, tfp, info = None, None, None try: checker = HashChecker.from_url(url) - fp = self.open_url(url) + fp = self.open_url(strip_fragment(url)) if isinstance(fp, HTTPError): raise DistutilsError( "Can't download %s: %s %s" % (url, fp.code,fp.msg) diff --git a/setuptools/py26compat.py b/setuptools/py26compat.py new file mode 100644 index 00000000..6fc00883 --- /dev/null +++ b/setuptools/py26compat.py @@ -0,0 +1,19 @@ +""" +Compatibility Support for Python 2.6 and earlier +""" + +import sys + +from setuptools.compat import splittag + +def strip_fragment(url): + """ + In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and + later was patched to disregard the fragment when making URL requests. + Do the same for Python 2.6 and earlier. + """ + url, fragment = splittag(url) + return url + +if sys.version_info < (2,7): + strip_fragment = lambda x: x |