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

commit 101bdd69abb458b311fdd66f310b11fa7d219a4f
Author: Nicolas Graves <[email protected]>
AuthorDate: Tue Jan 20 09:22:02 2026 +0100

    gnu: python-setuptools-bootstrap: Install the distutils hack.
    
    * gnu/packages/python-build.scm (python-setuptools-bootstrap)
    [arguments]<#·phases>: Add phase 'fix-installation.
    
    Signed-off-by: Liliana Marie Prikler <[email protected]>
---
 gnu/packages/python-build.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm
index 737f34f577..2cdc6a5bcb 100644
--- a/gnu/packages/python-build.scm
+++ b/gnu/packages/python-build.scm
@@ -417,7 +417,24 @@ facilitate packaging Python projects, where packaging 
includes:
               (invoke "python" "./setup.py" "install"
                       (string-append "--prefix=" #$output) "--no-compile")
               (invoke "python" "-m" "compileall"
-                      "--invalidation-mode=unchecked-hash" #$output))))))
+                      "--invalidation-mode=unchecked-hash" #$output)))
+          ;; XXX: Despite using the same setup.py, it seems that the
+          ;; bootstrap version is not able to install the distutils hack.
+          (add-after 'install 'fix-installation
+            (lambda* (#:key outputs #:allow-other-keys)
+              (with-directory-excursion
+                  (car (find-files #$output "site-packages"
+                                   #:directories? #t))
+                (call-with-output-file "distutils-precedence.pth"
+                  (lambda (port)
+                    (display
+                     (string-join
+                      '("import os"
+                        "var = 'SETUPTOOLS_USE_DISTUTILS'"
+                        "enabled = os.environ.get(var, 'local') == 'local'"
+                        "enabled and 
__import__('_distutils_hack').add_shim();")
+                      "; ")
+                     port)))))))))
     (native-inputs (list))
     ;; Avoid introducing an additional module-dependency.
     (inputs (list (module-ref (resolve-interface '(gnu packages python))

Reply via email to