Index: projects.py |
diff --git a/projects.py b/projects.py |
index 181a1bcb9768f250ba4f25077459084b1468e865..8ca0b7224de40665de3a35a08e7c23e405dc4f40 100644 |
--- a/projects.py |
+++ b/projects.py |
@@ -39,7 +39,6 @@ if os.path.isdir(INTERNAL_DIR): |
import gyp_committers # pylint: disable=F0401 |
import nacl_committers # pylint: disable=F0401 |
import skia_committers # pylint: disable=F0401 |
- import projects_internal # pylint: disable=F0401 |
else: |
print >> sys.stderr, ( |
'Failed to find commit-queue-internal; will fail to start!') |
@@ -47,7 +46,7 @@ else: |
gyp_committers = None |
nacl_committers = None |
skia_committers = None |
- projects_internal = None |
+ |
# It's tricky here because 'chrome' is remapped to 'svn' on src.chromium.org but |
# the other repositories keep their repository name. So don't list it here. |
@@ -760,45 +759,14 @@ def _internal_simple(path, project_bases, user, root_dir, rietveld_obj): |
verifiers) |
-def _get_supported_projects(): |
- """Return project names and corresponding functions in a dict. |
- |
- Projects functions start with '_gen_' and are searched for in the present |
- file and in commit-queue-internal/projects_internal.py. |
- """ |
- projects = {} |
- for name in dir(sys.modules[__name__]): |
- if name.startswith('_gen_'): |
- projects[name[5:]] = getattr(sys.modules[__name__], name) |
- |
- if projects_internal: |
- for name in dir(sys.modules['projects_internal']): |
- if name.startswith('_gen_'): |
- if name[5:] in projects: |
- raise errors.ConfigurationError( |
- 'public project function %s overriden by private one' |
- % name) |
- projects[name[5:]] = getattr(sys.modules['projects_internal'], name) |
- |
- return projects |
- |
- |
def supported_projects(): |
"""List the projects that can be managed by the commit queue.""" |
- return sorted(_get_supported_projects().keys()) |
+ return sorted( |
+ x[5:] for x in dir(sys.modules[__name__]) if x.startswith('_gen_')) |
def load_project(project, user, root_dir, rietveld_obj, no_try): |
- """Loads the specified project. |
- |
- Args: |
- project (string): project name (suffix of _gen_* functions above) |
- user (string): email address identifying the commit bot. |
- root_dir (string): working directory (were credentials are stored e.g. .gaia) |
- rietveld_obj (rietveld.Rietveld): object for communicating with Rietveld. |
- no_try (boolean): is True, means "do not send try jobs" |
- """ |
+ """Loads the specified project.""" |
assert os.path.isabs(root_dir) |
- return _get_supported_projects()[project]( |
- user, root_dir, rietveld_obj, no_try) |
- |
+ return getattr(sys.modules[__name__], '_gen_' + project)( |
+ user, root_dir, rietveld_obj, no_try) |