patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] usertools: fix Python compatibility issue
@ 2021-03-04  3:07 beilei.xing
  2021-03-11  6:53 ` Li, Xiaoyun
  0 siblings, 1 reply; 2+ messages in thread
From: beilei.xing @ 2021-03-04  3:07 UTC (permalink / raw)
  To: stable; +Cc: yongxin.liu, bruce.richardson, ferruh.yigit, Beilei Xing

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-11  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04  3:07 [dpdk-stable] [PATCH] usertools: fix Python compatibility issue beilei.xing
2021-03-11  6:53 ` Li, Xiaoyun

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).