summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-08-04 11:44:43 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-08-04 11:45:26 +0100
commit47805d9733a97d52f1236d9f5adfc08287ae5c21 (patch)
tree2cd50537895c909725f0be389e466e17eba520ae /pykolab
parent03b7bd9f19b635bd4818240a7b88f01c6cb44d3a (diff)
downloadpykolab-47805d9733a97d52f1236d9f5adfc08287ae5c21.tar.gz
Ensure all components get their chance to insert their own command-line switches
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/components.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/pykolab/setup/components.py b/pykolab/setup/components.py
index 4633160..f69db05 100644
--- a/pykolab/setup/components.py
+++ b/pykolab/setup/components.py
@@ -32,7 +32,7 @@ components = {}
component_groups = {}
executed_components = []
-executed_components = []
+finalize_conf_ok = None
def __init__():
# We only want the base path
@@ -116,8 +116,26 @@ def _list_components(*args, **kw):
return _components
+def cli_options_from_component(component_name, *args, **kw):
+ if components[component_name].has_key('group'):
+ group = components[component_name]['group']
+ component_name = components[component_name]['component_name']
+ try:
+ exec("from %s.setup_%s import cli_options as %s_%s_cli_options" % (group,component_name,group,component_name))
+ exec("%s_%s_cli_options()" % (group,component_name))
+ except ImportError, e:
+ pass
+
+ else:
+ try:
+ exec("from setup_%s import cli_options as %s_cli_options" % (component_name,component_name))
+ exec("%s_cli_options()" % (component_name))
+ except ImportError, e:
+ pass
+
def execute(component_name, *args, **kw):
if component_name == '':
+
log.debug(
_("No component selected, continuing for all components"),
level=8
@@ -152,6 +170,9 @@ def execute(component_name, *args, **kw):
break
return
+ else:
+ for component in _list_components():
+ cli_options_from_component(component)
if not components.has_key(component_name):
log.error(_("No such component."))
@@ -162,22 +183,6 @@ def execute(component_name, *args, **kw):
log.error(_("No such component."))
sys.exit(1)
- if components[component_name].has_key('group'):
- group = components[component_name]['group']
- component_name = components[component_name]['component_name']
- try:
- exec("from %s.setup_%s import cli_options as %s_%s_cli_options" % (group,component_name,group,component_name))
- exec("%s_%s_cli_options()" % (group,component_name))
- except ImportError, e:
- pass
-
- else:
- try:
- exec("from setup_%s import cli_options as %s_cli_options" % (component_name,component_name))
- exec("%s_cli_options()" % (component_name))
- except ImportError, e:
- pass
-
conf.finalize_conf()
if len(conf.cli_args) >= 1: