Subject: [PATCH 2/2] import: print: Use file-name->module-name.

From: itd <[email-masked]>
Date: Sun, 02 Oct 2022 16:38:09 +0200

* 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