1
2 """
3 setup plugin
4
5 Plugin read by omero.cli.Cli during initialization. The method(s)
6 defined here will be added to the Cli class for later use.
7
8 The setup plugin is used during install and upgrade to
9 properly configure a system.
10
11 Copyright 2008 Glencoe Software, Inc. All rights reserved.
12 Use is subject to license terms supplied in LICENSE.txt
13
14 """
15
16 import subprocess, optparse, os, sys
17 from omero.cli import BaseControl
18
20 """
21 Question which knows how to ask itself to the user via raw_input, as well
22 as how to insert itself into optparse.OptionParser.
23 """
24 - def __init__(self, parser, question, default, prompt = """%s [%s] """):
30
32 if not self.result:
33 self.result = raw_input(self.prompt).lower_case()
34 if not self.result or len(self.result) == 0:
35 self.result = self.default
36
38
39 - def help(self, args = None):
40 self.ctx.out(
41 """
42 Syntax: %(program_name)s setup [simple|intermediate|advanced] [+|-psql] [+|-django] [+|-jboss] [dirs]
43 """)
44
46 args = Arguments(*args)
47
48 p = optparse.OptionParser()
49 g = optparse.OptionGroup(p, "Skill level","Number of questions asked by setup")
50 p.add_option("-s", "--simple", dest="simple",
51 help="Ask simple questions only")
52 p.add_option_group(g)
53
54 qs = {
55 "psql":Question(p,"Do you want to install Postgres?","n"),
56 "django":Question(p,"Do you want to install django?","n"),
57 "jboss":Question(p,"Do you want to install JBoss?","y"),
58 "bust":Question(p,"Would you like to have your logfiles and other state in a separate dir?","n")
59 }
60
61 (options, args) = p.parse_args(args)
62
63 try:
64 for key, q in qs.items():
65 q.ask()
66 except KeyboardError, ke:
67 return
68
69 """
70 import getpass
71 password = getpass.getpass()
72 print password
73
74 print getpass.getuser()
75 """
76
77 try:
78
79 pass
80 except NameError:
81 SetupControl()._main()
82