import: pypi: Use 'with-error-handling'.
* guix/scripts/import/pypi.scm (guix-import-pypi): Wrap body in 'with-error-handling'.master
parent
2178692c93
commit
31ca569ca5
|
@ -79,27 +79,28 @@ Import and convert the PyPI package for PACKAGE-NAME.\n"))
|
||||||
|
|
||||||
(let* ((opts (parse-options))
|
(let* ((opts (parse-options))
|
||||||
(args (filter-map (match-lambda
|
(args (filter-map (match-lambda
|
||||||
(('argument . value)
|
(('argument . value)
|
||||||
value)
|
value)
|
||||||
(_ #f))
|
(_ #f))
|
||||||
(reverse opts))))
|
(reverse opts))))
|
||||||
(match args
|
(match args
|
||||||
((spec)
|
((spec)
|
||||||
(let ((name version (package-name->name+version spec)))
|
(with-error-handling
|
||||||
(if (assoc-ref opts 'recursive)
|
(let ((name version (package-name->name+version spec)))
|
||||||
;; Recursive import
|
(if (assoc-ref opts 'recursive)
|
||||||
(map (match-lambda
|
;; Recursive import
|
||||||
((and ('package ('name name) . rest) pkg)
|
(map (match-lambda
|
||||||
`(define-public ,(string->symbol name)
|
((and ('package ('name name) . rest) pkg)
|
||||||
,pkg))
|
`(define-public ,(string->symbol name)
|
||||||
(_ #f))
|
,pkg))
|
||||||
(pypi-recursive-import name version))
|
(_ #f))
|
||||||
;; Single import
|
(pypi-recursive-import name version))
|
||||||
(let ((sexp (pypi->guix-package name #:version version)))
|
;; Single import
|
||||||
(unless sexp
|
(let ((sexp (pypi->guix-package name #:version version)))
|
||||||
(leave (G_ "failed to download meta-data for package '~a'~%")
|
(unless sexp
|
||||||
name))
|
(leave (G_ "failed to download meta-data for package '~a'~%")
|
||||||
sexp))))
|
name))
|
||||||
|
sexp)))))
|
||||||
(()
|
(()
|
||||||
(leave (G_ "too few arguments~%")))
|
(leave (G_ "too few arguments~%")))
|
||||||
((many ...)
|
((many ...)
|
||||||
|
|
Reference in New Issue