Commit f99ef3f2 authored by PJ Eby's avatar PJ Eby

Backport fix for http://bugs.python.org/setuptools/issue47 from trunk

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4066599
parent 7375959b
...@@ -48,10 +48,11 @@ md5_data = { ...@@ -48,10 +48,11 @@ md5_data = {
} }
import sys, os import sys, os
try: from hashlib import md5
except ImportError: from md5 import md5
def _validate_md5(egg_name, data): def _validate_md5(egg_name, data):
if egg_name in md5_data: if egg_name in md5_data:
from md5 import md5
digest = md5(data).hexdigest() digest = md5(data).hexdigest()
if digest != md5_data[egg_name]: if digest != md5_data[egg_name]:
print >>sys.stderr, ( print >>sys.stderr, (
...@@ -61,7 +62,6 @@ def _validate_md5(egg_name, data): ...@@ -61,7 +62,6 @@ def _validate_md5(egg_name, data):
sys.exit(2) sys.exit(2)
return data return data
def use_setuptools( def use_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15 download_delay=15
...@@ -230,7 +230,6 @@ def update_md5(filenames): ...@@ -230,7 +230,6 @@ def update_md5(filenames):
"""Update our built-in md5 registry""" """Update our built-in md5 registry"""
import re import re
from md5 import md5
for name in filenames: for name in filenames:
base = os.path.basename(name) base = os.path.basename(name)
...@@ -267,3 +266,4 @@ if __name__=='__main__': ...@@ -267,3 +266,4 @@ if __name__=='__main__':
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment