diff options
author | Mike Frysinger <vapier@gentoo.org> | 2012-04-04 14:07:59 -0400 |
---|---|---|
committer | Paul Varner <fuzzyray@gentoo.org> | 2012-04-04 15:59:42 -0500 |
commit | d3d353c5d9de561d72900c757c49671febe824ea (patch) | |
tree | 93d567e80ae0046744247238b5230a057e8d937a | |
parent | Add patch from Vitaly Shimansky to fix regex in modify_packages() (diff) | |
download | gentoolkit-d3d353c5d9de561d72900c757c49671febe824ea.tar.gz gentoolkit-d3d353c5d9de561d72900c757c49671febe824ea.tar.bz2 gentoolkit-d3d353c5d9de561d72900c757c49671febe824ea.zip |
equery: turn sys.argv into a parameter
This lets other tools import equery and call the main func with its own
set of flags.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Paul Varner <fuzzyray@gentoo.org>
-rwxr-xr-x | bin/equery | 2 | ||||
-rw-r--r-- | pym/gentoolkit/equery/__init__.py | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -35,7 +35,7 @@ except KeyboardInterrupt: from gentoolkit import equery, errors try: - equery.main() + equery.main(sys.argv) except errors.GentoolkitNonZeroExit as err: sys.exit(err.return_code) except errors.GentoolkitException as err: diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py index 9e8834b..a73ef1b 100644 --- a/pym/gentoolkit/equery/__init__.py +++ b/pym/gentoolkit/equery/__init__.py @@ -305,7 +305,7 @@ def split_arguments(args): return args.pop(0), args -def main(): +def main(argv): """Parse input and run the program.""" short_opts = "hqCNV" @@ -316,7 +316,7 @@ def main(): initialize_configuration() try: - global_opts, args = getopt(sys.argv[1:], short_opts, long_opts) + global_opts, args = getopt(argv[1:], short_opts, long_opts) except GetoptError as err: sys.stderr.write(pp.error("Global %s" % err)) print_help(with_description=False) @@ -359,4 +359,4 @@ def main(): raise if __name__ == '__main__': - main() + main(sys.argv) |