1 |
commit: d3d353c5d9de561d72900c757c49671febe824ea |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Apr 4 18:07:59 2012 +0000 |
4 |
Commit: Paul Varner <fuzzyray <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 4 20:59:42 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=d3d353c5 |
7 |
|
8 |
equery: turn sys.argv into a parameter |
9 |
|
10 |
This lets other tools import equery and call the main func with its own |
11 |
set of flags. |
12 |
|
13 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
14 |
Signed-off-by: Paul Varner <fuzzyray <AT> gentoo.org> |
15 |
|
16 |
--- |
17 |
bin/equery | 2 +- |
18 |
pym/gentoolkit/equery/__init__.py | 6 +++--- |
19 |
2 files changed, 4 insertions(+), 4 deletions(-) |
20 |
|
21 |
diff --git a/bin/equery b/bin/equery |
22 |
index 343f92d..35e9d7d 100755 |
23 |
--- a/bin/equery |
24 |
+++ b/bin/equery |
25 |
@@ -35,7 +35,7 @@ except KeyboardInterrupt: |
26 |
from gentoolkit import equery, errors |
27 |
|
28 |
try: |
29 |
- equery.main() |
30 |
+ equery.main(sys.argv) |
31 |
except errors.GentoolkitNonZeroExit as err: |
32 |
sys.exit(err.return_code) |
33 |
except errors.GentoolkitException as err: |
34 |
|
35 |
diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py |
36 |
index 9e8834b..a73ef1b 100644 |
37 |
--- a/pym/gentoolkit/equery/__init__.py |
38 |
+++ b/pym/gentoolkit/equery/__init__.py |
39 |
@@ -305,7 +305,7 @@ def split_arguments(args): |
40 |
return args.pop(0), args |
41 |
|
42 |
|
43 |
-def main(): |
44 |
+def main(argv): |
45 |
"""Parse input and run the program.""" |
46 |
|
47 |
short_opts = "hqCNV" |
48 |
@@ -316,7 +316,7 @@ def main(): |
49 |
initialize_configuration() |
50 |
|
51 |
try: |
52 |
- global_opts, args = getopt(sys.argv[1:], short_opts, long_opts) |
53 |
+ global_opts, args = getopt(argv[1:], short_opts, long_opts) |
54 |
except GetoptError as err: |
55 |
sys.stderr.write(pp.error("Global %s" % err)) |
56 |
print_help(with_description=False) |
57 |
@@ -359,4 +359,4 @@ def main(): |
58 |
raise |
59 |
|
60 |
if __name__ == '__main__': |
61 |
- main() |
62 |
+ main(sys.argv) |