From: "Wiles, Keith" <keith.wiles@intel.com>
To: "McCullough, Harrison" <harrison_mccullough@labs.att.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] bug: Use correct arguments in run.py
Date: Wed, 28 Jun 2017 15:53:05 +0000 [thread overview]
Message-ID: <FF1B8F50-68DB-431F-9F8B-43C6D50BDAC9@intel.com> (raw)
In-Reply-To: <942AD08E4186F644A54168E4F84117C9317C60@SAUSMAILMBX1.ad.tri.sbc.com>
> 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
prev parent reply other threads:[~2017-06-28 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 14:54 McCullough, Harrison
2017-06-28 15:53 ` Wiles, Keith [this message]
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=FF1B8F50-68DB-431F-9F8B-43C6D50BDAC9@intel.com \
--to=keith.wiles@intel.com \
--cc=dev@dpdk.org \
--cc=harrison_mccullough@labs.att.com \
/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).