# HG changeset patch # User Jeff Hammel # Date 1294685864 28800 # Node ID e6c7a4cf2b40f2326163fa09f156e93b586a2f19 # Parent 98fa7d1a7b1d7fd25a54d50577735df8abb7c792 stub out setting properties; not sure if this is the way to do it or not diff -r 98fa7d1a7b1d -r e6c7a4cf2b40 autobot/process/factory.py --- a/autobot/process/factory.py Mon Jan 10 09:38:40 2011 -0800 +++ b/autobot/process/factory.py Mon Jan 10 10:57:44 2011 -0800 @@ -1,11 +1,19 @@ from autobot.steps import CreateVirtualenv from buildbot.process.factory import BuildFactory +from buildbot.steps.shell import SetProperty from buildbot.steps.shell import ShellCommand +from buildbot.steps.shell import WithProperties """ generic factories """ +def find(*args): + """ + returns a command to echo the found file + """ + return ' || '.join(['ls -d %s 2> /dev/null' % arg for arg in args]) + class VirtualenvFactory(BuildFactory): """ create a virtualenv @@ -22,30 +30,42 @@ self.addStep(ShellCommand(command=['mkdir', 'src'], workdir=name)) # TODO: set properities: + # - virtualenv location + # - scripts location # - python location - # - virtualenv location + self.addStep(SetProperty(property='virtualenv', + command=['pwd'], + workdir=name)) + self.addStep(SetProperty(property='scripts', + command=find('Scripts', 'bin'), + workdir=name)) + self.addStep(SetProperty(property='python', + workdir=WithProperties('%(virtualenv)s/%(scripts)s'), + command=find('python', 'python.exe')) # clone hg repositories for hg_source in hg_sources: self.addStep(ShellCommand(command=['hg', 'clone', hg_source], - workdir=name+'/src')) + workdir=name+'/src', + haltOnFailure=True)) # clone the git repositories for git_source in git_sources: self.addStep(ShellCommand(command=['git', 'clone', git_source], - workdir=name+'/src')) + workdir=name+'/src', + haltOnFailure=True)) class PythonSourceFactory(VirtualenvFactory): """ setup several python packages """ - def __init__(self, name='env', hg_sources=()): + def __init__(self, name='env', hg_sources=(), git_sources=()): # setup the environment - VirtualenvFactory.__init__(self, name=name, hg_sources=hg_sources) + VirtualenvFactory.__init__(self, name=name, hg_sources=hg_sources, git_sources=git_sources) - # install the packages + # install the packages [TODO] # python sources: