import os from wizard.command import _command from wizard.command.summary import _summary def main(argv, baton): options, args = parse_args(argv, baton) value = args[0] show = args[1:] for d in _summary.parse_install_lines(show, options): if os.path.exists(d.location + "/" + value): print d.location def parse_args(argv, baton): usage = """usage: %prog summary count-exists [ARGS] FILE [APP[-VERSION]] Lists all autoinstalls that contain FILE in their working copy. Examples: %prog summary count-exists php.ini Finds all autoinstalls that contain php.ini files""" parser = _command.WizardOptionParser(usage) baton.push(parser, "versions_path") options, args = parser.parse_all(argv) if len(args) > 1: parser.error("too many arguments") return options, args