diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-05-24 23:53:44 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-05-24 23:53:44 -0400 |
commit | 59d45d94058826e754c7f36fe0605ab9e1160b62 (patch) | |
tree | 5c11e35c727f5cb5013f2651a061e51b17037fea /setuptools/package_index.py | |
parent | 8f52bc5f9db7b202461c6d2421930545a683fb5f (diff) | |
download | external_python_setuptools-59d45d94058826e754c7f36fe0605ab9e1160b62.tar.gz external_python_setuptools-59d45d94058826e754c7f36fe0605ab9e1160b62.tar.bz2 external_python_setuptools-59d45d94058826e754c7f36fe0605ab9e1160b62.zip |
Support get_headers on Python 3 and Python 2
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-x | setuptools/package_index.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 2701c873..8a3c96de 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -608,7 +608,10 @@ class PackageIndex(Environment): size = -1 if "content-length" in headers: # Some servers return multiple Content-Length headers :( - size = max(map(int,headers.getheaders("Content-Length"))) + if not hasattr(headers, 'get_all'): + # Older versions of Python don't have the get_all method + headers.get_all = headers.getheaders + size = max(map(int,headers.get_all("Content-Length"))) self.reporthook(url, filename, blocknum, bs, size) tfp = open(filename,'wb') while True: |