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 @@
41(define-module (gnu packages python-build) 41(define-module (gnu packages python-build)
42 #:use-module (gnu packages) 42 #:use-module (gnu packages)
43 #:use-module ((guix licenses) #:prefix license:) 43 #:use-module ((guix licenses) #:prefix license:)
44 #:use-module (guix build-system gnu)
44 #:use-module (guix build-system python) 45 #:use-module (guix build-system python)
45 #:use-module (guix build-system pyproject) 46 #:use-module (guix build-system pyproject)
46 #:use-module (guix gexp) 47 #:use-module (guix gexp)
@@ -376,6 +377,70 @@ facilitate packaging Python projects, where packaging includes:
376 license:asl2.0 ;packaging is dual ASL2/BSD-2 377 license:asl2.0 ;packaging is dual ASL2/BSD-2
377 license:bsd-2)))) 378 license:bsd-2))))
378 379
380(define-public python-setuptools-bootstrap
381 (package/inherit python-setuptools
382 (name "python-setuptools-bootstrap")
383 ;; version and source are purposefully not inherited, to allow
384 ;; updating python-setuptools in the python-team scope, whereas
385 ;; python-setuptools-bootstrap is in the core-packages-team scope.
386 (version "80.9.0")
387 (source
388 (origin
389 (method url-fetch)
390 (uri (pypi-uri "setuptools" version))
391 (sha256
392 (base32 "175iixi2h2jz8y2bpwziak360hvv43jfhipwzbdniryd5r04fszk"))
393 (modules '((guix build utils)))
394 (snippet
395 ;; TODO: setuptools now bundles the following libraries:
396 ;; packaging, pyparsing, six and appdirs. How to unbundle?
397 ;; Remove included binaries which are used to build self-extracting
398 ;; installers for Windows.
399 '(for-each delete-file (find-files "setuptools"
400 "^(cli|gui).*\\.exe$")))))
401 (build-system gnu-build-system)
402 (arguments
403 (list
404 #:tests? #f ;disabled to avoid extra dependencies
405 ;; Essentially a lighter copy of the former python-build-system.
406 ;; Using it rather than pyproject-build-system allows to edit the latter
407 ;; without a world rebuild (for the meson package in particular).
408 #:phases
409 #~(modify-phases %standard-phases
410 (delete 'bootstrap)
411 (delete 'configure)
412 (replace 'build
413 (lambda _
414 (invoke "python" "./setup.py" "build")))
415 (replace 'install
416 (lambda _
417 (invoke "python" "./setup.py" "install"
418 (string-append "--prefix=" #$output) "--no-compile")
419 (invoke "python" "-m" "compileall"
420 "--invalidation-mode=unchecked-hash" #$output)))
421 ;; XXX: Despite using the same setup.py, it seems that the
422 ;; bootstrap version is not able to install the distutils hack.
423 (add-after 'install 'fix-installation
424 (lambda* (#:key outputs #:allow-other-keys)
425 (with-directory-excursion
426 (car (find-files #$output "site-packages"
427 #:directories? #t))
428 (call-with-output-file "distutils-precedence.pth"
429 (lambda (port)
430 (display
431 (string-join
432 '("import os"
433 "var = 'SETUPTOOLS_USE_DISTUTILS'"
434 "enabled = os.environ.get(var, 'local') == 'local'"
435 "enabled and __import__('_distutils_hack').add_shim();")
436 "; ")
437 port)))))))))
438 (native-inputs (list))
439 ;; Avoid introducing an additional module-dependency.
440 (inputs (list (module-ref (resolve-interface '(gnu packages python))
441 'python-wrapper)))
442 (propagated-inputs (list))))
443
379(define-public python-setuptools-67 444(define-public python-setuptools-67
380 (package 445 (package
381 (inherit python-setuptools) 446 (inherit python-setuptools)