Commit 83eb50f5 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Julien Muchembled

setup: Tolerate running from different working directory.

parent e791dc3f
...@@ -14,7 +14,10 @@ Topic :: Database ...@@ -14,7 +14,10 @@ Topic :: Database
Topic :: Software Development :: Libraries :: Python Modules Topic :: Software Development :: Libraries :: Python Modules
""" """
if not os.path.exists('mock.py'): base_path = os.path.dirname(__file__) or '.'
mock_path = os.path.join(base_path, 'mock.py')
if not os.path.exists(mock_path):
import cStringIO, hashlib,subprocess, urllib, zipfile import cStringIO, hashlib,subprocess, urllib, zipfile
x = 'pythonmock-0.1.0.zip' x = 'pythonmock-0.1.0.zip'
try: try:
...@@ -25,7 +28,7 @@ if not os.path.exists('mock.py'): ...@@ -25,7 +28,7 @@ if not os.path.exists('mock.py'):
mock_py = zipfile.ZipFile(cStringIO.StringIO(x)).read('mock.py') 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_path, 'w').write(mock_py)
zodb_require = ['ZODB3>=3.10dev'] zodb_require = ['ZODB3>=3.10dev']
...@@ -66,9 +69,10 @@ setup( ...@@ -66,9 +69,10 @@ setup(
license = 'GPL 2+', license = 'GPL 2+',
platforms = ["any"], platforms = ["any"],
classifiers=classifiers.splitlines(), classifiers=classifiers.splitlines(),
long_description = ".. contents::\n\n" + open('README.rst').read() long_description = ".. contents::\n\n" +
+ "\n" + open('CHANGELOG.rst').read(), open(os.path.join(base_path, 'README.rst')).read() + "\n" +
packages = find_packages(), open(os.path.join(base_path, 'CHANGELOG.rst')).read(),
packages = find_packages(base_path),
py_modules = ['mock'], py_modules = ['mock'],
entry_points = { entry_points = {
'console_scripts': [ 'console_scripts': [
......
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