8 from wizard import command, deploy, shell, util
10 def main(argv, baton):
11 options, args = parse_args(argv)
12 # XXX: do something smart if -scripts is not at the end
14 if os.path.exists(dir):
15 raise DirectoryExistsError
16 appname, _, version = options.app.partition('-')
17 app = deploy.applications()[appname]
19 sh.call("git", "clone", "--shared", app.repository, dir)
20 with util.ChangeDirectory(dir):
22 sh.call("git", "checkout", options.app)
23 # this command's stdin should be hooked up to ours
25 sh.call("wizard", "configure", *args[1:], interactive=True)
26 except shell.PythonCallError:
30 usage = """usage: %prog install [APP [DIR -- [SETUPARGS]]]
32 Autoinstalls the application APP in the directory
33 DIR. SETUPARGS are arguments that are passed to
34 'wizard configure', see 'wizard configure APP --help'
35 for possible arguments.
37 WARNING: This command's API may change."""
38 parser = command.WizardOptionParser(usage)
39 parser.add_option("--app", dest="app",
40 help="Application to install, optionally specifying a version as APP-VERSION")
41 options, args = parser.parse_all(argv)
43 # XXX: in the future, not specifying stuff is supported, since
44 # we'll prompt for it interactively
45 parser.error("must specify application")
48 class DirectoryExistsError(wizard.Error):
50 return "Directory already exists"