DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bug: Use correct arguments in run.py
@ 2017-06-28 14:54 McCullough, Harrison
  2017-06-28 15:53 ` Wiles, Keith
  0 siblings, 1 reply; 2+ messages in thread
From: McCullough, Harrison @ 2017-06-28 14:54 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] bug: Use correct arguments in run.py
  2017-06-28 14:54 [dpdk-dev] [PATCH] bug: Use correct arguments in run.py McCullough, Harrison
@ 2017-06-28 15:53 ` Wiles, Keith
  0 siblings, 0 replies; 2+ messages in thread
From: Wiles, Keith @ 2017-06-28 15:53 UTC (permalink / raw)
  To: McCullough, Harrison; +Cc: dev


> On Jun 28, 2017, at 7:54 AM, McCullough, Harrison <harrison_mccullough@labs.att.com> wrote:
> 
> 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.

Thanks I will integrate these changes into the next version of Pktgen.

> 
> 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
> 

Regards,
Keith

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-28 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 14:54 [dpdk-dev] [PATCH] bug: Use correct arguments in run.py McCullough, Harrison
2017-06-28 15:53 ` Wiles, Keith

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).