From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [wic][PATCH] wic: Add argv argument to main
Date: Thu, 9 Apr 2015 21:41:20 +0300 [thread overview]
Message-ID: <1428604880-18852-1-git-send-email-ed.bartosh@linux.intel.com> (raw)
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>
---
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
--
2.1.4
reply other threads:[~2015-04-09 18:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428604880-18852-1-git-send-email-ed.bartosh@linux.intel.com \
--to=ed.bartosh@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox