import optparse
import os
+import logging
-from wizard.command import _command
-
-# submodules
-import list
-import version
-import count_exists
-
-def summary_count_exists(deploys, options, args):
- for d in deploys:
- if os.path.exists(d.location + "/" + value):
- print d.location
+import wizard
+from wizard import command, deploy
def main(argv, baton):
usage = """usage: %prog summary [ARGS] APPS
calculates interesting information about them.
Its subcommands are:
- count-exists Counts how many autoinstalls contain a file
- list Prints the locations of all autoinstalls
- versions Breakdown of autoinstalls by version
+ unsupported List unsupported versions in the wild
+ version Breakdown of autoinstalls by version (default)
Use %prog summary SUBCOMMAND --help for more information."""
- parser = _command.WizardOptionParser(usage)
+ parser = command.WizardOptionParser(usage)
parser.disable_interspersed_args()
baton.push(parser, "versions_path")
_, args = parser.parse_all(argv)
rest_argv = args[1:]
try:
- command = args[0]
+ command_name = args[0]
except IndexError:
- command = "version"
+ command_name = "version"
def get_command(name):
- return globals()[name.replace("-", "_")]
+ member = name.replace("-", "_")
+ module = "wizard.command.summary." + member
+ __import__(module)
+ return getattr(wizard.command.summary, member)
if command == "help":
try:
get_command(rest_argv[0]).main(['--help'], baton)
- except KeyError:
+ except ImportError:
parser.error("invalid action")
except IndexError:
parser.print_help()
raise SystemExit(1)
try:
- command_module = get_command(command)
- except AttributeError:
+ command_module = get_command(command_name)
+ except ImportError:
parser.error("invalid action")
command_module.main(rest_argv, baton)