patches for DPDK stable branches
 help / color / mirror / Atom feed
From: beilei.xing@intel.com
To: stable@dpdk.org
Cc: yongxin.liu@windriver.com, bruce.richardson@intel.com,
	ferruh.yigit@intel.com, Beilei Xing <beilei.xing@intel.com>
Subject: [dpdk-stable] [PATCH] usertools: fix Python compatibility issue
Date: Thu,  4 Mar 2021 11:07:36 +0800	[thread overview]
Message-ID: <20210304030736.69702-1-beilei.xing@intel.com> (raw)

From: Beilei Xing <beilei.xing@intel.com>

For LTS release before 20.02 which should support both Python 2 and 3,
when running usertools/dpdk-devbind.py with Python 2,there'll be the
following error:

Traceback (most recent call last):
  File "usertools/dpdk-devbind.py", line 755, in <module>
    main()
  File "usertools/dpdk-devbind.py", line 743, in main
    check_modules()
  File "usertools/dpdk-devbind.py", line 198, in check_modules
    if module_is_loaded(mod["Name"]):
  File "usertools/dpdk-devbind.py", line 177, in module_is_loaded
    release = platform.uname().release
AttributeError: 'tuple' object has no attribute 'release'

The root cause is that Python 2 doesn't support
platform.uname().release, which is supported by Python 3.

Fixes: 1e794e710d18 ("usertools: fix binding built-in kernel driver")
Cc: stable@dpdk.org

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 usertools/dpdk-devbind.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 262a5ff3a9..44ea3dd30b 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -174,7 +174,7 @@ def module_is_loaded(module):
     loaded_modules = sysfs_mods
 
     # add built-in modules as loaded
-    release = platform.uname().release
+    release = platform.release()
     filename = os.path.join("/lib/modules/", release, "modules.builtin")
     if os.path.exists(filename):
         try:
-- 
2.26.2


             reply	other threads:[~2021-03-04  3:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04  3:07 beilei.xing [this message]
2021-03-11  6:53 ` Li, Xiaoyun

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=20210304030736.69702-1-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    --cc=yongxin.liu@windriver.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).