annotate 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
rev   line source
0
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
1 #!/usr/bin/env python
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
2
4
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
3 import sys
0
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
4
4
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
5 from bitten import BuildError
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
6 from bitten.recipe import Recipe
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
7
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
8 def build():
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
9 step_id = None
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
10 if len(sys.argv) > 1:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
11 step_id = sys.argv[1]
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
12
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
13 recipe = Recipe()
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
14 steps_run = []
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
15 for step in recipe:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
16 if not step_id or step.id == step_id:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
17 print '-->', step.description or step.id
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
18 for function, kw in step:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
19 function(recipe.basedir, **kw)
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
20 print
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
21 steps_run.append(step.id)
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
22
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
23 if step_id and not step_id in steps_run:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
24 raise BuildError, "Recipe has no step named '%s'" % step_id
0
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
25
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
26 if __name__ == '__main__':
4
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
27 try:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
28 build()
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
29 except BuildError, e:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
30 print>>sys.stderr, "FAILED: %s" % e
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
31 sys.exit(-1)
Copyright (C) 2012-2017 Edgewall Software