From c3a265839c3e24590bb1672c2093248a002c7dc0 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Sat, 22 Dec 2007 10:44:47 -0700 Subject: [PATCH] setup: refactor ez_setup.py and setup.py to satisfy the Desert Island scenario, to find and use setuptools egg in-place in misc/dependencies, and make it setup_require pyutil (for darcsver) --- calcdeps.py | 33 +++++++++++---------------- misc/dependencies/build-deps-setup.py | 30 ++++++++++++++++-------- setup.py | 9 ++++---- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/calcdeps.py b/calcdeps.py index c41f398f8..8439bfdc5 100644 --- a/calcdeps.py +++ b/calcdeps.py @@ -1,25 +1,12 @@ +import os -import os.path, sys +miscdeps=os.path.join('misc', 'dependencies') +dependency_links=[os.path.join(miscdeps, t) for t in os.listdir(miscdeps) if t.endswith(".tar")] -# This form is used when the unpacked source distribution is copied into our -# tree: -# "file:misc/dependencies/zfec-1.0.2/" -# and this form is used when we provide a tarball -# "file:misc/dependencies/zfec-1.0.2.tar.gz", -# The file: URL can start with either 'misc' or './misc' to get a relative path. - -dependency_tarballs=[ os.path.join("misc", "dependencies", fn) - for fn in os.listdir(os.path.join("misc", "dependencies")) - if fn.endswith(".tar.gz") ] - -dependency_links=["http://allmydata.org/trac/tahoe/wiki/Dependencies"] + dependency_tarballs - -nevow_version = None -try: - import nevow - nevow_version = nevow.__version__ -except ImportError: - pass +# By adding a web page to the dependency_links we are able to put new packages +# up there and have them be automatically discovered by existing copies of the +# tahoe source when that source was built. +dependency_links.append("http://allmydata.org/trac/tahoe/wiki/Dependencies") install_requires=["zfec >= 1.0.3", "foolscap >= 0.2.2", @@ -27,6 +14,12 @@ install_requires=["zfec >= 1.0.3", "pycryptopp >= 0.2.8", ] +nevow_version = None +try: + import nevow + nevow_version = nevow.__version__ +except ImportError: + pass # We also require zope.interface, but some older versions of setuptools such # as setuptools v0.6a9 don't handle the "." in its name correctly, and anyway diff --git a/misc/dependencies/build-deps-setup.py b/misc/dependencies/build-deps-setup.py index ad5189d1b..68612ed7a 100644 --- a/misc/dependencies/build-deps-setup.py +++ b/misc/dependencies/build-deps-setup.py @@ -2,18 +2,27 @@ # N.B.: this expects to run from the top of the source tree -import sys +import sys, os + +miscdeps=os.path.join('misc', 'dependencies') + from ez_setup import use_setuptools -if 'cygwin' in sys.platform.lower(): - min_version='0.6c6' +try: + from ez_setup import use_setuptools +except ImportError: + pass else: - # foolscap uses a module-level os.urandom() during import, which - # breaks inside older setuptools' sandboxing. 0.6c4 is the first - # version which fixed this problem. - min_version='0.6c4' -use_setuptools(min_version=min_version, - download_base="file:misc/dependencies/", - download_delay=0) + if 'cygwin' in sys.platform.lower(): + min_version='0.6c6' + else: + # foolscap uses a module-level os.urandom() during import, which + # breaks inside older setuptools' sandboxing. 0.6c4 is the first + # version which fixed this problem. + min_version='0.6c4' + download_base = "file:"+os.path.join('misc', 'dependencies')+os.path.sep + use_setuptools(min_version=min_version, + download_base=download_base, + download_delay=0, to_dir=miscdeps) from setuptools import setup @@ -23,4 +32,5 @@ setup(name='tahoe-deps', version="1", install_requires=install_requires, dependency_links=dependency_links, + zip_safe=False ) diff --git a/setup.py b/setup.py index dddd5e167..6f946cf65 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,9 @@ # http://allmydata.com/. import sys, re, os + +miscdeps=os.path.join('misc', 'dependencies') + try: from ez_setup import use_setuptools except ImportError: @@ -36,7 +39,7 @@ else: download_base = "file:"+os.path.join('misc', 'dependencies')+os.path.sep use_setuptools(min_version=min_version, download_base=download_base, - download_delay=0) + download_delay=0, to_dir=miscdeps) from setuptools import Extension, find_packages, setup @@ -105,7 +108,6 @@ The basic idea is that the data in this storage grid is spread over all participating nodes, using an algorithm that can recover the data even if a majority of the nodes are no longer available.""" - setup(name='allmydata-tahoe', version=verstr, description='secure, distributed storage grid', @@ -120,9 +122,8 @@ setup(name='allmydata-tahoe', test_suite="allmydata.test", install_requires=install_requires, include_package_data=True, - setup_requires=["setuptools_darcs >= 1.0.5",], + setup_requires=['setuptools_darcs >= 1.0.5', 'pyutil >= 1.3.8'], # pyutil is for darcsver dependency_links=dependency_links, entry_points = { 'console_scripts': [ 'tahoe = allmydata.scripts.runner:run' ] }, zip_safe=False, # We prefer unzipped for easier access. - extras_require={'autoversioning':'pyutil >= 1.3.8'}, )