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