From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00191d01.pphosted.com (mx0b-00191d01.pphosted.com [67.231.157.136]) by dpdk.org (Postfix) with ESMTP id DBB0A2C13 for ; Wed, 28 Jun 2017 16:54:58 +0200 (CEST) Received: from pps.filterd (m0049463.ppops.net [127.0.0.1]) by m0049463.ppops.net-00191d01. (8.16.0.17/8.16.0.17) with SMTP id v5SEsZN8029666 for ; Wed, 28 Jun 2017 10:54:58 -0400 Received: from flpd657.enaf.ffdc.sbc.com (sbcsmtp9.sbc.com [144.160.128.153]) by m0049463.ppops.net-00191d01. with ESMTP id 2bc3qppbty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Jun 2017 10:54:58 -0400 Received: from enaf.ffdc.sbc.com (localhost [127.0.0.1]) by flpd657.enaf.ffdc.sbc.com (8.14.5/8.14.5) with ESMTP id v5SEsvVW074467 for ; Wed, 28 Jun 2017 07:54:57 -0700 Received: from flpi487.ffdc.sbc.com (flpi487.ffdc.sbc.com [130.4.162.181]) by flpd657.enaf.ffdc.sbc.com (8.14.5/8.14.5) with ESMTP id v5SEstUT074462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 28 Jun 2017 07:54:56 -0700 Received: from tlpd252.dadc.sbc.com (tlpd252.dadc.sbc.com [135.31.184.157]) by flpi487.ffdc.sbc.com (RSA Interceptor) for ; Wed, 28 Jun 2017 14:54:34 GMT Received: from dadc.sbc.com (localhost [127.0.0.1]) by tlpd252.dadc.sbc.com (8.14.5/8.14.5) with ESMTP id v5SEsXnf003228 for ; Wed, 28 Jun 2017 09:54:33 -0500 Received: from SAUSMAILHUB.ad.tri.sbc.com (sausmailhub.ad.tri.sbc.com [144.60.55.228]) by tlpd252.dadc.sbc.com (8.14.5/8.14.5) with ESMTP id v5SEsRw4002984 for ; Wed, 28 Jun 2017 09:54:27 -0500 Received: from SAUSMAILMBX1.ad.tri.sbc.com ([144.60.55.229]) by SAUSMAILHUB.ad.tri.sbc.com ([144.60.55.228]) with mapi id 14.03.0351.000; Wed, 28 Jun 2017 09:54:27 -0500 From: "McCullough, Harrison" To: "dev@dpdk.org" Thread-Topic: [PATCH] bug: Use correct arguments in run.py Thread-Index: AdLwHeHb+kgTUFpAQAafm1Az8KRQgg== Date: Wed, 28 Jun 2017 14:54:25 +0000 Message-ID: <942AD08E4186F644A54168E4F84117C9317C60@SAUSMAILMBX1.ad.tri.sbc.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [144.60.57.137] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-RSA-Inspected: yes X-RSA-Classifications: public X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-28_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_policy_notspam policy=outbound_policy score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706280244 Subject: [dpdk-dev] [PATCH] bug: Use correct arguments in run.py X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2017 14:54:59 -0000 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 --- 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) =3D=3D fn: return f - return ""=20 + return None =20 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) =20 - for opt, arg in opts: + for opt, _ in opts: if opt =3D=3D "--help" or opt =3D=3D "-h" or opt =3D=3D "--usage" = or opt =3D=3D "-u": usage() sys.exit(0) @@ -128,13 +128,12 @@ def parse_args(): if opt =3D=3D "--setup" or opt =3D=3D "-s": run_flag =3D False =20 - arg =3D sys.argv[1:] - if arg =3D=3D "": + if not args or len(args) > 1: usage() sys.exit(1) =20 - fn =3D find_file(arg[0], cfg_ext) - if fn !=3D "": + fn =3D find_file(args[0], cfg_ext) + if fn: cfg_file =3D fn =20 def load_cfg(): --=20 1.9.1