[Python-checkins] r65944 - in sandbox/trunk/setuptools/setuptools: command/upload.py package_index.py

phillip.eby python-checkins at python.org
Thu Aug 21 19:59:52 CEST 2008


Author: phillip.eby
Date: Thu Aug 21 19:59:52 2008
New Revision: 65944

Log:
Fix for http://bugs.python.org/setuptools/issue5


Modified:
   sandbox/trunk/setuptools/setuptools/command/upload.py
   sandbox/trunk/setuptools/setuptools/package_index.py

Modified: sandbox/trunk/setuptools/setuptools/command/upload.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/upload.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/upload.py	Thu Aug 21 19:59:52 2008
@@ -6,7 +6,10 @@
 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

Modified: sandbox/trunk/setuptools/setuptools/package_index.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/package_index.py	(original)
+++ sandbox/trunk/setuptools/setuptools/package_index.py	Thu Aug 21 19:59:52 2008
@@ -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 @@
     '<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 @@
     'interpret_distro_name',
 ]
 
-
 def parse_bdist_wininst(name):
     """Return (base,pyversion) or (None,None) for possible .exe name"""
 


More information about the Python-checkins mailing list