summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Boddie <paul@boddie.org.uk>2014-08-07 12:16:22 (GMT)
committerPaul Boddie <paul@boddie.org.uk>2014-08-07 12:16:22 (GMT)
commit020bf7c1a510201532655c54099d5f08fde72f68 (patch)
tree0c8d2713e2220a9b0895a79fa4cdbbea040c392d
parentbb5a821b68a5cbab03fda14b2f3ae72c6791f75e (diff)
downloadpykolab-020bf7c1a510201532655c54099d5f08fde72f68.tar.gz
Supported an explicit "all" argument to set up all components.
-rw-r--r--pykolab/setup/__init__.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/pykolab/setup/__init__.py b/pykolab/setup/__init__.py
index ad66bc1..4d59bc9 100644
--- a/pykolab/setup/__init__.py
+++ b/pykolab/setup/__init__.py
@@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+from os.path import exists
import os
import sys
@@ -32,16 +33,14 @@ class Setup(object):
import components
components.__init__()
- arg_num = 0
- for arg in sys.argv[1:]:
- arg_num += 1
+ for arg_num, arg in enumerate(sys.argv[1:], 1):
if not arg.startswith('-') and len(sys.argv) >= arg_num:
- if components.components.has_key(sys.argv[arg_num].replace('-','_')):
- to_execute.append(sys.argv[arg_num].replace('-','_'))
+ arg = arg.replace('-','_')
+ if components.components.has_key(arg) or arg == "all":
+ to_execute.append(arg)
def run(self):
components.execute('_'.join(to_execute))
- if os.path.exists('/tmp/kolab-setup-my.cnf'):
+ if exists('/tmp/kolab-setup-my.cnf'):
os.unlink('/tmp/kolab-setup-my.cnf')
-