From 0c6bb0178bb3f8ff44af29259df7ead85d07e437 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Sun, 5 Sep 2010 22:57:14 -0700 Subject: [PATCH] setup: use execfile to access _auto_deps.py in its proper location of src/allmydata/ instead of copying it into place when setup.py is executed --- Makefile | 4 ++-- setup.py | 14 ++++++-------- _auto_deps.py => src/allmydata/_auto_deps.py | 8 ++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) rename _auto_deps.py => src/allmydata/_auto_deps.py (93%) diff --git a/Makefile b/Makefile index 723d656d..316c7d1f 100644 --- a/Makefile +++ b/Makefile @@ -243,10 +243,10 @@ test-darcs-boringfile: $(PYTHON) misc/build_helpers/test-darcs-boringfile.py test-clean: - find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|auto_deps|appname).py" |sort >allfiles.tmp.old + find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.old $(MAKE) $(MAKE) clean - find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|auto_deps|appname).py" |sort >allfiles.tmp.new + find . |grep -vEe "_darcs|allfiles.tmp|src/allmydata/_(version|appname).py" |sort >allfiles.tmp.new diff allfiles.tmp.old allfiles.tmp.new clean: diff --git a/setup.py b/setup.py index 267c8c71..3959531b 100644 --- a/setup.py +++ b/setup.py @@ -48,11 +48,6 @@ from setuptools import find_packages, setup from setuptools.command import sdist from setuptools import Command -# Make the dependency-version-requirement, which is used by the Makefile at -# build-time, also available to the app at runtime: -shutil.copyfile("_auto_deps.py", - os.path.join("src", "allmydata", "_auto_deps.py")) - trove_classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -224,8 +219,9 @@ class CheckAutoDeps(Command): def finalize_options(self): pass def run(self): - import _auto_deps - _auto_deps.require_auto_deps() + adglobals = {} + execfile('src/allmydata/_auto_deps.py', adglobals) + adglobals['require_auto_deps']() class MakeExecutable(Command): @@ -326,7 +322,9 @@ class MySdist(sdist.sdist): # Tahoe's dependencies are managed by the find_links= entry in setup.cfg and # the _auto_deps.install_requires list, which is used in the call to setup() # below. -from _auto_deps import install_requires +adglobals = {} +execfile('src/allmydata/_auto_deps.py', adglobals) +install_requires = adglobals['install_requires'] APPNAME='allmydata-tahoe' APPNAMEFILE = os.path.join('src', 'allmydata', '_appname.py') diff --git a/_auto_deps.py b/src/allmydata/_auto_deps.py similarity index 93% rename from _auto_deps.py rename to src/allmydata/_auto_deps.py index d5711450..aa148e20 100644 --- a/_auto_deps.py +++ b/src/allmydata/_auto_deps.py @@ -1,3 +1,10 @@ +# Note: do not import any module from Tahoe-LAFS itself in this +# file. Also please avoid importing modules from other packages than +# the Python Standard Library if at all possible (exception: we rely +# on importing pkg_resources, which is provided by setuptools, +# zetuptoolz, distribute, and perhaps in the future distutils2, for +# the require_auto_deps() function.) + install_requires=[ # we require newer versions of setuptools (actually # zetuptoolz) to build, but can handle older versions to run @@ -64,6 +71,7 @@ if sys.version_info < (2, 5): if hasattr(sys, 'frozen'): # for py2exe install_requires=[] +del sys # clean up namespace def require_python_version(): import sys, platform -- 2.45.2