[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/12: import/json: Use json->code.
From: |
guix-commits |
Subject: |
06/12: import/json: Use json->code. |
Date: |
Thu, 16 Apr 2020 17:43:21 -0400 (EDT) |
rekado pushed a commit to branch master
in repository guix.
commit c89343232065c50d196cd194073d2034eaedaf44
Author: Ricardo Wurmus <address@hidden>
AuthorDate: Wed Apr 15 00:38:15 2020 +0200
import/json: Use json->code.
* guix/import/json.scm (json->code): Export procedure.
* guix/scripts/import/json.scm (guix-import-json): Use json->code.
---
guix/import/json.scm | 1 +
guix/scripts/import/json.scm | 12 +++---------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/guix/import/json.scm b/guix/import/json.scm
index 16dc2ad..8f8dbbd 100644
--- a/guix/import/json.scm
+++ b/guix/import/json.scm
@@ -28,6 +28,7 @@
#:use-module (srfi srfi-2)
#:use-module (srfi srfi-34)
#:export (json-fetch
+ json->code
json->scheme-file))
(define* (json-fetch url
diff --git a/guix/scripts/import/json.scm b/guix/scripts/import/json.scm
index c9daf65..778e5f4 100644
--- a/guix/scripts/import/json.scm
+++ b/guix/scripts/import/json.scm
@@ -23,7 +23,7 @@
#:use-module (guix utils)
#:use-module (guix scripts)
#:use-module (guix import utils)
- #:use-module (guix import print)
+ #:use-module (guix import json)
#:use-module (guix scripts import)
#:use-module (guix packages)
#:use-module (srfi srfi-1)
@@ -88,14 +88,8 @@ Import and convert the JSON package definition in
PACKAGE-FILE.\n"))
(reverse opts))))
(match args
((file-name)
- (catch 'json-invalid
- (lambda ()
- (let ((json (json-string->scm
- (with-input-from-file file-name read-string))))
- ;; TODO: also print define-module boilerplate
- (package->code (alist->package json))))
- (lambda _
- (leave (G_ "invalid JSON in file '~a'~%") file-name))))
+ (or (json->code file-name)
+ (leave (G_ "invalid JSON in file '~a'~%") file-name)))
(()
(leave (G_ "too few arguments~%")))
((many ...)
- branch master updated (7b2cb1b -> c9f321e), guix-commits, 2020/04/16
- 01/12: import/print: Return license with prefix., guix-commits, 2020/04/16
- 03/12: import/json: Add json->scheme-file., guix-commits, 2020/04/16
- 07/12: import/print: package->code: Wrap S-expression in definition., guix-commits, 2020/04/16
- 12/12: doc: Document building and installing from JSON files., guix-commits, 2020/04/16
- 05/12: scripts/package: Handle JSON files., guix-commits, 2020/04/16
- 10/12: import/utils: alist->package: Include arguments., guix-commits, 2020/04/16
- 02/12: import/print: package->code: Wrap build system value in module reference., guix-commits, 2020/04/16
- 09/12: import/json: json->code: Handle files with more than one definition., guix-commits, 2020/04/16
- 04/12: scripts/build: options->things-to-build: Handle .json files., guix-commits, 2020/04/16
- 06/12: import/json: Use json->code.,
guix-commits <=
- 11/12: import/print: Don't factorize URI if there's no version match., guix-commits, 2020/04/16
- 08/12: import/utils: alist->package: Ignore known inputs., guix-commits, 2020/04/16