2 import distutils.version
6 from wizard import app, command, deploy, util
9 options, str_show = parse_args(argv, baton)
12 apps = app.applications()
13 show = set(apps[x] for x in str_show)
20 for d in deploy.parse_install_lines(str_show, options.versions_path):
22 c_application.setdefault(d.application, util.Counter())
23 version = util.truncate(d.app_version.version)
24 c_application[d.application].count(version)
26 show.add(d.application)
27 except KeyboardInterrupt:
30 logging.error("%s in %s" % (traceback.format_exc(), d.location))
32 print "No applications found"
33 for application in show:
34 counter = c_application[application]
36 print "%-20s %3d installs" % (application.name, total)
38 for version in sorted(counter.keys(), key=distutils.version.LooseVersion):
40 graph = '+' * int(math.ceil(float(v)/vmax * HISTOGRAM_WIDTH))
41 print " %-16s %3d %s" % (version, v, graph)
44 def parse_args(argv, baton):
45 usage = """usage: %prog summary version [ARGS] [APP]
47 Prints graphs of version usage in autoinstallers
51 Show graphs for all autoinstall versions
52 %prog summary version mediawiki
53 Show graph for MediaWiki autoinstall versions"""
54 parser = command.WizardOptionParser(usage)
55 baton.push(parser, "versions_path")
56 options, args = parser.parse_all(argv)
58 parser.error("too many arguments")