all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 60134@debbugs.gnu.org
Cc: u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>,
	Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Subject: [bug#60134] [PATCH 3/3] patman: locate README.rst via importlib
Date: Fri, 16 Dec 2022 20:45:29 -0500	[thread overview]
Message-ID: <20221217014530.27772-3-maxim.cournoyer@savoirfairelinux.com> (raw)
In-Reply-To: <20221217014530.27772-1-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(-)

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





  parent reply	other threads:[~2022-12-17  1:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-17  1:45 [bug#60132] [PATCH 1/3] patman: remove extraneous imports Maxim Cournoyer
2022-12-17  1:45 ` [bug#60133] [PATCH 2/3] patman: fix installation of README.rst data file Maxim Cournoyer
2022-12-17 22:24   ` Simon Glass
2022-12-21  0:28   ` [bug#60132] " Simon Glass
2022-12-17  1:45 ` Maxim Cournoyer [this message]
2022-12-17 22:24   ` [bug#60134] [PATCH 3/3] patman: locate README.rst via importlib Simon Glass
2022-12-21  0:28   ` [bug#60132] " Simon Glass
2022-12-17 22:24 ` [bug#60132] [PATCH 1/3] patman: remove extraneous imports Simon Glass
2022-12-21  0:28 ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221217014530.27772-3-maxim.cournoyer@savoirfairelinux.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=60134@debbugs.gnu.org \
    --cc=maxim.cournoyer@savoirfairelinux.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.