usertools: fix syntax warning in python 3.8

Message ID 20200212123156.20434-1-thomas.faivre@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series usertools: fix syntax warning in python 3.8 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation fail apply issues

Commit Message

Thomas Faivre Feb. 12, 2020, 12:31 p.m. UTC
  Silent the following warning when running script with python 3.8:

> /usr/bin/dpdk-pmdinfo:542: SyntaxWarning: "is" with a literal.
> Did you mean "=="?
>   if (autoload_path is None or autoload_path is ""):

As autoload_path can only be None or a string, directly check its bool
value.

Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information")
Cc: stable@dpdk.org

Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>
---
 usertools/dpdk-pmdinfo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon Feb. 16, 2020, 9:13 p.m. UTC | #1
12/02/2020 13:31, Thomas Faivre:
> Silent the following warning when running script with python 3.8:
> 
> > /usr/bin/dpdk-pmdinfo:542: SyntaxWarning: "is" with a literal.
> > Did you mean "=="?
> >   if (autoload_path is None or autoload_path is ""):
> 
> As autoload_path can only be None or a string, directly check its bool
> value.
> 
> Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Thomas Faivre <thomas.faivre@6wind.com>

Applied, thanks
  

Patch

diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 069a3bf124b2..9d5c6369a017 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -539,7 +539,7 @@  def scan_for_autoload_pmds(dpdk_path):
         return
 
     (autoload_path, scannedfile) = readelf.search_for_autoload_path()
-    if (autoload_path is None or autoload_path is ""):
+    if not autoload_path:
         if (raw_output is False):
             print("No autoload path configured in %s" % dpdk_path)
         return