[PATCH v2 12/24] buildman: Use importlib to find the help

Simon Glass sjg at chromium.org
Fri Feb 24 02:18:12 CET 2023


Use this function so that the help can be found even when buildman is
running from a package.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Add new patch to use importlib to find the help

 tools/buildman/control.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index fe3b6fa335d..07251b52179 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -3,6 +3,7 @@
 #
 
 import multiprocessing
+import importlib.resources
 import os
 import shutil
 import subprocess
@@ -152,9 +153,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None,
     global builder
 
     if options.full_help:
-        tools.print_full_help(
-            os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
-                         'README.rst'))
+        with importlib.resources.path('buildman', 'README.rst') as readme:
+            tools.print_full_help(str(readme))
         return 0
 
     gitutil.setup()
-- 
2.39.2.637.g21b0678d19-goog



More information about the U-Boot mailing list