Mercurial > hg > autobot
annotate autobot/projects/__init__.py @ 189:cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 02 Feb 2011 09:11:28 -0800 |
parents | a0866ad63d93 |
children | 7789fe9f8c30 |
rev | line source |
---|---|
28
5ce65c535472
add a docstring and other stubs to projects
Jeff Hammel <jhammel@mozilla.com>
parents:
19
diff
changeset
|
1 """ |
5ce65c535472
add a docstring and other stubs to projects
Jeff Hammel <jhammel@mozilla.com>
parents:
19
diff
changeset
|
2 projects that need some testing: |
5ce65c535472
add a docstring and other stubs to projects
Jeff Hammel <jhammel@mozilla.com>
parents:
19
diff
changeset
|
3 |
70 | 4 * logparser [WORKING] |
133 | 5 * autobot [WORKING] |
70 | 6 * mozmill [IN FLIGHT] |
7 * devicemanager [IN FLIGHT] | |
8 * profilemanager [IN FLIGHT] | |
29 | 9 * firebug [TODO] |
10 * jetpack thing [TODO] | |
28
5ce65c535472
add a docstring and other stubs to projects
Jeff Hammel <jhammel@mozilla.com>
parents:
19
diff
changeset
|
11 """ |
5ce65c535472
add a docstring and other stubs to projects
Jeff Hammel <jhammel@mozilla.com>
parents:
19
diff
changeset
|
12 |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
13 import imp |
189
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
14 import inspect |
28
5ce65c535472
add a docstring and other stubs to projects
Jeff Hammel <jhammel@mozilla.com>
parents:
19
diff
changeset
|
15 import os |
131
a14d466c843b
fix syntax error and note import errors in projects
Jeff Hammel <jhammel@mozilla.com>
parents:
71
diff
changeset
|
16 import sys |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
17 from buildbot.process.factory import BuildFactory |
10
9bda5ada5dca
start on a dict of projects
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
18 from logparser import TestLogParserFactory |
31
7a33d84b38e5
add mozmill to the dictionary of factories
Jeff Hammel <jhammel@mozilla.com>
parents:
29
diff
changeset
|
19 from mozmill import TestMozmillFactory |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
20 |
189
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
21 __all__ = ['factories', 'descriptions', 'here', 'args'] |
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
22 |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
23 # available factories:: |
71
a1568668175c
make the autobot project possibly do something
Jeff Hammel <jhammel@mozilla.com>
parents:
70
diff
changeset
|
24 # import these automagically; requires non-zipped eggs |
189
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
25 factories = {} # factory classes |
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
26 descriptions = {} # their descriptions |
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
27 args = {} # their arguments |
34
206467b6f61f
* cleanup a bit in projects and start featuring autodiscovery
Jeff Hammel <jhammel@mozilla.com>
parents:
32
diff
changeset
|
28 here = os.path.dirname(os.path.abspath(__file__)) |
206467b6f61f
* cleanup a bit in projects and start featuring autodiscovery
Jeff Hammel <jhammel@mozilla.com>
parents:
32
diff
changeset
|
29 packages = [os.path.join(here, path) |
206467b6f61f
* cleanup a bit in projects and start featuring autodiscovery
Jeff Hammel <jhammel@mozilla.com>
parents:
32
diff
changeset
|
30 for path in os.listdir(here) |
206467b6f61f
* cleanup a bit in projects and start featuring autodiscovery
Jeff Hammel <jhammel@mozilla.com>
parents:
32
diff
changeset
|
31 if os.path.isdir(os.path.join(here, path))] |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
32 packages = [os.path.basename(package) for package in packages |
34
206467b6f61f
* cleanup a bit in projects and start featuring autodiscovery
Jeff Hammel <jhammel@mozilla.com>
parents:
32
diff
changeset
|
33 if os.path.exists(os.path.join(package, '__init__.py'))] |
189
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
34 modules = [os.path.splitext(module)[0] |
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
35 for module in os.listdir(here) |
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
36 if module.endswith('.py') and not module.startswith('_')] |
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
37 packages.extend(modules) |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
38 for package in packages: |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
39 try: |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
40 module = imp.load_package('autobot.projects.'+package, imp.find_module(package, [here])[1]) |
139
a0866ad63d93
fix another syntax error andadd the error handling to detect it
Jeff Hammel <jhammel@mozilla.com>
parents:
133
diff
changeset
|
41 except Exception, e: |
a0866ad63d93
fix another syntax error andadd the error handling to detect it
Jeff Hammel <jhammel@mozilla.com>
parents:
133
diff
changeset
|
42 print >> sys.stderr, "Could not import autobot.projects.%s : %s" % (package, e) |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
43 continue |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
44 for attr in dir(module): |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
45 try: |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
46 _obj = getattr(module, attr) |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
47 if issubclass(_obj, BuildFactory) and _obj.__module__.startswith('autobot.projects.'): |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
48 factories[package] = _obj |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
49 descriptions[package] = (getattr(_obj, '__doc__', attr) or attr).strip() |
189
cb9ad0b04140
preliminary passing of platform information from slaves; not yet tested
Jeff Hammel <jhammel@mozilla.com>
parents:
139
diff
changeset
|
50 args[package] = inspect.getargspec(_obj.__init__).args[1:] # not self |
59
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
51 except TypeError: |
e66165f2f31b
complete automagic imports
Jeff Hammel <jhammel@mozilla.com>
parents:
38
diff
changeset
|
52 continue |
10
9bda5ada5dca
start on a dict of projects
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
53 |