DPDK patches and discussions
 help / color / mirror / Atom feed
From: "McCullough, Harrison" <harrison_mccullough@labs.att.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] bug: Use correct arguments in run.py
Date: Wed, 28 Jun 2017 14:54:25 +0000	[thread overview]
Message-ID: <942AD08E4186F644A54168E4F84117C9317C60@SAUSMAILMBX1.ad.tri.sbc.com> (raw)

When using run.py it would occasionally ignore the given command line
arguments because the wrong variable was used.  Fixed this, along with
minor changes to reflect more idiomatic Python usage.

Signed-off-by: Harrison McCullough <harrison_mccullough@labs.att.com>
---
 tools/run.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/run.py b/tools/run.py
index ec6f45d..f5ec22c 100755
--- a/tools/run.py
+++ b/tools/run.py
@@ -96,7 +96,7 @@ def find_file(arg, t):
     for f in file_list('.', t):
         if os.path.basename(f) == fn:
             return f
-    return "" 
+    return None
 
 def parse_args():
     ''' Parse the command arguments '''
@@ -118,7 +118,7 @@ def parse_args():
         print("Run '%s --usage' for further information" % sys.argv[0])
         sys.exit(1)
 
-    for opt, arg in opts:
+    for opt, _ in opts:
         if opt == "--help" or opt == "-h" or opt == "--usage" or opt == "-u":
             usage()
             sys.exit(0)
@@ -128,13 +128,12 @@ def parse_args():
         if opt == "--setup" or opt == "-s":
             run_flag = False
     
-    arg = sys.argv[1:]
-    if arg == "":
+    if not args or len(args) > 1:
         usage()
         sys.exit(1)
 
-    fn = find_file(arg[0], cfg_ext)
-    if fn != "":
+    fn = find_file(args[0], cfg_ext)
+    if fn:
         cfg_file = fn
 
 def load_cfg():
-- 
1.9.1

             reply	other threads:[~2017-06-28 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 14:54 McCullough, Harrison [this message]
2017-06-28 15:53 ` Wiles, Keith

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=942AD08E4186F644A54168E4F84117C9317C60@SAUSMAILMBX1.ad.tri.sbc.com \
    --to=harrison_mccullough@labs.att.com \
    --cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).