6 from wizard import command, deploy
9 usage = """usage: %prog summary [ARGS] APPS
11 Scans all of the collected data from parallel-find.pl, and
12 calculates interesting information about them.
15 count-exists Counts how many autoinstalls contain a file
16 list Prints the locations of all autoinstalls
17 list-errors Prints all errors that occurred during parsing
18 version Breakdown of autoinstalls by version (default)
20 Use %prog summary SUBCOMMAND --help for more information."""
21 parser = command.WizardOptionParser(usage)
22 parser.disable_interspersed_args()
23 baton.push(parser, "versions_path")
24 _, args = parser.parse_all(argv)
27 command_name = args[0]
29 command_name = "version"
30 def get_command(name):
31 member = name.replace("-", "_")
32 module = "wizard.command.summary." + member
34 return getattr(wizard.command.summary, member)
37 get_command(rest_argv[0]).main(['--help'], baton)
39 parser.error("invalid action")
44 command_module = get_command(command_name)
46 parser.error("invalid action")
47 command_module.main(rest_argv, baton)
49 ## -- some generic helper stuff --
51 def parse_install_lines(show, options, yield_errors = False):
52 if not show: show = deploy.applications
53 show = frozenset(show)
54 for line in deploy.getInstallLines(options.versions_path):
57 d = deploy.Deployment.parse(line)
58 name = d.application.name
59 except deploy.NoSuchApplication as e:
64 # we consider this a worse error
65 logging.warning("Error with '%s'" % line.rstrip())
68 if name + "-" + str(d.version) in show or name in show:
75 class Counter(object):
78 def count(self, value):
79 self.dict.setdefault(value, 0)
81 def __getitem__(self, key):
84 return self.dict.__iter__()