diff options
| author | Nicolas Graves <ngraves@ngraves.fr> | 2025-07-06 16:13:54 +0200 |
|---|---|---|
| committer | Sharlatan Hellseher <sharlatanus@gmail.com> | 2025-09-25 09:35:34 +0100 |
| commit | 2d45de1bc40a8c799dcc5231fd09d71145ee05fb (patch) | |
| tree | 0c31ffa2230b925a64c1cccbab6cf754ce62ec23 | |
| parent | 977caf32ef4fbb08f56e412d1394e946cd96776e (diff) | |
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>
| -rw-r--r-- | guix/build/pyproject-build-system.scm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm index 1ca91701c3d..1fadd91d68c 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. |
