import: pypi: Return multiple values for unknown packages.

Partly fixes <https://bugs.gnu.org/44115>.

* guix/import/pypi.scm (pypi->guix-package): Return two values when
PROJECT is false.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
zimoun 2021-01-19 16:47:17 +01:00 committed by Ludovic Courtès
parent ebb03447f8
commit 434925379d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -12,6 +12,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz> ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Marius Bakke <marius@gnu.org> ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu> ;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -496,7 +497,7 @@ (define pypi->guix-package
(let* ((project (pypi-fetch package-name)) (let* ((project (pypi-fetch package-name))
(info (and=> project pypi-project-info)) (info (and=> project pypi-project-info))
(version (or version (and=> project latest-version)))) (version (or version (and=> project latest-version))))
(and project (if project
(guard (c ((missing-source-error? c) (guard (c ((missing-source-error? c)
(let ((package (missing-source-error-package c))) (let ((package (missing-source-error-package c)))
(raise (raise
@ -525,7 +526,8 @@ (define pypi->guix-package
(project-info-summary info) (project-info-summary info)
(project-info-summary info) (project-info-summary info)
(string->license (string->license
(project-info-license info))))))))) (project-info-license info))))
(values #f '()))))))
(define* (pypi-recursive-import package-name #:optional version) (define* (pypi-recursive-import package-name #:optional version)
(recursive-import package-name (recursive-import package-name