summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-09-04 18:54:59 +0300
committerSimon Glass <sjg@chromium.org>2023-09-23 18:00:37 +0300
commit305114eb839400bfbad48182b12421dfb8150122 (patch)
tree2d86f857889aae1c56b03bf0dfe5c1713a251cec
parent8acdb70c101530df17a655f44a7c6f3ff6e5a6dc (diff)
downloadu-boot-305114eb839400bfbad48182b12421dfb8150122.tar.xz
buildman: Fix full help for Python 3.8
With Python versions older than 3.9 Buildman produces an error on start-up. Fix this with a workaround for importlib. There is already a workaround for v3.6 but I am not sure if that is still functioning. Signed-off-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-xtools/buildman/main.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/buildman/main.py b/tools/buildman/main.py
index 5f42a58ddb..3cf877e5e6 100755
--- a/tools/buildman/main.py
+++ b/tools/buildman/main.py
@@ -7,7 +7,7 @@
"""See README for more information"""
try:
- from importlib.resources import files
+ import importlib.resources
except ImportError:
# for Python 3.6
import importlib_resources
@@ -83,7 +83,13 @@ def run_buildman():
run_test_coverage()
elif args.full_help:
- tools.print_full_help(str(files('buildman').joinpath('README.rst')))
+ if hasattr(importlib.resources, 'files'):
+ dirpath = importlib.resources.files('buildman')
+ tools.print_full_help(str(dirpath.joinpath('README.rst')))
+ else:
+ with importlib.resources.path('buildman', 'README.rst') as readme:
+ tools.print_full_help(str(readme))
+
# Build selected commits for selected boards
else: