setup.py,Makefile: teat sdist --sumo about tahoe-deps/, use -SUMO suffix on tarballs, add sumo to 'make tarballs' target

This commit is contained in:
Brian Warner 2008-09-17 13:01:19 -07:00
parent 9aadf07835
commit 749c5a95e0
2 changed files with 37 additions and 26 deletions

View File

@ -250,10 +250,13 @@ find-trailing-spaces:
# as it ran. Invoke this on a new tree, or after a 'clean', to make sure the # as it ran. Invoke this on a new tree, or after a 'clean', to make sure the
# support/lib/ directory is gone. # support/lib/ directory is gone.
test-desert-island: fetch-and-unpack-deps:
test -f tahoe-deps.tar.gz || wget http://allmydata.org/source/tahoe/tarballs/tahoe-deps.tar.gz test -f tahoe-deps.tar.gz || wget http://allmydata.org/source/tahoe/tarballs/tahoe-deps.tar.gz
rm -rf tahoe-deps rm -rf tahoe-deps
tar xf tahoe-deps.tar.gz tar xf tahoe-deps.tar.gz
test-desert-island:
$(MAKE) fetch-and-unpack-deps
$(MAKE) 2>&1 | tee make.out $(MAKE) 2>&1 | tee make.out
$(PYTHON) misc/check-build.py make.out no-downloads $(PYTHON) misc/check-build.py make.out no-downloads
@ -263,6 +266,8 @@ test-desert-island:
tarballs: tarballs:
$(MAKE) make-version $(MAKE) make-version
$(PYTHON) setup.py sdist --formats=bztar,gztar,zip $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
$(PYTHON) setup.py sdist --sumo --formats=bztar,gztar,zip
upload-tarballs: upload-tarballs:
for f in dist/allmydata-tahoe-*; do \ for f in dist/allmydata-tahoe-*; do \
xfer-client --furlfile ~/.tahoe-tarball-upload.furl $$f; \ xfer-client --furlfile ~/.tahoe-tarball-upload.furl $$f; \

View File

@ -363,41 +363,47 @@ class Trial(Command):
class MySdist(sdist.sdist): class MySdist(sdist.sdist):
""" A hook in the sdist command so that we can determine whether this the """ A hook in the sdist command so that we can determine whether this the
tarball should be 'SUMO' or not, i.e. whether or not to include the tarball should be 'SUMO' or not, i.e. whether or not to include the
external dependency tarballs. external dependency tarballs. Note that we always include
misc/dependencies/* in the tarball; --sumo controls whether tahoe-deps/*
is included as well.
""" """
# Add our own sumo option to the sdist command, which toggles the
# external dependencies being included in the sdist.
user_options = sdist.sdist.user_options + \ user_options = sdist.sdist.user_options + \
[('sumo', 's', "create a 'sumo' sdist which includes the external " \ [('sumo', 's',
"dependencies")] "create a 'sumo' sdist which includes the contents of tahoe-deps/*"),
]
boolean_options = ['sumo'] boolean_options = ['sumo']
def initialize_options(self): def initialize_options(self):
sdist.sdist.initialize_options(self) sdist.sdist.initialize_options(self)
self.sumo = None self.sumo = False
def run(self): def make_distribution(self):
self.run_command('egg_info') # add our extra files to the list just before building the
ei_cmd = self.get_finalized_command('egg_info') # tarball/zipfile. We override make_distribution() instead of run()
self.filelist = ei_cmd.filelist # because setuptools.command.sdist.run() does not lend itself to
self.filelist.append(os.path.join(ei_cmd.egg_info,'SOURCES.txt')) # easy/robust subclassing (the code we need to add goes right smack
# in the middle of a 12-line method). If this were the distutils
# version, we'd override get_file_list().
# If '--sumo' wasn't specified in the arguments, do not include if self.sumo:
# the external dependency tarballs in the sdist. # If '--sumo' was specified, include tahoe-deps/* in the sdist.
if not self.sumo: # We assume that the user has fetched the tahoe-deps.tar.gz
self.filelist.exclude_pattern(None, prefix='misc/dependencies') # tarball and unpacked it already.
self.filelist.extend([os.path.join("tahoe-deps", fn)
for fn in os.listdir("tahoe-deps")])
# In addition, we want the tarball/zipfile to have -SUMO in the
# name, and the unpacked directory to have -SUMO too. The easiest
# way to do this is to patch self.distribution and override the
# get_fullname() method. (an alternative is to modify
# self.distribution.metadata.version, but that also affects the
# contents of PKG-INFO).
fullname = self.distribution.get_fullname()
def get_fullname():
return fullname + "-SUMO"
self.distribution.get_fullname = get_fullname
print self.filelist.files return sdist.sdist.make_distribution(self)
self.check_readme()
self.check_metadata()
self.make_distribution()
dist_files = getattr(self.distribution,'dist_files',[])
for file in self.archive_files:
data = ('sdist', '', file)
if data not in dist_files:
dist_files.append(data)
# 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()