Mercurial > bitten > bitten-test
diff scripts/build.py @ 4:196009657e5e
Simplify the recipe commands interface:
* The implementation of a command is now located using a pseudo-protocol for namespace URIs.
* Commands are simply module-level functions instead of components.
* Remove dependency of the recipe/slave code on the Trac component architecture.
author | cmlenz |
---|---|
date | Mon, 06 Jun 2005 15:54:29 +0000 |
parents | 9ac0ee86ec7c |
children | 738a0ae251f6 |
line wrap: on
line diff
--- a/scripts/build.py +++ b/scripts/build.py @@ -1,12 +1,31 @@ #!/usr/bin/env python -from trac.core import ComponentManager +import sys -from bitten.recipe import Recipe, RecipeExecutor -from bitten.python import cmd_distutils, rep_pylint, rep_unittest, rep_trace -from bitten.general import cmd_make +from bitten import BuildError +from bitten.recipe import Recipe + +def build(): + step_id = None + if len(sys.argv) > 1: + step_id = sys.argv[1] + + recipe = Recipe() + steps_run = [] + for step in recipe: + if not step_id or step.id == step_id: + print '-->', step.description or step.id + for function, kw in step: + function(recipe.basedir, **kw) + print + steps_run.append(step.id) + + if step_id and not step_id in steps_run: + raise BuildError, "Recipe has no step named '%s'" % step_id if __name__ == '__main__': - mgr = ComponentManager() - recipe = Recipe() - RecipeExecutor(mgr).execute(recipe) + try: + build() + except BuildError, e: + print>>sys.stderr, "FAILED: %s" % e + sys.exit(-1)