aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/package_index.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-09-13 21:30:44 +0200
committerMartin v. Löwis <martin@v.loewis.de>2009-09-13 21:30:44 +0200
commit55413ad562eddc5ffc235bde5471fdf010421f9a (patch)
treef3a13e0665c06dc96b33f6c8103c780f1a3a8966 /setuptools/package_index.py
parentcfa83c08e6c6248f0085dfaab5c4f7edad6f8ec1 (diff)
downloadexternal_python_setuptools-55413ad562eddc5ffc235bde5471fdf010421f9a.tar.gz
external_python_setuptools-55413ad562eddc5ffc235bde5471fdf010421f9a.tar.bz2
external_python_setuptools-55413ad562eddc5ffc235bde5471fdf010421f9a.zip
Only decode HTML pages in 3.x.
--HG-- branch : distribute extra : rebase_source : 58a286fe297947272398fc9ddd8f50594f54d4ae
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-xsetuptools/package_index.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index b6283dbc..084370d5 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -197,8 +197,9 @@ class PackageIndex(Environment):
base = f.url # handle redirects
page = f.read()
- charset = f.headers.get_param('charset') or 'latin-1'
- page = page.decode(charset, "ignore")
+ if sys.version_info >= (3,):
+ charset = f.headers.get_param('charset') or 'latin-1'
+ page = page.decode(charset, "ignore")
f.close()
if url.startswith(self.index_url) and getattr(f,'code',None)!=404:
page = self.process_index(url, page)