commit:     b7397ef293137c1451d5366fc29f7a9dd1fd808a
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 23 11:38:24 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 23 11:38:24 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b7397ef2

main: take argv as an argument

Make the args explicit rather than relying on global sys.argv state.
This is standard form and makes testing easier.

 bin/catalyst     | 2 +-
 catalyst/main.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/catalyst b/bin/catalyst
index 24122b2..72a4cb4 100755
--- a/bin/catalyst
+++ b/bin/catalyst
@@ -34,7 +34,7 @@ except KeyboardInterrupt:
 from catalyst.main import main
 
 try:
-       main()
+       main(sys.argv[1:])
 except KeyboardInterrupt:
        print("Aborted.")
        sys.exit(130)

diff --git a/catalyst/main.py b/catalyst/main.py
index 176871d..f48293e 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -203,9 +203,9 @@ $ catalyst -f stage1-specfile.spec"""
        return parser
 
 
-def main():
+def main(argv):
        parser = get_parser()
-       opts = parser.parse_args(sys.argv[1:])
+       opts = parser.parse_args(argv)
 
        # Initialize the logger before anything else.
        log_level = opts.log_level

Reply via email to