[dpdk-stable] [PATCH] usertools: fix Python compatibility issue

Li, Xiaoyun xiaoyun.li at intel.com
Thu Mar 11 07:53:31 CET 2021



> -----Original Message-----
> From: stable <stable-bounces at dpdk.org> On Behalf Of beilei.xing at intel.com
> Sent: Thursday, March 4, 2021 11:08
> To: stable at dpdk.org
> Cc: yongxin.liu at windriver.com; Richardson, Bruce
> <bruce.richardson at intel.com>; Yigit, Ferruh <ferruh.yigit at intel.com>; Xing,
> Beilei <beilei.xing at intel.com>
> Subject: [dpdk-stable] [PATCH] usertools: fix Python compatibility issue
> 
> From: Beilei Xing <beilei.xing at 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 at dpdk.org
> 
> Signed-off-by: Beilei Xing <beilei.xing at 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

Acked-by: Xiaoyun Li <xiaoyun.li at intel.com>



More information about the stable mailing list