[dpdk-dev] [PATCH] bug: Use correct arguments in run.py

Wiles, Keith keith.wiles at intel.com
Wed Jun 28 17:53:05 CEST 2017


> On Jun 28, 2017, at 7:54 AM, McCullough, Harrison <harrison_mccullough at 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 at 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



More information about the dev mailing list