Subject: [PATCH 11/21] import: juliahub: Improve test dependencies parsing.

From: Nicolas Graves <[email-masked]>
Date: Wed, 15 Mar 2023 13:51:20 +0100

---
 guix/import/juliahub.scm | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/guix/import/juliahub.scm b/guix/import/juliahub.scm
index 5327e92325..2ea461b72a 100644
--- a/guix/import/juliahub.scm
+++ b/guix/import/juliahub.scm
@@ -154,31 +154,27 @@ (define (json->juliahub-dependencies vector)
                #f)))
        (vector->list vector))))
 
-(define (ini-list->extra-dependencies lst)
+(define (ini-list->test-dependencies lst)
   (match lst
-    (('(extras) ooo ...)
-     (extra-list->extra-dependencies ooo))
-    (((tag) ooo ...)
-     (ini-list->extra-dependencies ooo))
-    ((attribute '= value ooo ...)
-     (ini-list->extra-dependencies ooo))
+    (('test '= ooo ...)
+     `(,(caar ooo) ,@(test-list->test-dependencies (cdar ooo))))
+    ((value ooo ...)
+     (ini-list->test-dependencies ooo))
     ('()
-     '())))
+      '())))
 
-(define (extra-list->extra-dependencies lst)
+(define (test-list->test-dependencies lst)
   (match lst
-    ((attribute '= value ooo ...)
-     `(,(symbol->string attribute) ,@(extra-list->extra-dependencies ooo)))
-    (((tag) ooo ...)
-     '())
+    ((('unquote value) ooo ...)
+     `(,value ,@(test-list->test-dependencies ooo)))
     ('()
-     '())))
+      '())))
 
-(define (parse-extra-dependencies directory)
+(define (parse-test-dependencies directory)
   (let* ((port (open-input-file (string-append directory "/Project.toml")))
          (ini-list (stream->list (port->stream port read))))
     (close-port port)
-    (ini-list->extra-dependencies ini-list)))
+    (ini-list->test-dependencies ini-list)))
 
 ;; Julia package.
 (define-json-mapping <juliahub-package> make-juliahub-package juliahub-package?
@@ -268,7 +264,7 @@ (define* (juliahub->guix-package package-name
                  (licenses
                   (map spdx-string->license
                        (list (juliahub-package-license package))))
-                 (test-dependencies-names (parse-extra-dependencies directory)))
+                 (test-dependencies-names (parse-test-dependencies directory)))
             (values (make-julia-sexp
                      package-name
                      source
-- 
2.39.2