aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2008-08-21 18:00:54 +0000
committerPJ Eby <distutils-sig@python.org>2008-08-21 18:00:54 +0000
commit2d3007539b9ed75f8f5d5a35284640a03235f422 (patch)
tree7b759dba5cb51d2747c4742503d6e19c0d8f6d1f
parent3430324f7fcd38e9d1a8c045812e80376292788e (diff)
downloadexternal_python_setuptools-2d3007539b9ed75f8f5d5a35284640a03235f422.tar.gz
external_python_setuptools-2d3007539b9ed75f8f5d5a35284640a03235f422.tar.bz2
external_python_setuptools-2d3007539b9ed75f8f5d5a35284640a03235f422.zip
Fix for http://bugs.python.org/setuptools/issue5 (backport from trunk)
--HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4065945
-rwxr-xr-xsetuptools/command/upload.py5
-rwxr-xr-xsetuptools/package_index.py8
2 files changed, 8 insertions, 5 deletions
diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py
index e91b8540..7ac08c22 100755
--- a/setuptools/command/upload.py
+++ b/setuptools/command/upload.py
@@ -6,7 +6,10 @@ from distutils.errors import *
from distutils.core import Command
from distutils.spawn import spawn
from distutils import log
-from md5 import md5
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
import os
import socket
import platform
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 84f1fcea..055291a1 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -1,10 +1,12 @@
"""PyPI and direct package downloading"""
-
import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO
from pkg_resources import *
from distutils import log
from distutils.errors import DistutilsError
-from md5 import md5
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5
from fnmatch import translate
EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.]+)$')
@@ -14,7 +16,6 @@ PYPI_MD5 = re.compile(
'<a href="([^"#]+)">([^<]+)</a>\n\s+\\(<a (?:title="MD5 hash"\n\s+)'
'href="[^?]+\?:action=show_md5&amp;digest=([0-9a-f]{32})">md5</a>\\)'
)
-
URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):',re.I).match
EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split()
@@ -23,7 +24,6 @@ __all__ = [
'interpret_distro_name',
]
-
def parse_bdist_wininst(name):
"""Return (base,pyversion) or (None,None) for possible .exe name"""