4 import distutils.version
6 from wizard import command, deploy, git, shell, util
10 usage = """usage: %prog configure [ARGS]
12 Takes an already cloned working copy and configures the
13 application, running any installer scripts and creating
14 configuration files. Options change depending on what
15 application is being configured in the current working directory.
17 This is a plumbing command, normal users should use
20 # XXX: squick squick squick
21 if argv and argv[0][0] != '-':
22 if '--help' not in argv and '-h' not in argv:
24 if '--help' in argv or '-h' in argv:
25 # Do a "fake parse" in order to get out the application name
26 parser = optparse.OptionParser(usage, add_help_option=False)
27 parser.add_option("--help", "-h", action="store_true")
28 options, args = parser.parse_args(argv)
32 parser.error("Use 'wizard configure --help APP' to see APP-specific options.")
33 version = None # not relevant
36 application, _, version = tag.partition('-')
38 app = deploy.applications()[application]
39 handler = app.install_handler
41 parser = command.WizardOptionParser(usage)
43 options, args = parser.parse_all(argv)
44 handler.handle(options)
46 app.install(distutils.version.LooseVersion(version), options)
49 message = "Autoinstall configuration of %s locker.\n\n%s" % (util.get_dir_owner(), util.get_git_footer())
52 message += "\nConfigured-by: " + util.get_operator_git()
53 except util.NoOperatorInfo:
55 sh.call("git", "commit", "--allow-empty", "-a", "-m", message)