~ruther/guix-local

2d45de1bc40a8c799dcc5231fd09d71145ee05fb — Nicolas Graves 8 months ago 977caf3
build-system/pyproject: Handle wheel not found exception.

The current error is very uninformative, use a proper exception to
give more information when this happens:
`In procedure map: Wrong type argument: #f`

After this patch:
`In procedure raise-exception:
ERROR:
  1. &no-wheels-found`

* guix/build/pyproject-build-system.scm (&no-wheels-found): Add exception.
(install): Handle exception.

Change-Id: Ie72d3b50dfededb2d598162672cdb4321c42b632
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
1 files changed, 11 insertions(+), 3 deletions(-)

M guix/build/pyproject-build-system.scm
M guix/build/pyproject-build-system.scm => guix/build/pyproject-build-system.scm +11 -3
@@ 87,6 87,9 @@
;; Raised, when no wheel has been built by the build system.
(define-condition-type &no-wheels-built &python-build-error no-wheels-built?)

;; Raised, when no installation candidate wheel has been found.
(define-condition-type &no-wheels-found &python-build-error no-wheels-found?)

(define* (build #:key outputs build-backend backend-path configure-flags #:allow-other-keys)
  "Build a given Python package."



@@ 251,10 254,15 @@ builder.build_wheel(sys.argv[3], config_settings=config_settings)"

    (let* ((wheel-output (assoc-ref outputs "wheel"))
           (wheel-dir (if wheel-output wheel-output "dist"))
           (wheels (map (cut string-append wheel-dir "/" <>)
                        (scandir wheel-dir
                                 (cut string-suffix? ".whl" <>)))))
           (wheels-found (or (scandir wheel-dir
                                      (cut string-suffix? ".whl" <>))
                             '()))
           (wheels (map (cut string-append wheel-dir "/" <>) wheels-found)))
      (cond
       ;; This can happen if the 'build phase has been changed or when using
       ;; the install phase using an alternative build-system.
       ((null? wheels-found)
        (raise (condition (&no-wheels-found))))
       ((> (length wheels) 1)
        ;; This code does not support multiple wheels yet, because their
        ;; outputs would have to be merged properly.