[PATCH 3/3] patman: locate README.rst via importlib

  • Done
  • quality assurance status badge
Details
2 participants
  • Maxim Cournoyer
  • Simon Glass
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
M
M
Maxim Cournoyer wrote on 17 Dec 2022 02:45
(address . guix-patches@gnu.org)
20221217014530.27772-3-maxim.cournoyer@savoirfairelinux.com
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>
---

tools/patman/main.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/tools/patman/main.py b/tools/patman/main.py
index 8067a288ab..2a2a7eaa24 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:
--
2.38.1
M
M
Maxim Cournoyer wrote on 17 Dec 2022 03:22
control message for bug #60134
(address . control@debbugs.gnu.org)
87y1r6ahwn.fsf@gmail.com
tags 60134 notabug
close 60134
quit
S
S
Simon Glass wrote on 17 Dec 2022 23:24
Re: [PATCH 3/3] patman: locate README.rst via importlib
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
CAPnjgZ0EgrHEHJ-jcp=vVMU48MF+CLoFD=Zo+Hk7_NpXPMQ9HA@mail.gmail.com
On Fri, 16 Dec 2022 at 18:45, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
Toggle quote (12 lines)
>
> 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>
> ---
>
> tools/patman/main.py | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
?
Your comment

This issue is archived.

To comment on this conversation send an email to 60134@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 60134
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch