Mercurial > hg > autobot
annotate autobot/template.py @ 13:59cc21718ced
select factory
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 07 Jan 2011 12:04:16 -0800 |
parents | 848569b7f91a |
children | 9ad3a9e220bc |
rev | line source |
---|---|
1 | 1 #!/usr/bin/env python |
2 | |
3 """ | |
3 | 4 templates for the A*Team's buildbot |
1 | 5 """ |
6 | |
12
848569b7f91a
use subdirectories for the master and slave
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
7 import os |
1 | 8 import sys |
6
4ba6ba323871
stub out invocation of the template; this should eventually move to its own class, as we will want to subclass MakeItSoCLI, /me thinks
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
9 from makeitso.cli import MakeItSoCLI |
13 | 10 from makeitso.projects import factories |
4
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
11 from makeitso.template import MakeItSoTemplate |
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
12 from makeitso.template import Variable |
1 | 13 |
14 class AutobotMasterTemplate(MakeItSoTemplate): | |
15 name = 'autobot-master' | |
4
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
16 description = 'template for the autotools buildbot master' |
12
848569b7f91a
use subdirectories for the master and slave
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
17 templates = [os.path.join('template', 'master')] |
4
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
18 vars = [Variable('slave', 'buildslave name', 'slave'), |
5
b7c521f53bda
document what the passwd variable is for
Jeff Hammel <jhammel@mozilla.com>
parents:
4
diff
changeset
|
19 Variable('passwd', 'buildslave password', default='passwd'), |
4
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
20 Variable('slaveport', 'port to talk to slaves on', default=9010), |
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
21 Variable('htmlport', 'port for waterfall display', default=8010)] |
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
22 |
9
c06441767a2a
now interpolates correctly; just doesnt do much
Jeff Hammel <jhammel@mozilla.com>
parents:
8
diff
changeset
|
23 def pre(self, variables): |
13 | 24 factory = variables.get['factory'] |
25 if factory: | |
26 assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) | |
27 elif self.interactive: | |
28 print 'Please select a Factory:\n' | |
29 for key in sorted(factories.keys()): | |
30 print '%s:' % key | |
31 print getattr(factories[key], '__doc__', '').strip() | |
32 print | |
33 factory = raw_input() | |
34 assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) | |
35 else: | |
36 raise AssertionError("No factory provided") | |
1 | 37 |
38 class AutobotSlaveTemplate(MakeItSoTemplate): | |
39 name = 'autobot-slave' | |
4
eb289a46f4d3
make buildbot master template look close to what it should
Jeff Hammel <jhammel@mozilla.com>
parents:
3
diff
changeset
|
40 description = 'template for the autotools buildbot slave' |
12
848569b7f91a
use subdirectories for the master and slave
Jeff Hammel <jhammel@mozilla.com>
parents:
11
diff
changeset
|
41 templates = [os.path.join('template', 'slave')] |
1 | 42 look = True |
43 | |
13 | 44 class MasterTemplateCLI(MakeItSoCLI): |
45 def __init__(self): | |
46 | |
47 | |
1 | 48 def main(args=sys.argv[1:]): |
6
4ba6ba323871
stub out invocation of the template; this should eventually move to its own class, as we will want to subclass MakeItSoCLI, /me thinks
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
49 cli = MakeItSoCLI(AutobotMasterTemplate) |
4ba6ba323871
stub out invocation of the template; this should eventually move to its own class, as we will want to subclass MakeItSoCLI, /me thinks
Jeff Hammel <jhammel@mozilla.com>
parents:
5
diff
changeset
|
50 template = cli.parse() |
8 | 51 template.substitute() |
1 | 52 |
53 if __name__ == '__main__': | |
54 main() |