]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: Add argv argument to main
authorEd Bartosh <ed.bartosh@linux.intel.com>
Thu, 9 Apr 2015 18:41:20 +0000 (21:41 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 13 Apr 2015 21:28:33 +0000 (22:28 +0100)
Make it possible to call wic as an API from tests passing
command line parameters as arguments to main.

This is yet another enabler for wic unit testing.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/wic

index fd4a67892bf2e2539f8748e9fedaad341497725f..5bedd90f87482fa7848328f7e762b6de08d57453 100755 (executable)
@@ -279,13 +279,13 @@ def start_logging(loglevel):
     logging.basicConfig(filname='wic.log', filemode='w', level=loglevel)
 
 
-def main():
+def main(argv):
     parser = optparse.OptionParser(version="wic version %s" % __version__,
                                    usage=wic_usage)
 
     parser.disable_interspersed_args()
 
-    (options, args) = parser.parse_args()
+    (options, args) = parser.parse_args(argv)
 
     if len(args):
         if args[0] == "help":
@@ -298,7 +298,7 @@ def main():
 
 if __name__ == "__main__":
     try:
-        ret = main()
+        ret = main(sys.argv[1:])
     except Exception:
         ret = 1
         import traceback