unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: itd <itd@net.in.tum.de>
To: 58250@debbugs.gnu.org
Subject: bug#58250: [PATCH 2/2] import: print: Use file-name->module-name.
Date: Sun, 02 Oct 2022 16:38:09 +0200	[thread overview]
Message-ID: <87v8p2e1f2.fsf@localhost> (raw)
In-Reply-To: <handler.58250.B.16647208196976.ack@debbugs.gnu.org>


* guix/import/print.scm (package->code)[package-module-name]: Use
file-name->module-name to build the package module name.
---
This patch updates the JSON importer to use (guix modules)'s
file-name->module-name to determine the module name.

 guix/import/print.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/guix/import/print.scm b/guix/import/print.scm
index 2f54adbd8c..04e6b0a7b1 100644
--- a/guix/import/print.scm
+++ b/guix/import/print.scm
@@ -21,6 +21,7 @@ (define-module (guix import print)
   #:use-module (guix base32)
   #:use-module (guix utils)
   #:use-module (guix licenses)
+  #:use-module (guix modules)
   #:use-module (guix packages)
   #:use-module (guix search-paths)
   #:use-module (guix build-system)
@@ -45,10 +46,7 @@ (define (package->code package)
 when evaluated."
   ;; The module in which the package PKG is defined
   (define (package-module-name pkg)
-    (map string->symbol
-         (string-split (string-drop-right
-                        (location-file (package-location pkg)) 4)
-                       #\/)))
+    (file-name->module-name (location-file (package-location pkg))))
 
   ;; Return the first candidate variable name that is bound to VAL.
   (define (variable-name val mod)
-- 
2.37.3





  parent reply	other threads:[~2022-10-02 15:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02 14:26 bug#58250: guix import json: GUIX_PACKAGE_PATH -- no code for module itd
     [not found] ` <handler.58250.B.16647208196976.ack@debbugs.gnu.org>
2022-10-02 14:35   ` bug#58250: [PATCH 1/2] modules: Remove load path prefix from module name itd
2022-12-23 13:49     ` bug#58250: guix import json: GUIX_PACKAGE_PATH -- no code for module Ludovic Courtès
2022-10-02 14:38   ` itd [this message]
2022-12-23 13:50     ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87v8p2e1f2.fsf@localhost \
    --to=itd@net.in.tum.de \
    --cc=58250@debbugs.gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).