summaryrefslogtreecommitdiff
path: root/guix/scripts/import/pypi.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-02-13 14:24:53 +0100
committerMarius Bakke <marius@gnu.org>2022-02-13 14:24:53 +0100
commit76b6bbdf232b4b82cdd23cfe0d81331a4fd2edec (patch)
tree0e6a57ba08b9c6f9f5cbcdc5b5d9daeea91e428d /guix/scripts/import/pypi.scm
parent1a5302435ff0d2822b823f5a6fe01faa7a85c629 (diff)
parente8af2ea63a7f497b8f8e19e206645109c0646e72 (diff)
Merge branch 'master' into staging
Diffstat (limited to 'guix/scripts/import/pypi.scm')
-rw-r--r--guix/scripts/import/pypi.scm37
1 files changed, 19 insertions, 18 deletions
diff --git a/guix/scripts/import/pypi.scm b/guix/scripts/import/pypi.scm
index a52cd95c93..b9b12ee43a 100644
--- a/guix/scripts/import/pypi.scm
+++ b/guix/scripts/import/pypi.scm
@@ -79,27 +79,28 @@ Import and convert the PyPI package for PACKAGE-NAME.\n"))
(let* ((opts (parse-options))
(args (filter-map (match-lambda
- (('argument . value)
- value)
- (_ #f))
+ (('argument . value)
+ value)
+ (_ #f))
(reverse opts))))
(match args
((spec)
- (let ((name version (package-name->name+version spec)))
- (if (assoc-ref opts 'recursive)
- ;; Recursive import
- (map (match-lambda
- ((and ('package ('name name) . rest) pkg)
- `(define-public ,(string->symbol name)
- ,pkg))
- (_ #f))
- (pypi-recursive-import name version))
- ;; Single import
- (let ((sexp (pypi->guix-package name #:version version)))
- (unless sexp
- (leave (G_ "failed to download meta-data for package '~a'~%")
- name))
- sexp))))
+ (with-error-handling
+ (let ((name version (package-name->name+version spec)))
+ (if (assoc-ref opts 'recursive)
+ ;; Recursive import
+ (map (match-lambda
+ ((and ('package ('name name) . rest) pkg)
+ `(define-public ,(string->symbol name)
+ ,pkg))
+ (_ #f))
+ (pypi-recursive-import name version))
+ ;; Single import
+ (let ((sexp (pypi->guix-package name #:version version)))
+ (unless sexp
+ (leave (G_ "failed to download meta-data for package '~a'~%")
+ name))
+ sexp)))))
(()
(leave (G_ "too few arguments~%")))
((many ...)