summaryrefslogtreecommitdiff
path: root/guix/scripts/import/json.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-04-19 16:53:01 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-04-19 16:53:01 +0200
commit7abe35febe4234609e14e169b6fcc0cbaf4c7119 (patch)
tree5a8307a28e0c0a6aeab21ce8b9d3487229522588 /guix/scripts/import/json.scm
parent457ded48c54ba04489cb871d3ec6bda0c59bead7 (diff)
parent5c10d55206a4f7a9b932ff08512a4f50c1db35be (diff)
downloadpatches-7abe35febe4234609e14e169b6fcc0cbaf4c7119.tar
patches-7abe35febe4234609e14e169b6fcc0cbaf4c7119.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts/import/json.scm')
-rw-r--r--guix/scripts/import/json.scm12
1 files changed, 3 insertions, 9 deletions
diff --git a/guix/scripts/import/json.scm b/guix/scripts/import/json.scm
index c9daf65479..778e5f4bc5 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 ...)