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

This commit is contained in:
Zooko O'Whielacronx 2010-09-05 22:57:14 -07:00
parent e6a380241a
commit 0c6bb0178b
3 changed files with 16 additions and 10 deletions

View File

@ -243,10 +243,10 @@ test-darcs-boringfile:
$(PYTHON) misc/build_helpers/test-darcs-boringfile.py $(PYTHON) misc/build_helpers/test-darcs-boringfile.py
test-clean: 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)
$(MAKE) clean $(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 diff allfiles.tmp.old allfiles.tmp.new
clean: clean:

View File

@ -48,11 +48,6 @@ from setuptools import find_packages, setup
from setuptools.command import sdist from setuptools.command import sdist
from setuptools import Command 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=[ trove_classifiers=[
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",
"Environment :: Console", "Environment :: Console",
@ -224,8 +219,9 @@ class CheckAutoDeps(Command):
def finalize_options(self): def finalize_options(self):
pass pass
def run(self): def run(self):
import _auto_deps adglobals = {}
_auto_deps.require_auto_deps() execfile('src/allmydata/_auto_deps.py', adglobals)
adglobals['require_auto_deps']()
class MakeExecutable(Command): 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 # 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() # the _auto_deps.install_requires list, which is used in the call to setup()
# below. # below.
from _auto_deps import install_requires adglobals = {}
execfile('src/allmydata/_auto_deps.py', adglobals)
install_requires = adglobals['install_requires']
APPNAME='allmydata-tahoe' APPNAME='allmydata-tahoe'
APPNAMEFILE = os.path.join('src', 'allmydata', '_appname.py') APPNAMEFILE = os.path.join('src', 'allmydata', '_appname.py')

View File

@ -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=[ install_requires=[
# we require newer versions of setuptools (actually # we require newer versions of setuptools (actually
# zetuptoolz) to build, but can handle older versions to run # 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 if hasattr(sys, 'frozen'): # for py2exe
install_requires=[] install_requires=[]
del sys # clean up namespace
def require_python_version(): def require_python_version():
import sys, platform import sys, platform