[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#62202] [PATCH v2 17/23] DRAFT import: juliahub: More robust toml re
From: |
Simon Tournier |
Subject: |
[bug#62202] [PATCH v2 17/23] DRAFT import: juliahub: More robust toml regex parser. |
Date: |
Mon, 18 Sep 2023 20:03:24 +0200 |
From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>
Signed-off-by: Simon Tournier <zimon.toutoune@gmail.com>
---
guix/import/juliahub.scm | 29 ++++++++---------------------
1 file changed, 8 insertions(+), 21 deletions(-)
diff --git a/guix/import/juliahub.scm b/guix/import/juliahub.scm
index 1c7b02929634..3985d8d0be44 100644
--- a/guix/import/juliahub.scm
+++ b/guix/import/juliahub.scm
@@ -154,28 +154,15 @@ (define (json->juliahub-dependencies vector)
#f)))
(vector->list vector))))
-(define (ini-list->test-dependencies lst)
- (match lst
- (('test '= ooo ...)
- `(,(caar ooo) ,@(test-list->test-dependencies (cdar ooo))))
- ((value ooo ...)
- (ini-list->test-dependencies ooo))
- ('()
- '())))
-
-(define (test-list->test-dependencies lst)
- (match lst
- ((('unquote value) ooo ...)
- `(,value ,@(test-list->test-dependencies ooo)))
- ('()
- '())))
-
(define (parse-test-dependencies directory)
(let* ((port (open-input-file (string-append directory "/Project.toml")))
- (ini-list (stream->list (port->stream port read))))
+ (project.toml (get-string-all port))
+ (regex "\ntest = \\[.*\\]")
+ (deps (match:substring (string-match regex project.toml)))
+ (pure (string-delete (list->char-set (list #\" #\ )) deps)))
(close-port port)
(filter (lambda (x) (not (member x %julia-stdlibs)))
- (ini-list->test-dependencies ini-list))))
+ (string-split (string-drop (string-drop-right pure 1) 7) #\,))))
;; Julia package.
(define-json-mapping <juliahub-package> make-juliahub-package juliahub-package?
@@ -243,9 +230,9 @@ (define* (juliahub->guix-package package-name
"Fetch the metadata for PACKAGE-NAME from juliahub.org, and return the
`package' s-expression corresponding to that package, or #f on failure.
Optionally include a VERSION string to fetch a specific version juliahub."
- (let* ((package-toml (ini-fetch (general-url package-name "Package.toml")))
- (subdir (assoc-ref package-toml 'subdir))
- (tag (latest-git-tag (assoc-ref package-toml 'repo)))
+ (let* ((package.toml (ini-fetch (general-url package-name "Package.toml")))
+ (subdir (assoc-ref package.toml 'subdir))
+ (tag (latest-git-tag (assoc-ref package.toml 'repo)))
(package (if version
(juliahub-fetch package-name #:version version)
(if tag
--
2.38.1
- [bug#62202] [PATCH v2 20/23] DRAFT import: juliahub: Fix version management., (continued)
- [bug#62202] [PATCH v2 20/23] DRAFT import: juliahub: Fix version management., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 22/23] DRAFT import: juliahub: output package names as symbols., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 12/23] DRAFT import: juliahub: Add functions to parse the git repo for a git tag., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 23/23] DRAFT guix: import: julia: Fix beautify., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 06/23] DRAFT import: juliahub: Correct source parsing., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 18/23] DRAFT import: juliahub: Beautify description., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 15/23] DRAFT import: juliahub: Add support for versions for juliahub-fetch., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 05/23] DRAFT import: juliahub: Add support for native-inputs., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 09/23] DRAFT import: juliahub: Filter out julia stdlibs., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 14/23] DRAFT import: juliahub: Handle the case where we have a subdirectory., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 17/23] DRAFT import: juliahub: More robust toml regex parser.,
Simon Tournier <=
- [bug#62202] [PATCH v2 11/23] DRAFT import: juliahub: Improve dependency management., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 13/23] DRAFT import: juliahub: Improve test dependencies parsing., Simon Tournier, 2023/09/18
- [bug#66080] [PATCH v2 19/23] DRAFT import: juliahub: Fix license management., Simon Tournier, 2023/09/18
- [bug#62202] [PATCH v2 21/23] DRAFT import: juliahub: Fix undefined homepages., Simon Tournier, 2023/09/18