# HG changeset patch # User Jeff Hammel # Date 1294728018 28800 # Node ID e66165f2f31b5758459bd2cb9b6e770dc9df1f2e # Parent 008404759e4f321fe266de5305a2a748f710fc7a complete automagic imports diff -r 008404759e4f -r e66165f2f31b README.txt --- a/README.txt Mon Jan 10 15:38:09 2011 -0800 +++ b/README.txt Mon Jan 10 22:40:18 2011 -0800 @@ -1,7 +1,28 @@ -* mozmill -* jetpack thing -* devicemanager -* profilemanager -* logparser -* firebug - +autobot +======= + +buildbot for the A*Team + +Using autobot + +Autobot may be installed using the Install script:: + + curl http://... + +This will create a virtualenv and install autobot for development +($VIRTUAL_ENV/src/autobot). You can create a master-slave pair by +running ``create-autobot`` after activating the virtualenv. This is +mostly useful for autobot development. The scripts ``create-autobot-master`` and +``create-autobot-slave`` are also available. The scripts will prompt you +for a factory. The factories are from ``autobot.projects`` and its +subdirectories. + +Projects +-------- + +* logparser [WORKING] +* profilemanager [IN FLIGHT] +* mozmill [IN FLIGHT] +* firebug [TODO] +* jetpack [TODO] +* devicemanager [TODO] diff -r 008404759e4f -r e66165f2f31b autobot/projects/__init__.py --- a/autobot/projects/__init__.py Mon Jan 10 15:38:09 2011 -0800 +++ b/autobot/projects/__init__.py Mon Jan 10 22:40:18 2011 -0800 @@ -10,19 +10,33 @@ * autobot [TODO] """ +import imp import os - +from buildbot.process.factory import BuildFactory from logparser import TestLogParserFactory from mozmill import TestMozmillFactory -# TODO: import these automagically: -# requires non-zipped eggs + +# available factories:: +# import these automagically: requires non-zipped eggs +factories = {} +descriptions = {} here = os.path.dirname(os.path.abspath(__file__)) packages = [os.path.join(here, path) for path in os.listdir(here) if os.path.isdir(os.path.join(here, path))] -packages = [package for package in packages +packages = [os.path.basename(package) for package in packages if os.path.exists(os.path.join(package, '__init__.py'))] +for package in packages: + try: + module = imp.load_package('autobot.projects.'+package, imp.find_module(package, [here])[1]) + except: + continue + for attr in dir(module): + try: + _obj = getattr(module, attr) + if issubclass(_obj, BuildFactory) and _obj.__module__.startswith('autobot.projects.'): + factories[package] = _obj + descriptions[package] = (getattr(_obj, '__doc__', attr) or attr).strip() + except TypeError: + continue -# available factories -factories = {'logparser': TestLogParserFactory, - 'mozmill': TestMozmillFactory } diff -r 008404759e4f -r e66165f2f31b autobot/projects/profilemanager/__init__.py --- a/autobot/projects/profilemanager/__init__.py Mon Jan 10 15:38:09 2011 -0800 +++ b/autobot/projects/profilemanager/__init__.py Mon Jan 10 22:40:18 2011 -0800 @@ -5,9 +5,13 @@ def __init__(self): + # install m-c + profilemanager + self.addStep(ShellCommand(command=['wget', 'http://hg.mozilla.org/automation/profilemanager/raw-file/tip/INSTALL.py'])) + self.addStep(ShellCommand(command=['python', 'INSTALL.py'])) + # get mozilla central - self.addStep(ShellCommand(command=['hg', 'clone', 'http://hg.mozilla.org/mozilla-central'])) +# self.addStep(ShellCommand(command=['hg', 'clone', 'http://hg.mozilla.org/mozilla-central'])) # get profilemanager - self.addStep(ShellCommand(command=['hg', 'clone', 'http://hg.mozilla.org/automation/profilemanager'], - haltOnFailure=True)) +# self.addStep(ShellCommand(command=['hg', 'clone', 'http://hg.mozilla.org/automation/profilemanager'], +# haltOnFailure=True)) diff -r 008404759e4f -r e66165f2f31b autobot/template.py --- a/autobot/template.py Mon Jan 10 15:38:09 2011 -0800 +++ b/autobot/template.py Mon Jan 10 22:40:18 2011 -0800 @@ -10,6 +10,7 @@ from makeitso.template import assemble from makeitso.template import MakeItSoTemplate from makeitso.template import Variable +from projects import descriptions from projects import factories from StringIO import StringIO @@ -25,7 +26,7 @@ print >> buffer, 'Factories:\n' for key in sorted(factories.keys()): print >> buffer, '%s:' % key - print >> buffer, getattr(factories[key], '__doc__', '').strip() + print >> buffer, descriptions[key] print >> buffer return buffer.getvalue()