def make_egg(options): # naming this task to bdist_egg will make egg installation fail revision = svn.info().get('last_changed_rev') ver = '%sr%s' % (options['version'], revision) # hack version number into setup( ... options='1.0-svn' ...) from paver import tasks setup_section = tasks.environment.options.setdefault("setup", Bunch()) setup_section.update(version=ver) # replace version number set_init_version(ver) print 'Making egg release' import shutil shutil.copytree('FlexGet.egg-info', 'FlexGet.egg-info-backup') options.setdefault('bdist_egg', Bunch())['dist_dir'] = options.make_egg.get('dist_dir') for t in ["minilib", "generate_setup", "setuptools.command.bdist_egg"]: call_task(t) # restore version ... set_init_version('{subversion}') # restore egg info from backup print 'Removing FlexGet.egg-info ...' shutil.rmtree('FlexGet.egg-info') print 'Restoring FlexGet.egg-info' shutil.move('FlexGet.egg-info-backup', 'FlexGet.egg-info')
def make_egg(options): # naming this task to bdist_egg will make egg installation fail revision = svn.info().get("last_changed_rev") ver = "%sr%s" % (options["version"], revision) # hack version number into setup( ... options='1.0-svn' ...) from paver import tasks setup_section = tasks.environment.options.setdefault("setup", Bunch()) setup_section.update(version=ver) # replace version number set_init_version(ver) print "Making egg release" import shutil shutil.copytree("FlexGet.egg-info", "FlexGet.egg-info-backup") options.setdefault("bdist_egg", Bunch())["dist_dir"] = options.make_egg.get("dist_dir") for t in ["minilib", "generate_setup", "setuptools.command.bdist_egg"]: call_task(t) # restore version ... set_init_version("{subversion}") # restore egg info from backup print "Removing FlexGet.egg-info ..." shutil.rmtree("FlexGet.egg-info") print "Restoring FlexGet.egg-info" shutil.move("FlexGet.egg-info-backup", "FlexGet.egg-info")
def sdist(options): """Build tar.gz distribution package""" revision = svn.info().get('last_changed_rev') print 'Revision: %s' % revision # clean previous build print 'Cleaning build...' for p in ['build']: pth = path(p) if pth.isdir(): pth.rmtree() elif pth.isfile(): pth.remove() else: print 'Unable to remove %s' % pth # remove pre-compiled pycs from tests, I don't know why paver even tries to include them ... # seems to happen only with sdist though for pyc in path('tests/').files('*.pyc'): pyc.remove() ver = '%sr%s' % (options['version'], revision) print 'Building %s' % ver # hack for getting options from release task if hasattr(options, 'release'): if options.release.get('dist_dir'): options.setdefault('sdist', Bunch())['dist_dir'] = options.release.dist_dir else: if options.sdist.get('dist_dir'): options.setdefault('sdist', Bunch())['dist_dir'] = options.sdist.dist_dir # replace version number set_init_version(ver) # hack version number into setup( ... options='1.0' ...) from paver import tasks setup_section = tasks.environment.options.setdefault("setup", Bunch()) setup_section.update(version=ver) for t in ['minilib', 'generate_setup', 'setuptools.command.sdist']: call_task(t) # restore version ... set_init_version('{subversion}')
def test_svn_info(sh): sh.return_value = """Path: dojotoolkit/dojo URL: http://svn.dojotoolkit.org/src/dojo/trunk Repository Root: http://svn.dojotoolkit.org/src Repository UUID: 560b804f-0ae3-0310-86f3-f6aa0a117693 Revision: 13301 Node Kind: directory Schedule: normal Last Changed Author: jaredj Last Changed Rev: 13299 Last Changed Date: 2008-04-10 11:44:52 -0400 (Thu, 10 Apr 2008) """ output = svn.info() assert sh.called assert output.path == "dojotoolkit/dojo" assert output.url == "http://svn.dojotoolkit.org/src/dojo/trunk" assert output.last_changed_date == "2008-04-10 11:44:52 -0400 (Thu, 10 Apr 2008)"
def test_svn_info(sh): sh.return_value="""Path: dojotoolkit/dojo URL: http://svn.dojotoolkit.org/src/dojo/trunk Repository Root: http://svn.dojotoolkit.org/src Repository UUID: 560b804f-0ae3-0310-86f3-f6aa0a117693 Revision: 13301 Node Kind: directory Schedule: normal Last Changed Author: jaredj Last Changed Rev: 13299 Last Changed Date: 2008-04-10 11:44:52 -0400 (Thu, 10 Apr 2008) """ output = svn.info() assert sh.called assert output.path == "dojotoolkit/dojo" assert output.url == "http://svn.dojotoolkit.org/src/dojo/trunk" assert output.last_changed_date == "2008-04-10 11:44:52 -0400 (Thu, 10 Apr 2008)"
def make_egg(options): # naming this task to bdist_egg will make egg installation fail options.setdefault('release', Bunch()) revision = svn.info().get('last_changed_rev') ver = '%sr%s' % (options['version'], revision) # hack version number into setup( ... options='1.0-svn' ...) from paver import tasks setup_section = tasks.environment.options.setdefault("setup", Bunch()) setup_section.update(version=ver) # replace version number set_init_version(ver) print 'Making egg release' import shutil shutil.copytree('FlexGet.egg-info', 'FlexGet.egg-info-backup') if options.release.get('dist_dir'): options.setdefault('bdist_egg', Bunch())['dist_dir'] = options.release.dist_dir # hack for getting options from release task if hasattr(options, 'release'): if options.release.get('dist_dir'): options.setdefault('bdist_egg', Bunch())['dist_dir'] = options.release.dist_dir else: if options.sdist.get('dist_dir'): options.setdefault('bdist_egg', Bunch())['dist_dir'] = options.sdist.dist_dir for t in ["minilib", "generate_setup", "setuptools.command.bdist_egg"]: call_task(t) # restore version ... set_init_version('{subversion}') # restore egg info from backup print 'Removing FlexGet.egg-info ...' shutil.rmtree('FlexGet.egg-info') print 'Restoring FlexGet.egg-info' shutil.move('FlexGet.egg-info-backup', 'FlexGet.egg-info')
def sdist(options): """Build tar.gz distribution package""" revision = svn.info().get("last_changed_rev") print "Revision: %s" % revision # clean previous build print "Cleaning build..." for p in ["build"]: pth = path(p) if pth.isdir(): pth.rmtree() elif pth.isfile(): pth.remove() else: print "Unable to remove %s" % pth # remove pre-compiled pycs from tests, I don't know why paver even tries to include them ... # seems to happen only with sdist though for pyc in path("tests/").files("*.pyc"): pyc.remove() ver = "%sr%s" % (options["version"], revision) print "Building %s" % ver # replace version number set_init_version(ver) # hack version number into setup( ... options='1.0' ...) from paver import tasks setup_section = tasks.environment.options.setdefault("setup", Bunch()) setup_section.update(version=ver) for t in ["minilib", "generate_setup", "setuptools.command.sdist"]: call_task(t) # restore version ... set_init_version("{subversion}")