guix_mirror_bot pushed a commit to branch python-team in repository guix. commit 66b9870c18ad6265f8e09136d26ad57e3900d9f0 Author: Nicolas Graves <ngra...@ngraves.fr> AuthorDate: Sun Jul 6 16:13:54 2025 +0200
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 <sharlata...@gmail.com> --- guix/build/pyproject-build-system.scm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm index 1ca91701c3..1fadd91d68 100644 --- a/guix/build/pyproject-build-system.scm +++ b/guix/build/pyproject-build-system.scm @@ -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.