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.

(From OE-Core rev: 8cb9ac3751424d429a38f6f80d733b289b6684ea)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh authored and Richard Purdie committed 2015-04-13 22:33:20 +01:00
1 parent 7141e48809
commit 3a60a23141
1 file changed
+3 -3
+3 -3
View File
@@ -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