[PATCH 1/1] binman: fallback to importlib_resources on Python 3.8
Chukun Pan
amadeus at jmu.edu.cn
Tue Dec 2 11:00:00 CET 2025
Python 3.7 and 3.8 lack the files attribute in importlib.resources.
Use importlib_resources to fix build errors with Python 3.8:
binman: module 'importlib.resources' has no attribute 'files'
Fixes: 538719cb6a77 ("binman: migrate from pkg_resources to importlib")
Signed-off-by: Chukun Pan <amadeus at jmu.edu.cn>
---
tools/binman/control.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 1307222591d..ef69e5fc4f9 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -9,8 +9,9 @@ from collections import OrderedDict
import glob
try:
import importlib.resources as importlib_resources
-except ImportError: # pragma: no cover
- # for Python 3.6
+ # for Python 3.6, 3.7 and 3.8
+ importlib_resources.files
+except (ImportError, AttributeError):
import importlib_resources
import os
import re
--
2.25.1
More information about the U-Boot
mailing list