guix_mirror_bot pushed a commit to branch python-team
in repository guix.

commit 84ceb52d73aead76aad790ef2daf1b7029d3b0bd
Author: Nicolas Graves <[email protected]>
AuthorDate: Thu Jul 30 19:56:32 2026 +0200

    gnu: python-pytest-guix: Move to (gnu packages python-build).
    
    * guix/build-system/pyproject.scm (default-python-pytest-guix): Move
    from here ...
    * gnu/packages/python-build.scm (python-pytest-guix): ... to here.
    Convert from a procedure to a variable (as expected from a package).
    
    Merges: guix/guix!10311
    Reviewed-by: Hugo Buddelmeijer <[email protected]>
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/python-build.scm   | 38 ++++++++++++++++++++++++++++++++++++++
 guix/build-system/pyproject.scm | 37 +++++--------------------------------
 2 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm
index 0acea406d99..02bf4d6ffaf 100644
--- a/gnu/packages/python-build.scm
+++ b/gnu/packages/python-build.scm
@@ -52,6 +52,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system pyproject)
+  #:use-module (guix build-system trivial)
   #:use-module (guix gexp)
   #:use-module (guix deprecation)
   #:use-module (guix download)
@@ -461,6 +462,43 @@ and functions, detailed info on failing assert statements, 
modular fixtures,
 and many external plugins.")
     (license license:expat)))
 
+(define-public python-pytest-guix
+  (package
+    (name "python-pytest-guix")
+    (version "0.0.1")
+    (source (local-file (search-auxiliary-file "python/pytest_guix.py")))
+    (build-system trivial-build-system)
+    (arguments
+     (list
+      #:modules '((guix build utils))
+      #:builder
+      #~(begin
+          (use-modules (guix build utils))
+          (let* ((python-base #$(this-package-native-input "python"))
+                 (python-site (find-files python-base
+                                          "site-packages$"
+                                          #:directories? #t))
+                 (python-site (string-drop (car python-site)
+                                           (string-length python-base)))
+                 (site (string-append #$output python-site))
+                 (dist (string-append site "/pytest_guix-" #$version
+                                      ".dist.info")))
+            (mkdir-p dist)
+            (copy-file #$source (string-append site "/pytest_guix.py"))
+            (call-with-output-file (string-append dist "/entry_points.txt")
+              (lambda (port)
+                (format port "[pytest11]~%guix=pytest_guix~%")))))))
+    (native-inputs (list (module-ref (resolve-interface '(gnu packages python))
+                                     'python)))
+    (home-page "https://guix.gnu.org/";)
+    (synopsis "Ignore selected pytest options")
+    ;; Maybe try to upstream it at some point, it's currently flavored for guix
+    ;; but the idea itself is more general.
+    (description
+     "This package provides the script to cleanly ignore pytest options at the
+build-system level.")
+    (license license:gpl3+)))
+
 (define-public python-pytoml
   (package
     (name "python-pytoml")
diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm
index b7a3a1c0c99..fcf825311f2 100644
--- a/guix/build-system/pyproject.scm
+++ b/guix/build-system/pyproject.scm
@@ -70,41 +70,14 @@ extension, such as '.tar.gz'."
   ;; out setuptools if a different version is required.
   (@* (gnu packages python) python-sans-pip-wrapper))
 
+(define (default-python-pytest-guix)
+  "Return the default python-pytest-guix package, resolved lazily."
+  (@* (gnu packages python-build) python-pytest-guix))
+
 (define (pyproject-guile-json)
   "Return the default guile-json package, resolved lazily."
   (@* (gnu packages guile) guile-json-4))
 
-;; Maybe try to upstream it at some point, it's currently flavored for guix
-;; but the idea itself is more general.
-(define (default-pytest-guix-plugin python)
-  (let* ((effective (version-major+minor (package-version python)))
-         (site (string-append "lib/python" effective "/site-packages/")))
-    (package
-      (name "python-pytest-guix")
-      (version "0.0.1")
-      (source (local-file (search-auxiliary-file "python/pytest_guix.py")))
-      (build-system trivial-build-system)
-      (arguments
-       (list
-        #:modules '((guix build utils))
-        #:builder
-        #~(begin
-            (use-modules (guix build utils))
-            (let* ((site (string-append #$output "/" #$site))
-                   (dist (string-append site "pytest_guix-" #$version
-                                        ".dist.info")))
-              (mkdir-p dist)
-              (copy-file #$source (string-append site "/pytest_guix.py"))
-              (call-with-output-file (string-append dist "/entry_points.txt")
-                (lambda (port)
-                  (format port "[pytest11]~%guix=pytest_guix~%")))))))
-      (home-page "https://guix.gnu.org/";)
-      (synopsis "Ignore selected pytest options")
-      (description
-       "This package provides the script to cleanly ignore pytest options at 
the
-build-system level.")
-      (license license:gpl3+))))
-
 (define %default-pytest-guix-options
   ;; Guile keyword arguments are translated to Python keyword arguments
   ;; and passed to `group.addoption'. pytest_guix assumes default options
@@ -150,7 +123,7 @@ build-system level.")
                 #:key source inputs native-inputs outputs system target
                 test-backend
                 (python (default-python))
-                (python-pytest-guix (default-pytest-guix-plugin python))
+                (python-pytest-guix (default-python-pytest-guix))
                 (sanity-check.py (default-sanity-check.py))
                 #:allow-other-keys
                 #:rest arguments)

Reply via email to