# HG changeset patch # User Jeff Hammel # Date 1294787071 28800 # Node ID d94fbaac7c2c5ac477133f9d70b009cf5e39a4ef # Parent d033843da35a732a89edd06d7a8bc513119b094d stub out being able to find scripts cross-platform in a virtualenv diff -r d033843da35a -r d94fbaac7c2c autobot/process/factory.py --- a/autobot/process/factory.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/process/factory.py Tue Jan 11 15:04:31 2011 -0800 @@ -1,3 +1,4 @@ +from autobot.steps import find from autobot.steps import CreateVirtualenv from buildbot.process.factory import BuildFactory from buildbot.steps.shell import SetProperty @@ -10,12 +11,13 @@ def find(*args): """ - returns a command to echo the found file + returns a command to echo the found file cross-platform """ args = ['[ -e "%s" ]; then echo "%s"' % (arg, arg) for arg in args] command = 'if %s; else false; fi' % '; elif '.join(args) return ['bash', '-c', command] + class VirtualenvFactory(BuildFactory): """ create a virtualenv @@ -57,6 +59,17 @@ workdir=WithProperties('%(virtualenv)s/src'), haltOnFailure=True)) + def findScript(self, script): + """ + find the name of the script cross-platform + - script: unix-style name of the script + """ + self.addStep(SetProperty(property=script, + command=find(script, script + '.exe'), + workdir=WithProperties('%(virtualenv)s/%(script)s'))) + + + class PythonSourceFactory(VirtualenvFactory): """ setup several python packages diff -r d033843da35a -r d94fbaac7c2c autobot/projects/autobot/__init__.py --- a/autobot/projects/autobot/__init__.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/projects/autobot/__init__.py Tue Jan 11 15:04:31 2011 -0800 @@ -1,4 +1,6 @@ from autobot.process.factory import PythonSourceFactory +from buildbot.steps.shell import ShellCommand +from buildbot.steps.shell import WithProperties class TestAutobotFactory(PythonSourceFactory): """ @@ -11,4 +13,4 @@ hg_sources=['http://k0s.org/mozilla/hg/autobot']) # run the tests - # [TODO] + diff -r d033843da35a -r d94fbaac7c2c autobot/steps/virtualenv.py --- a/autobot/steps/virtualenv.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/steps/virtualenv.py Tue Jan 11 15:04:31 2011 -0800 @@ -1,5 +1,9 @@ +""" +steps related to virtualenvs +""" + from buildbot.process.properties import WithProperties -from buildbot.steps.shell import ShellCommand +from buildbot.steps.shell import ShellCommand class CreateVirtualenv(ShellCommand): """create a virtualenv""" diff -r d033843da35a -r d94fbaac7c2c autobot/template.py --- a/autobot/template.py Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/template.py Tue Jan 11 15:04:31 2011 -0800 @@ -119,7 +119,7 @@ parser = MakeItSoCLI.parser(self) parser.add_option('-f', '--factory', dest='factories', default=[], action='append', - help="factory to use") + help="factory to use ('--factory -' for all)") parser.add_option('--list-factories', dest='_list_factories', default=False, action='store_true', help="list available factories") @@ -137,6 +137,10 @@ print print_descriptions() parser.exit() + # check for all factories + if options.factories == ['-']: + options.factories = factories.keys() + # call the parent return MakeItSoCLI.parse(self, args, parser, options) diff -r d033843da35a -r d94fbaac7c2c autobot/template/master/master.cfg --- a/autobot/template/master/master.cfg Tue Jan 11 14:23:39 2011 -0800 +++ b/autobot/template/master/master.cfg Tue Jan 11 15:04:31 2011 -0800 @@ -11,12 +11,6 @@ from buildbot.changes.pb import PBChangeSource c['change_source'] = PBChangeSource() -####### SCHEDULERS -from buildbot.scheduler import Scheduler -c['schedulers'] = [] -c['schedulers'].append(Scheduler(name="all", branch=None, - treeStableTimer=1, - builderNames=["buildbot-full"])) ####### BUILDERS @@ -28,7 +22,7 @@ f = factory_dict[factory]() # define builder - b = {'name': "buildbot-" + factory, + b = {'name': factory, 'slavename': "{{slave}}", 'builddir': "full", 'factory': f, @@ -37,6 +31,15 @@ c['builders'] = builders +####### SCHEDULERS +from buildbot.scheduler import Scheduler +c['schedulers'] = [] # define scheduler +c['schedulers'].append(Scheduler(name="all", branch=None, + treeStableTimer=1, + builderNames={{factories}})) + + + ####### STATUS TARGETS c['status'] = [] from buildbot.status import html