aboutsummaryrefslogtreecommitdiff
path: root/tools/patman
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-12-16 20:45:29 -0500
committerSimon Glass <sjg@chromium.org>2023-01-05 19:21:57 -0700
commita5197fc9c3329e3559e79dabb5acde9d0dd9e102 (patch)
treec0401ca547a63d9fa573f201d8ff57c1b60808a1 /tools/patman
parent425bbed247e3361f45f4c83fbfdb432a0bcc2892 (diff)
downloadu-boot-a5197fc9c3329e3559e79dabb5acde9d0dd9e102.zip
u-boot-a5197fc9c3329e3559e79dabb5acde9d0dd9e102.tar.gz
u-boot-a5197fc9c3329e3559e79dabb5acde9d0dd9e102.tar.bz2
patman: locate README.rst via importlib
Rationale: this is more robust than assumptions about the file hierarchy layout of the installation of patman, for example on non file-hierarchy standard (FHS) systems such as Guix System or Nix OS. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman')
-rwxr-xr-xtools/patman/main.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/patman/main.py b/tools/patman/main.py
index 8067a28..2a2a7ea 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -7,6 +7,7 @@
"""See README for more information"""
from argparse import ArgumentParser
+import importlib.resources
import os
import re
import sys
@@ -160,11 +161,8 @@ elif args.cmd == 'send':
fd.close()
elif args.full_help:
- tools.print_full_help(
- os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),
- 'README.rst')
- )
-
+ with importlib.resources.path('patman', 'README.rst') as readme:
+ tools.print_full_help(str(readme))
else:
# If we are not processing tags, no need to warning about bad ones
if not args.process_tags: