diff autobot/template.py @ 66:cbcb96142ed6

stubs towards specifying multiple factories
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 11 Jan 2011 10:15:33 -0800
parents 2a5fa6876e48
children e8dabfd24c42
line wrap: on
line diff
--- a/autobot/template.py	Tue Jan 11 09:51:46 2011 -0800
+++ b/autobot/template.py	Tue Jan 11 10:15:33 2011 -0800
@@ -41,15 +41,15 @@
             Variable('htmlport', 'port for waterfall display', default=8010, cast=int)]
 
     def pre(self, variables):
-        factory = variables.get('factory')
+        factory = variables.get('factories')
         if factory:
-            assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys())
+            assert(set(factory).issubset(factories.keys())), 'Factory must be one of: ' % ', '.join(factories.keys())
         elif self.interactive:
             print print_descriptions()
             sys.stdout.write('Enter factory: ')
             factory = raw_input()
             assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys())
-            variables['factory'] = factory
+            variables['factories'] = [factory]
         else:
             raise AssertionError("No factory provided")
 
@@ -64,6 +64,7 @@
         """
         self.create(self.output, variables)
 
+
 class AutobotSlaveTemplate(MakeItSoTemplate):
     name = 'autobot-slave'
     description = 'template for the autotools buildbot slave'
@@ -105,7 +106,8 @@
     """
     def parser(self):
         parser = MakeItSoCLI.parser(self)
-        parser.add_option('-f', '--factory', dest='factory',
+        parser.add_option('-f', '--factory', dest='factories',
+                          default=[], action='append',
                           help="factory to use")
         parser.add_option('--list-factories', dest='_list_factories',
                           default=False, action='store_true',