diff mbox series

[bug#70923,v3,10/11] import: egg: Use maybe-*inputs procedures.

Message ID 4bb46928e59df2b38889d6f82c60bd08419d9605.1727207512.git.herman@rimm.ee
State New
Headers show
Series Add (guix import utils) procedures. | expand

Commit Message

Herman Rimm Sept. 24, 2024, 8:13 p.m. UTC
* guix/import/egg.scm (maybe-inputs): Delete procedure.
(egg-parse-dependency): Simplify procedure to return strings.
(egg->guix-package): Use maybe-*inputs procedures.

Change-Id: Ib0a3f5b6f02912c847defd02ba7675d80005279b
---
 guix/import/egg.scm | 39 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 28 deletions(-)
diff mbox series

Patch

diff --git a/guix/import/egg.scm b/guix/import/egg.scm
index e3bc158475..97d09a7c9d 100644
--- a/guix/import/egg.scm
+++ b/guix/import/egg.scm
@@ -3,6 +3,7 @@ 
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -229,23 +230,14 @@  (define* (egg->guix-package name version #:key (file #f) (source #f)
                           (else char)))
                       (maybe-symbol->string name)))
 
-        (define* (egg-parse-dependency name #:key (system? #f))
-          (define extract-name
-            (match-lambda
-              ((name version) name)
-              (name name)))
-
-          (define (prettify-name name)
+        (define* (egg-parse-dependency dependency #:key (system? #f))
+          (let ((name (match dependency
+                        ((name version) name)
+                        (name name))))
             (if system?
                 (prettify-system-dependency name)
-                (maybe-symbol->string name)))
-          
-          (let ((name (prettify-name (extract-name name))))
-            ;; Dependencies are sometimes specified as symbols and sometimes
-            ;; as strings
-            (string->symbol (string-append
-                             (if system? "" package-name-prefix)
-                             name))))
+                (string-append package-name-prefix
+                               (maybe-symbol->string name)))))
 
         (define egg-propagated-inputs
           (let ((dependencies (assoc-ref egg-content 'dependencies)))
@@ -277,15 +269,6 @@  (define* (egg->guix-package name version #:key (file #f) (source #f)
                               test+build-dependencies))
               (() '()))))
 
-        ;; Copied from (guix import hackage).
-        (define (maybe-inputs input-type inputs)
-          (match inputs
-            (()
-             '())
-            ((inputs ...)
-             (list (list input-type
-                         `(list ,@inputs))))))
-
         (values
          `(package
             (name ,(egg-name->guix-name name))
@@ -303,16 +286,16 @@  (define* (egg->guix-package name version #:key (file #f) (source #f)
                                    "failed to download tar archive"))))))
             (build-system chicken-build-system)
             (arguments ,(list 'quasiquote (list #:egg-name name)))
-            ,@(maybe-inputs 'native-inputs egg-native-inputs)
-            ,@(maybe-inputs 'inputs egg-inputs)
-            ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs)
+            ,@(maybe-native-inputs egg-native-inputs)
+            ,@(maybe-inputs egg-inputs)
+            ,@(maybe-propagated-inputs egg-propagated-inputs)
             (home-page ,egg-home-page)
             (synopsis ,egg-synopsis)
             (description #f)
             (license ,egg-licenses))
          (filter (lambda (name)
                    (not (member name '("srfi-4"))))
-                 (map (compose guix-name->egg-name symbol->string)
+                 (map guix-name->egg-name
                       (append egg-propagated-inputs
                               egg-native-inputs)))))))