0
|
1 #!/usr/bin/env python
|
5
|
2 # -*- coding: iso8859-1 -*-
|
|
3 #
|
|
4 # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
|
|
5 #
|
|
6 # Bitten is free software; you can redistribute it and/or
|
|
7 # modify it under the terms of the GNU General Public License as
|
|
8 # published by the Free Software Foundation; either version 2 of the
|
|
9 # License, or (at your option) any later version.
|
|
10 #
|
|
11 # Trac is distributed in the hope that it will be useful,
|
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 # General Public License for more details.
|
|
15 #
|
|
16 # You should have received a copy of the GNU General Public License
|
|
17 # along with this program; if not, write to the Free Software
|
|
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
19 #
|
|
20 # Author: Christopher Lenz <cmlenz@gmx.de>
|
0
|
21
|
4
|
22 import sys
|
0
|
23
|
4
|
24 from bitten import BuildError
|
|
25 from bitten.recipe import Recipe
|
|
26
|
|
27 def build():
|
|
28 step_id = None
|
|
29 if len(sys.argv) > 1:
|
|
30 step_id = sys.argv[1]
|
|
31
|
|
32 recipe = Recipe()
|
|
33 steps_run = []
|
|
34 for step in recipe:
|
|
35 if not step_id or step.id == step_id:
|
|
36 print '-->', step.description or step.id
|
|
37 for function, kw in step:
|
|
38 function(recipe.basedir, **kw)
|
|
39 print
|
|
40 steps_run.append(step.id)
|
|
41
|
|
42 if step_id and not step_id in steps_run:
|
8
|
43 raise BuildError, 'Recipe has no step named "%s"' % step_id
|
0
|
44
|
|
45 if __name__ == '__main__':
|
4
|
46 try:
|
|
47 build()
|
|
48 except BuildError, e:
|
8
|
49 print>>sys.stderr, 'FAILED: %s' % e
|
4
|
50 sys.exit(-1)
|
8
|
51 print 'SUCCESS'
|