Commit a4f34eaa authored by Julien Muchembled's avatar Julien Muchembled

setup: first try to get 'mock.py' from the backup in repository

SourceForge currently has too many issues.
parent 4dfdf05a
...@@ -15,10 +15,14 @@ Topic :: Software Development :: Libraries :: Python Modules ...@@ -15,10 +15,14 @@ Topic :: Software Development :: Libraries :: Python Modules
""" """
if not os.path.exists('mock.py'): if not os.path.exists('mock.py'):
import cStringIO, hashlib, urllib, zipfile import cStringIO, hashlib,subprocess, urllib, zipfile
mock_py = zipfile.ZipFile(cStringIO.StringIO(urllib.urlopen( x = 'pythonmock-0.1.0.zip'
'http://downloads.sf.net/sourceforge/python-mock/pythonmock-0.1.0.zip' try:
).read())).read('mock.py') x = subprocess.check_output(('git', 'cat-file', 'blob', x))
except (OSError, subprocess.CalledProcessError):
x = urllib.urlopen(
'http://downloads.sf.net/sourceforge/python-mock/' + x).read()
mock_py = zipfile.ZipFile(cStringIO.StringIO(x)).read('mock.py')
if hashlib.md5(mock_py).hexdigest() != '79f42f390678e5195d9ce4ae43bd18ec': if hashlib.md5(mock_py).hexdigest() != '79f42f390678e5195d9ce4ae43bd18ec':
raise EnvironmentError("MD5 checksum mismatch downloading 'mock.py'") raise EnvironmentError("MD5 checksum mismatch downloading 'mock.py'")
open('mock.py', 'w').write(mock_py) open('mock.py', 'w').write(mock_py)
......
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