Mercurial > bitten > bitten-test
annotate scripts/build.py @ 94:e5d1a792aa45
Cleanup and records when a build is aborted.
author | cmlenz |
---|---|
date | Fri, 15 Jul 2005 14:11:29 +0000 |
parents | b2d371dac270 |
children | f1baf05a49dd |
rev | line source |
---|---|
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 |
61
47ab019508dd
Moved {{{BuildError}}} class into package {{{bitten.build}}}.
cmlenz
parents:
60
diff
changeset
|
24 from bitten.build import BuildError |
4 | 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 | |
72
b2d371dac270
Allow individual steps of a recipe to be marked as optional, i.e. that an error in such a step should not mean that the build failed.
cmlenz
parents:
61
diff
changeset
|
37 step.execute(recipe.ctxt) |
4 | 38 print |
39 steps_run.append(step.id) | |
40 | |
41 if step_id and not step_id in steps_run: | |
8 | 42 raise BuildError, 'Recipe has no step named "%s"' % step_id |
0 | 43 |
44 if __name__ == '__main__': | |
4 | 45 try: |
46 build() | |
47 except BuildError, e: | |
8 | 48 print>>sys.stderr, 'FAILED: %s' % e |
4 | 49 sys.exit(-1) |
8 | 50 print 'SUCCESS' |