]> scripts.mit.edu Git - wizard.git/blob - wizard/command/summary/__init__.py
Implement 'git summary unsupported'
[wizard.git] / wizard / command / summary / __init__.py
1 import optparse
2 import os
3 import logging
4
5 import wizard
6 from wizard import command, deploy
7
8 def main(argv, baton):
9     usage = """usage: %prog summary [ARGS] APPS
10
11 Scans all of the collected data from parallel-find.pl, and
12 calculates interesting information about them.
13
14 Its subcommands are:
15     unsupported     List unsupported versions in the wild
16     version         Breakdown of autoinstalls by version (default)
17
18 Use %prog summary SUBCOMMAND --help for more information."""
19     parser = command.WizardOptionParser(usage)
20     parser.disable_interspersed_args()
21     baton.push(parser, "versions_path")
22     _, args = parser.parse_all(argv)
23     rest_argv = args[1:]
24     try:
25         command_name = args[0]
26     except IndexError:
27         command_name = "version"
28     def get_command(name):
29         member = name.replace("-", "_")
30         module = "wizard.command.summary." + member
31         __import__(module)
32         return getattr(wizard.command.summary, member)
33     if command == "help":
34         try:
35             get_command(rest_argv[0]).main(['--help'], baton)
36         except ImportError:
37             parser.error("invalid action")
38         except IndexError:
39             parser.print_help()
40             raise SystemExit(1)
41     try:
42         command_module = get_command(command_name)
43     except ImportError:
44         parser.error("invalid action")
45     command_module.main(rest_argv, baton)
46