view autobot/projects/__init__.py @ 131:a14d466c843b

fix syntax error and note import errors in projects
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 23 Jan 2011 11:15:43 -0800
parents a1568668175c
children 1abbe826d0f3
line wrap: on
line source

"""
projects that need some testing:

* logparser      [WORKING]
* autobot        [IN FLIGHT]
* mozmill        [IN FLIGHT]
* devicemanager  [IN FLIGHT]
* profilemanager [IN FLIGHT]
* firebug        [TODO]
* jetpack thing  [TODO]
"""

import imp
import os
import sys
from buildbot.process.factory import BuildFactory
from logparser import TestLogParserFactory
from mozmill import TestMozmillFactory

# 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 = [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:
        print >> sys.stderr, "Could not import autobot.projects." + package
        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