summaryrefslogtreecommitdiffstats
path: root/setup-kolab.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-10-28 12:18:43 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-10-28 12:18:43 +0100
commit22cfcd2406a44a49bbd263a2600f923a28f8be4c (patch)
treed5ac8c9903857f79cab46783a48182da67c5f9bc /setup-kolab.py
parent45d4f21fe57ba47f97bf29e714bacdecdd2edca2 (diff)
downloadpykolab-22cfcd2406a44a49bbd263a2600f923a28f8be4c.tar.gz
Use the CLI command registration mechanism for setup components as well
Diffstat (limited to 'setup-kolab.py')
-rwxr-xr-xsetup-kolab.py46
1 files changed, 7 insertions, 39 deletions
diff --git a/setup-kolab.py b/setup-kolab.py
index 8dd8416..f8f9083 100755
--- a/setup-kolab.py
+++ b/setup-kolab.py
@@ -26,49 +26,17 @@ import sys
# For development purposes
sys.path.extend(['.', '..'])
-from pykolab.translate import _
-from pykolab import constants
-from pykolab import utils
+import pykolab
+
+from pykolab.setup import Setup
try:
- import pykolab.logger
+ from pykolab.constants import *
except ImportError, e:
- print >> sys.stderr, _("Cannot load pykolab/logger.py:")
+ print >> sys.stderr, _("Cannot load pykolab/constants.py:")
print >> sys.stderr, "%s" % e
sys.exit(1)
-def load_setup(component):
- """
- Load a setup component.
-
- Accepts one of the components listed in constants.COMPONENTS.
- """
-
- try:
- exec("from pykolab.setup import %s_setup" % component)
- try:
- exec("%s_setup()" % component)
- except NameError, e:
- print >> sys.stderr, _("Cannot find %s_setup().") % component
- except ImportError, e:
- print >> sys.stderr, _("Cannot load setup for %s.") % component
-
if __name__ == "__main__":
- # Means we get to ask some questions.
- print _("Please select the components to set up:")
-
- component_index = 1
- for component in constants.COMPONENTS:
- print "%d) %s" %(component_index,component)
- component_index += 1
-
- _input_selected_components = raw_input(_("Selection") + ": ")
- selected_components = utils.parse_input(_input_selected_components, [ ' ', ',' ])
-
- # Using the components in the selection dialog, we now go ahead with the real
- # work:
- component_index = 1
- for component in constants.COMPONENTS:
- if selected_components.count("%s" %(component_index)):
- load_setup(component)
- component_index += 1
+ kolab = Setup()
+ kolab.run()