[oe-commits] Ed Bartosh : wic: Add argv argument to main

git at git.openembedded.org git at git.openembedded.org
Sat Apr 11 22:34:06 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: f37297bedb4cc4b899df7d4ef2e4612b9a0e9cf5
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=f37297bedb4cc4b899df7d4ef2e4612b9a0e9cf5

Author: Ed Bartosh <ed.bartosh at linux.intel.com>
Date:   Thu Apr  9 21:41:20 2015 +0300

wic: Add argv argument to main

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 at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/wic | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/wic b/scripts/wic
index fd4a678..5bedd90 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -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



More information about the Openembedded-commits mailing list