guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/13: import: pypi: Return multiple values for unknown packages.


From: guix-commits
Subject: 07/13: import: pypi: Return multiple values for unknown packages.
Date: Mon, 7 Mar 2022 16:50:54 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 434925379d1bf18a4d70b146a2fd1837b9c7b46e
Author: zimoun <zimon.toutoune@gmail.com>
AuthorDate: Tue Jan 19 16:47:17 2021 +0100

    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>
---
 guix/import/pypi.scm | 56 +++++++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index edfca3454b..77b5f12f72 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
+;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -496,36 +497,37 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, 
and LICENSE."
      (let* ((project (pypi-fetch package-name))
             (info    (and=> project pypi-project-info))
             (version (or version (and=> project latest-version))))
-       (and project
-            (guard (c ((missing-source-error? c)
-                       (let ((package (missing-source-error-package c)))
-                         (raise
-                          (apply
-                           make-compound-condition
-                           (formatted-message
-                            (G_ "no source release for pypi package ~a ~a~%")
-                            (project-info-name info) version)
-                           (match (project-info-home-page info)
-                             ((or #f "") '())
-                             (url
-                              (list
-                               (condition
-                                (&fix-hint
-                                 (hint (format #f (G_ "This indicates that the
+       (if project
+           (guard (c ((missing-source-error? c)
+                      (let ((package (missing-source-error-package c)))
+                        (raise
+                         (apply
+                          make-compound-condition
+                          (formatted-message
+                           (G_ "no source release for pypi package ~a ~a~%")
+                           (project-info-name info) version)
+                          (match (project-info-home-page info)
+                            ((or #f "") '())
+                            (url
+                             (list
+                              (condition
+                               (&fix-hint
+                                (hint (format #f (G_ "This indicates that the
 package is available on PyPI, but only as a \"wheel\" containing binaries, not
 source.  To build it from source, refer to the upstream repository at
 @uref{~a}.")
-                                               url))))))))))))
-              (make-pypi-sexp (project-info-name info) version
-                              (and=> (source-release project version)
-                                     distribution-url)
-                              (and=> (wheel-release project version)
-                                     distribution-url)
-                              (project-info-home-page info)
-                              (project-info-summary info)
-                              (project-info-summary info)
-                              (string->license
-                               (project-info-license info)))))))))
+                                              url))))))))))))
+             (make-pypi-sexp (project-info-name info) version
+                             (and=> (source-release project version)
+                                    distribution-url)
+                             (and=> (wheel-release project version)
+                                    distribution-url)
+                             (project-info-home-page info)
+                             (project-info-summary info)
+                             (project-info-summary info)
+                             (string->license
+                              (project-info-license info))))
+           (values #f '()))))))
 
 (define* (pypi-recursive-import package-name #:optional version)
   (recursive-import package-name



reply via email to

[Prev in Thread] Current Thread [Next in Thread]