0
|
1 #!/usr/bin/env python
|
|
2
|
4
|
3 import sys
|
0
|
4
|
4
|
5 from bitten import BuildError
|
|
6 from bitten.recipe import Recipe
|
|
7
|
|
8 def build():
|
|
9 step_id = None
|
|
10 if len(sys.argv) > 1:
|
|
11 step_id = sys.argv[1]
|
|
12
|
|
13 recipe = Recipe()
|
|
14 steps_run = []
|
|
15 for step in recipe:
|
|
16 if not step_id or step.id == step_id:
|
|
17 print '-->', step.description or step.id
|
|
18 for function, kw in step:
|
|
19 function(recipe.basedir, **kw)
|
|
20 print
|
|
21 steps_run.append(step.id)
|
|
22
|
|
23 if step_id and not step_id in steps_run:
|
|
24 raise BuildError, "Recipe has no step named '%s'" % step_id
|
0
|
25
|
|
26 if __name__ == '__main__':
|
4
|
27 try:
|
|
28 build()
|
|
29 except BuildError, e:
|
|
30 print>>sys.stderr, "FAILED: %s" % e
|
|
31 sys.exit(-1)
|