From patchwork Wed Nov 4 06:48:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 83645 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA71AA04E7; Wed, 4 Nov 2020 07:50:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9CB0C7F4; Wed, 4 Nov 2020 07:49:02 +0100 (CET) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by dpdk.org (Postfix) with ESMTP id C10DCBE99 for ; Wed, 4 Nov 2020 07:48:57 +0100 (CET) Received: by mail-pg1-f177.google.com with SMTP id r10so15729150pgb.10 for ; Tue, 03 Nov 2020 22:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3CDta7I/VzmOX9PRytegahW9P/kftjJF4vnSIXOrsVo=; b=BymJSOc2zhZ/d7v+AdQi+PaDVDq4+AFmlTAmLSv3IB2+pdqwTjq2a2Ovvg6gSICaqf iqwT4nbxZQ2QW4zW85118mWGjLr7yp3u46HbETxzZIjmvD7stOZJ7E3P3Dk8500J7XMO xaGcvWQ2JzbFmEEw/d/rArK5JgSUbMi0hvr3m4eaaeOiPhPnvfJU/qOq8Ddd3dP5qeYn YcQD1FoxeURUYmmCCZKi1w7ovXf143IAsCSwtDoyBqrNYNXLsU+daqpCP3e7qhsdFc/X Ro95Btr0BtJUtn6jHmhbu6R7G2jaDdA6e78uRZmvKu9kaFr3NL++3H4tq1Eg2iiY98iE G6PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3CDta7I/VzmOX9PRytegahW9P/kftjJF4vnSIXOrsVo=; b=oqe6mJfnUHlICtgSNVFSelRSnZrI5pGMGjWbPo3PwQ+ss/DxtzUJgaOXTnLNzzBmpu 8W20AR9V0YJGvWaKzEBlThqUIdamo+f0qAtBCHS9cTyIQfx2gYu9S1D1jQJNjR4zZUJI MIZXNweIKVKN37mhwmB/LHVKSXPscXYQ93FX0MecssNWPzanruHx+FmXENAVoa75CPtO JwTaEETyQ394NK+8Px78+h13wKMY4EZwfN8vYeKOFRHvI063pm9vacERFzspAyoV/ryR mdnywzzQAuyIrixxTvNkIsSnulFn9ZNdcEY5naBN0IqppMaJNPWa7gQxGnmTU48cNPwG noGQ== X-Gm-Message-State: AOAM533/IpZZ+irn2uyQSCCSIJ8mpiS+WHZf+XUrB2jx8JKOCIy8mul8 lQ/7sdUOslfwScHU4ydUIIdhDSyFfxFK4S60 X-Google-Smtp-Source: ABdhPJwGB4LlUS2eFQ2y/ElZ5CnF9CwgGY1BeGxvKuP30vQ8JZV9o7K65KWQzJRVcVa5siviQI3Njw== X-Received: by 2002:a65:52cb:: with SMTP id z11mr19702144pgp.368.1604472536044; Tue, 03 Nov 2020 22:48:56 -0800 (PST) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id c12sm1144137pgi.14.2020.11.03.22.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 22:48:55 -0800 (PST) From: Stephen Hemminger To: nhorman@tuxdriver.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 3 Nov 2020 22:48:39 -0800 Message-Id: <20201104064842.25832-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201104064842.25832-1-stephen@networkplumber.org> References: <20200906013133.26360-3-stephen@networkplumber.org> <20201104064842.25832-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 4/7] dpdk-pmdinfo: replace is False and is True 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Code reads better if unnecessary comparison with False and True is not used. Signed-off-by: Stephen Hemminger --- usertools/dpdk-pmdinfo.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py index c9ecf45a72f3..8c4698063fb4 100755 --- a/usertools/dpdk-pmdinfo.py +++ b/usertools/dpdk-pmdinfo.py @@ -375,7 +375,7 @@ def search_for_autoload_path(self): ":/usr/lib64:/lib64:/usr/lib:/lib") if library is None: return (None, None) - if raw_output is False: + if not raw_output: print("Scanning for autoload path in %s" % library) scanfile = open(library, 'rb') scanelf = ReadElf(scanfile, sys.stdout) @@ -451,7 +451,7 @@ def process_dt_needed_entries(self): runpath + ":" + ldlibpath + ":/usr/lib64:/lib64:/usr/lib:/lib") if library is not None: - if raw_output is False: + if not raw_output: print("Scanning %s for pmd information" % library) with open(library, 'rb') as file: try: @@ -481,7 +481,7 @@ def force_bytes(s): def scan_autoload_path(autoload_path): global raw_output - if os.path.exists(autoload_path) is False: + if not os.path.exists(autoload_path): return try: @@ -505,7 +505,7 @@ def scan_autoload_path(autoload_path): # No permission to read the file, skip it continue - if raw_output is False: + if not raw_output: print("Hw Support for library %s" % d) readelf.display_pmd_info_strings(".rodata") file.close() @@ -518,8 +518,8 @@ def scan_for_autoload_pmds(dpdk_path): """ global raw_output - if os.path.isfile(dpdk_path) is False: - if raw_output is False: + if not os.path.isfile(dpdk_path): + if not raw_output: print("Must specify a file name") return @@ -527,22 +527,22 @@ def scan_for_autoload_pmds(dpdk_path): try: readelf = ReadElf(file, sys.stdout) except ElfError: - if raw_output is False: + if not raw_output: print("Unable to parse %s" % file) return (autoload_path, scannedfile) = readelf.search_for_autoload_path() if not autoload_path: - if raw_output is False: + if not raw_output: print("No autoload path configured in %s" % dpdk_path) return - if raw_output is False: + if not raw_output: if scannedfile is None: scannedfile = dpdk_path print("Found autoload path %s in %s" % (autoload_path, scannedfile)) file.close() - if raw_output is False: + if not raw_output: print("Discovered Autoload HW Support:") scan_autoload_path(autoload_path) return @@ -601,14 +601,14 @@ def main(stream=None): optparser.print_usage() exit(1) - if options.pdir is True: + if options.pdir: exit(scan_for_autoload_pmds(args[0])) ldlibpath = os.environ.get('LD_LIBRARY_PATH') if ldlibpath is None: ldlibpath = "" - if os.path.exists(args[0]) is True: + if os.path.exists(args[0]): myelffile = args[0] else: myelffile = search_file(