[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/14: import: pypi: Use 'with-error-handling'.
From: |
guix-commits |
Subject: |
03/14: import: pypi: Use 'with-error-handling'. |
Date: |
Wed, 2 Feb 2022 12:43:36 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 31ca569ca511b94786c8a8019a8d6fbaeac005f1
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Feb 2 15:53:55 2022 +0100
import: pypi: Use 'with-error-handling'.
* guix/scripts/import/pypi.scm (guix-import-pypi): Wrap body in
'with-error-handling'.
---
guix/scripts/import/pypi.scm | 37 +++++++++++++++++++------------------
1 file 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 ...)
- branch master updated (4943ac86e4 -> 9408a4edcb), guix-commits, 2022/02/02
- 05/14: gnu: luminance-hdr: Fix compilation., guix-commits, 2022/02/02
- 07/14: gnu: Add python-types-dataclasses., guix-commits, 2022/02/02
- 10/14: gnu: oil: Update to 0.9.7., guix-commits, 2022/02/02
- 08/14: gnu: openttd: Update to 12.1., guix-commits, 2022/02/02
- 11/14: gnu: rr: Update to 5.5.0., guix-commits, 2022/02/02
- 02/14: gnu: perf: Remove input labels., guix-commits, 2022/02/02
- 04/14: import: pypi: Display a hint upon "no source release" errors., guix-commits, 2022/02/02
- 06/14: gnu: luminance-hdr: Remove input labels., guix-commits, 2022/02/02
- 01/14: gnu: perf: Help 'perf report --symfs' find separate debug info files., guix-commits, 2022/02/02
- 03/14: import: pypi: Use 'with-error-handling'.,
guix-commits <=
- 12/14: gnu: cgdb: Update to 0.8.0., guix-commits, 2022/02/02
- 13/14: deploy: Add '--execute'., guix-commits, 2022/02/02
- 09/14: guix system: 'describe' shows the running system, not the current one., guix-commits, 2022/02/02
- 14/14: news: Add entry about 'guix deploy -x'., guix-commits, 2022/02/02