annotate scripts/build.py @ 18:591a5a836ecc

* {{{beep.Listener}}} now has an event loop (based on code mostly from medusa) * The Bitten master now opens a Trac environment and checks for changes to the repository every 15 seconds. * {{{beep.Profile}}} renamed to {{{beep.ProfileHandler}}}
author cmlenz
date Fri, 17 Jun 2005 09:09:07 +0000
parents 45d7bfe64d00
children 055a6c666fa8
rev   line source
0
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
1 #!/usr/bin/env python
5
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
2 # -*- coding: iso8859-1 -*-
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
3 #
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
4 # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
5 #
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
6 # Bitten is free software; you can redistribute it and/or
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
7 # modify it under the terms of the GNU General Public License as
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
8 # published by the Free Software Foundation; either version 2 of the
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
9 # License, or (at your option) any later version.
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
10 #
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
11 # Trac is distributed in the hope that it will be useful,
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
14 # General Public License for more details.
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
15 #
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
16 # You should have received a copy of the GNU General Public License
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
17 # along with this program; if not, write to the Free Software
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
19 #
738a0ae251f6 Added GPL boilerplate.
cmlenz
parents: 4
diff changeset
20 # Author: Christopher Lenz <cmlenz@gmx.de>
0
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
21
4
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
22 import sys
0
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
23
4
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
24 from bitten import BuildError
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
25 from bitten.recipe import Recipe
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
26
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
27 def build():
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
28 step_id = None
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
29 if len(sys.argv) > 1:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
30 step_id = sys.argv[1]
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
31
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
32 recipe = Recipe()
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
33 steps_run = []
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
34 for step in recipe:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
35 if not step_id or step.id == step_id:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
36 print '-->', step.description or step.id
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
37 for function, kw in step:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
38 function(recipe.basedir, **kw)
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
39 print
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
40 steps_run.append(step.id)
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
41
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
42 if step_id and not step_id in steps_run:
8
45d7bfe64d00 Slightly improved implementation of the python tools.
cmlenz
parents: 5
diff changeset
43 raise BuildError, 'Recipe has no step named "%s"' % step_id
0
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
44
0b2a3581c48d Import initial ''bitten'' source.
cmlenz
parents:
diff changeset
45 if __name__ == '__main__':
4
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
46 try:
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
47 build()
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
48 except BuildError, e:
8
45d7bfe64d00 Slightly improved implementation of the python tools.
cmlenz
parents: 5
diff changeset
49 print>>sys.stderr, 'FAILED: %s' % e
4
196009657e5e Simplify the recipe commands interface:
cmlenz
parents: 3
diff changeset
50 sys.exit(-1)
8
45d7bfe64d00 Slightly improved implementation of the python tools.
cmlenz
parents: 5
diff changeset
51 print 'SUCCESS'
Copyright (C) 2012-2017 Edgewall Software