]> scripts.mit.edu Git - wizard.git/blob - wizard/command/summary/unsupported.py
Add support for a working dir in wizard.shell
[wizard.git] / wizard / command / summary / unsupported.py
1 import math
2 import distutils.version
3
4 from wizard import app, command, deploy, shell, util
5
6 def main(argv, baton):
7     options, args = parse_args(argv, baton)
8     appname = args[0]
9     # grab all the supported versions
10     application = app.getApplication(appname)
11     tags = set(shell.eval("git", "--git-dir=" + application.repository(options.srv_path), "tag").strip().split())
12     unsupported = set()
13     for d in deploy.parse_install_lines(appname, options.versions_path):
14         try:
15             version = d.detectVersion()
16         except IOError:
17             continue
18         if "wordpress-%s" % version not in tags:
19             print version
20             unsupported.add(str(version))
21     print "SUMMARY:"
22     for v in sorted(distutils.version.LooseVersion(x) for x in list(unsupported)):
23         print v
24
25 def parse_args(argv, baton):
26     usage = """usage: %prog summary unsupported [ARGS] APP
27
28 Determines what application versions are unsupported in our
29 repository but are extant in migrated/unmigrated installs.
30 We have to calculate the real version using our heuristic,
31 since Git may lie if the user manually upgraded their install."""
32     parser = command.WizardOptionParser(usage)
33     baton.push(parser, "versions_path")
34     baton.push(parser, "srv_path")
35     options, args = parser.parse_all(argv)
36     if len(args) > 1:
37         parser.error("too many arguments")
38     if len(args) < 1:
39         parser.error("must specify application")
40     return options, args
41