From 4557e8f58174e9d21bbeeafca615fb9e23618274 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Mon, 7 Jul 2025 13:11:51 +0200 Subject: [PATCH] build-system/pyproject: Export default-sanity-check.py. There is currently no convenient way to inject our sanity-check.py script in the inputs of a project that extends another build-system with pyproject components. Thus we usually don't run sanity-check for such cases (it's only python build and install). This patch improves a bit this issue by exposing our script. Since it doesn't change derivations, this doesn't lead to rebuilds and can be merged in master. * guix/build-system/pyproject.scm (sanity-check.py): Replace variable by... (default-sanity-check.py): Add exported procedure replacing and extending former sanity-check.py. (lower)[sanity-check.py]: Add and use argument. Change-Id: I422d3d2d53b59548099d381feae9b956f5e2e07a Signed-off-by: Sharlatan Hellseher --- guix/build-system/pyproject.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm index bdf8f440acc..4ad4dc79a1e 100644 --- a/guix/build-system/pyproject.scm +++ b/guix/build-system/pyproject.scm @@ -32,6 +32,7 @@ #:use-module (srfi srfi-1) #:export (%pyproject-build-system-modules default-python + default-sanity-check.py pyproject-build pyproject-build-system)) @@ -60,17 +61,20 @@ ;; Using python-toolchain here might cause dependency cycles. (module-ref python 'python-sans-pip-wrapper))) -(define sanity-check.py - (search-auxiliary-file "python/sanity-check.py")) +;; TODO: On the next iteration of python-team, migrate the sanity-check to +;; importlib_metadata instead of setuptools. +(define (default-sanity-check.py) + (local-file (search-auxiliary-file "python/sanity-check.py"))) (define* (lower name #:key source inputs native-inputs outputs system target (python (default-python)) + (sanity-check.py (default-sanity-check.py)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." (define private-keywords - '(#:target #:python #:inputs #:native-inputs)) + '(#:target #:python #:inputs #:native-inputs #:sanity-check.py)) (and (not target) ;XXX: no cross-compilation (bag @@ -84,7 +88,7 @@ ;; Keep the standard inputs of 'gnu-build-system'. ,@(standard-packages))) (build-inputs `(("python" ,python) - ("sanity-check.py" ,(local-file sanity-check.py)) + ("sanity-check.py" ,sanity-check.py) ,@native-inputs)) (outputs (append outputs '(wheel))) (build pyproject-build)