# HG changeset patch # User Jeff Hammel # Date 1294687459 28800 # Node ID 6981dcad3b2c97f6ab480d7f341d147142b3f2aa # Parent 42ef457708de13543667fdf442386562c12e6df7 --list-factories now works diff -r 42ef457708de -r 6981dcad3b2c autobot/template.py --- a/autobot/template.py Mon Jan 10 11:22:10 2011 -0800 +++ b/autobot/template.py Mon Jan 10 11:24:19 2011 -0800 @@ -18,6 +18,18 @@ except ImportError: from subprocess import call +def factory_descriptions(): + """print factory descriptions""" + + buffer = StringIO() + print >> buffer, 'Factories:\n' + for key in sorted(factories.keys()): + print >> buffer, '%s:' % key + print >> buffer, getattr(factories[key], '__doc__', '').strip() + print >> buffer + return buffer.getvalue() + + class AutobotMasterTemplate(MakeItSoTemplate): name = 'autobot-master' description = 'template for the autotools buildbot master' @@ -27,21 +39,12 @@ Variable('slaveport', 'port to talk to slaves on', default=9010, cast=int), Variable('htmlport', 'port for waterfall display', default=8010, cast=int)] - def factory_descriptions(self): - buffer = StringIO() - print >> buffer, 'Factories:\n' - for key in sorted(factories.keys()): - print >> buffer, '%s:' % key - print >> buffer, getattr(factories[key], '__doc__', '').strip() - print >> buffer - return buffer.getvalue() - def pre(self, variables): factory = variables.get('factory') if factory: assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) elif self.interactive: - print self.factory_descriptions() + print factory_descriptions() sys.stdout.write('Enter factory: ') factory = raw_input() assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) @@ -118,7 +121,7 @@ # list the factories if options._list_factories: - print self.template.factory_descriptions() + print factory_descriptions() parser.exit() # call the parent