diff options
author | Frederic Lepied <flepied@mandriva.com> | 2005-12-07 10:06:33 +0000 |
---|---|---|
committer | Frederic Lepied <flepied@mandriva.com> | 2005-12-07 10:06:33 +0000 |
commit | 2c78c40c9bfae22d1501022b2e52cf938b5a957e (patch) | |
tree | 33a030236dd735f665e7b1ff1a9fba203742ecc0 /repsys | |
parent | aa9174bf0cce8d6a3c6e4d9e795be717da184406 (diff) | |
download | mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar.gz mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar.bz2 mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar.xz mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.zip |
Initial revisionR1_5_3_1-4mdktopic/V1_5_X@821topic/V1_5_X@819topic/V1_5_3@959topic/V1_5_3@819topic/V1_5_3
Diffstat (limited to 'repsys')
-rwxr-xr-x | repsys | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -0,0 +1,55 @@ +#!/usr/bin/python +from RepSys import Error +from RepSys.command import * +import getopt +import sys + +VERSION="1.5.3" + +HELP = """\ +Usage: repsys COMMAND [COMMAND ARGUMENTS] + +Useful commands: + co + submit + create + getspec + getsrpm + changed + authoremail + +Run "repsys COMMAND --help" for more information. + +Written by Gustavo Niemeyer <gustavo@niemeyer.net> +""" + +def parse_options(): + parser = OptionParser(help=HELP, version="%prog "+VERSION) + parser.disable_interspersed_args() + parser.add_option("--debug", action="store_true") + opts, args = parser.parse_args() + if len(args) < 1: + parser.print_help(sys.stderr) + sys.exit(1) + opts.command = args[0] + opts.argv = args + return opts + +def dispatch_command(command, argv, debug=0): + sys.argv = argv + try: + repsys_module = __import__("RepSys.commands."+command) + commands_module = getattr(repsys_module, "commands") + command_module = getattr(commands_module, command) + except (ImportError, AttributeError): + if debug: + import traceback + traceback.print_exc() + sys.exit(1) + raise Error, "invalid command '%s'" % command + command_module.main() + +if __name__ == "__main__": + do_command(parse_options, dispatch_command) + +# vim:et:ts=4:sw=4 |