Ticket #249: tahoe_ext_deps.patch

File tahoe_ext_deps.patch, 3.5 KB (added by cgalvan, at 2008-08-26T23:18:22Z)

Updated patch, note though that it will need to be updated once more when the location of the external dependencies is decided on.

  • setup.py

     
    2525    use_setuptools(download_delay=0, min_version="0.6c8")
    2626
    2727from setuptools import Extension, find_packages, setup
     28from setuptools.command import sdist
    2829
    2930# Make the dependency-version-requirement, which is used by the Makefile at
    3031# build-time, also available to the app at runtime:
     
    9394it remains available even when some of the peers are unavailable,
    9495malfunctioning, or malicious."""
    9596
    96 miscdeps=os.path.join(os.getcwd(), 'misc', 'dependencies')
    97 dependency_links=[os.path.join(miscdeps, t) for t in os.listdir(miscdeps) if t.endswith(".tar")]
     97# For Desert Island builds, assume that the user has extracted the dependency
     98# tarball into a parent directory named 'tahoe_deps'.
     99tahoe_deps = os.path.join(os.path.dirname(os.getcwd()), 'tahoe_deps')
     100dependency_links=[tahoe_deps]
    98101
    99102# By adding a web page to the dependency_links we are able to put new packages
    100103# up there and have them be automatically discovered by existing copies of the
    101104# tahoe source when that source was built.
    102105dependency_links.append("http://allmydata.org/trac/tahoe/wiki/Dependencies")
    103106
     107# Default setup_requires are pyutil for the Windows installer builder(see
     108# misc/sub-ver.py) and Twisted for the tests.
     109#setup_requires = ['pyutil >= 1.3.16', 'Twisted >= 2.4.0']
    104110setup_requires = []
    105 setup_requires.append('pyutil >= 1.3.16') # used by the Windows installer builder, see misc/sub-ver.py
    106 
    107111# darcsver is needed only if you want "./setup.py darcsver" to write a new
    108112# version stamp in src/allmydata/_version.py, with a version number derived from
    109113# darcs history.
     
    118122if not os.path.exists('PKG-INFO'):
    119123    setup_requires.append('setuptools_darcs >= 1.1.0')
    120124
     125class MySdist(sdist.sdist):
     126    """ A hook in the sdist command so that we can determine whether this the
     127    tarball should be 'SUMO' or not, i.e. whether or not to include the
     128    external dependency tarballs.
     129    """
     130
     131    # Add our own sumo option to the sdist command, which toggles the
     132    # external dependencies being included in the sdist.
     133    user_options = sdist.sdist.user_options + \
     134        [('sumo', 's', "create a 'sumo' sdist which includes the external " \
     135          "dependencies")]
     136    boolean_options = ['sumo']
     137
     138    def initialize_options(self):
     139        sdist.sdist.initialize_options(self)
     140        self.sumo = None
     141
     142    def run(self):
     143        self.run_command('egg_info')
     144        ei_cmd = self.get_finalized_command('egg_info')
     145        self.filelist = ei_cmd.filelist
     146        self.filelist.append(os.path.join(ei_cmd.egg_info,'SOURCES.txt'))
     147       
     148        # If '--sumo' wasn't specified in the arguments, do not include
     149        # the external dependency tarballs in the sdist.
     150        if not self.sumo:
     151            self.filelist.exclude_pattern(None, prefix='misc/dependencies')
     152
     153        print self.filelist.files
     154        self.check_readme()
     155        self.check_metadata()
     156        self.make_distribution()
     157
     158        dist_files = getattr(self.distribution,'dist_files',[])
     159        for file in self.archive_files:
     160            data = ('sdist', '', file)
     161            if data not in dist_files:
     162                dist_files.append(data)
     163
    121164import _auto_deps
    122165
    123166setup(name='allmydata-tahoe',
     
    128171      author_email='tahoe-dev@allmydata.org',
    129172      url='http://allmydata.org/',
    130173      license='GNU GPL',
     174      cmdclass={'sdist': MySdist},
    131175      package_dir = {'':'src'},
    132176      packages=find_packages("src"),
    133177      classifiers=trove_classifiers,