summaryrefslogtreecommitdiff
path: root/gnu/packages/python-build.scm
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-10-31 00:46:40 +0100
committerAndreas Enge <andreas@enge.fr>2026-02-07 12:28:19 +0100
commit121bcd069905087e00d7452f26a6c4088e8d5bfa (patch)
treeb5494d6375f52403a59e4016ac021ca66bcba013 /gnu/packages/python-build.scm
parent93b40d330fc313e398a1aef4d73ade83d47650ad (diff)
gnu: Add python-setuptools-bootstrap.
This change is a combined commits, proposed in the following merge requests: - https://codeberg.org/guix/guix/pulls/5034 - https://codeberg.org/guix/guix/pulls/5770 As they are related to a new addition they are squashed to prevent bad git bisects. * gnu/packages/python-build.scm (python-setuptools-bootstrap): New variable. Change-Id: I7677ede70a61b9cc39ae6e021fc2f1f1afaa8d25 Modified-by: Sharlatan Hellseher <sharlatanus@gmail.com> Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu/packages/python-build.scm')
-rw-r--r--gnu/packages/python-build.scm65
1 files changed, 65 insertions, 0 deletions
diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm
index 3bddb7a3dc7..d841fd26442 100644
--- a/gnu/packages/python-build.scm
+++ b/gnu/packages/python-build.scm
@@ -41,6 +41,7 @@
(define-module (gnu packages python-build)
#:use-module (gnu packages)
#:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix build-system gnu)
#:use-module (guix build-system python)
#:use-module (guix build-system pyproject)
#:use-module (guix gexp)
@@ -376,6 +377,70 @@ facilitate packaging Python projects, where packaging includes:
license:asl2.0 ;packaging is dual ASL2/BSD-2
license:bsd-2))))
+(define-public python-setuptools-bootstrap
+ (package/inherit python-setuptools
+ (name "python-setuptools-bootstrap")
+ ;; version and source are purposefully not inherited, to allow
+ ;; updating python-setuptools in the python-team scope, whereas
+ ;; python-setuptools-bootstrap is in the core-packages-team scope.
+ (version "80.9.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "setuptools" version))
+ (sha256
+ (base32 "175iixi2h2jz8y2bpwziak360hvv43jfhipwzbdniryd5r04fszk"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; TODO: setuptools now bundles the following libraries:
+ ;; packaging, pyparsing, six and appdirs. How to unbundle?
+ ;; Remove included binaries which are used to build self-extracting
+ ;; installers for Windows.
+ '(for-each delete-file (find-files "setuptools"
+ "^(cli|gui).*\\.exe$")))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:tests? #f ;disabled to avoid extra dependencies
+ ;; Essentially a lighter copy of the former python-build-system.
+ ;; Using it rather than pyproject-build-system allows to edit the latter
+ ;; without a world rebuild (for the meson package in particular).
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'bootstrap)
+ (delete 'configure)
+ (replace 'build
+ (lambda _
+ (invoke "python" "./setup.py" "build")))
+ (replace 'install
+ (lambda _
+ (invoke "python" "./setup.py" "install"
+ (string-append "--prefix=" #$output) "--no-compile")
+ (invoke "python" "-m" "compileall"
+ "--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))
+ 'python-wrapper)))
+ (propagated-inputs (list))))
+
(define-public python-setuptools-67
(package
(inherit python-setuptools)