From 211c0bccf8b10079e8626c8c6a7de52226a33367 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 15 Jul 2025 21:11:33 +0800 Subject: [PATCH] feat: some updates --- modules/ruther/packages/python-next.scm | 112 ++++++++++++------------ 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/modules/ruther/packages/python-next.scm b/modules/ruther/packages/python-next.scm index 9561c5189975c4d565838705a61de56898ea10c2..24a66262a59594016bfb930094638ab58802dd98 100644 --- a/modules/ruther/packages/python-next.scm +++ b/modules/ruther/packages/python-next.scm @@ -29,59 +29,45 @@ #:use-module (gnu packages python-xyz) #:export (replace-python-deps - replace-python-deps/recursively)) + replace-python-deps/recursively + with-explicit-python-3.12 + with-explicit-python-3.12-single)) -(define with-python-3.12-raw - (package-input-rewriting `((,python . ,python-3.12)))) - -(define-public python-3.12-wrapped - ((@@ (gnu packages python) wrap-python3) python-3.12)) - -(define python-3.12-wheel - (package/inherit python-wheel - (properties `(('python-3.12- . #t) - ,@(package-properties python-3.12))) - (inputs - (modify-inputs (package-inputs python-wheel) - (append (with-python-3.12-raw python-setuptools)))) - (arguments - `(#:tests? #f - #:python ,python-3.12-wrapped)))) - -(define-public python-3.12-toolchain - ((@@ (gnu packages python) wrap-python3) +(define-public python-3.12-sans-pip + (hidden-package (package/inherit python-3.12 - (name "python-next-toolchain") - (propagated-inputs - (modify-inputs (package-propagated-inputs python-3.12) - (append python-3.12-wheel) - (append (with-python-3.12-raw python-setuptools)))) - (properties `(('python-3.12- . #t) - ,@(package-properties python-3.12))) + (name "python-next") + (version "3.12") (arguments - (substitute-keyword-arguments (package-arguments python-3.12) - ((#:tests? _ #f) #f)))))) ;; Disabled tests, because this was running forever... - -(define with-python-3.12-no-cython - (package-input-rewriting `((,python . ,python-3.12-toolchain)))) - -;; Cython is dependency of a lot of packages, let's update it here -(define-public python-3.12-cython-0.29.37 - (with-python-3.12-no-cython - (package/inherit python-cython - (name "python-3.12-cython") - (version "0.29.37") - (source - (origin - (method url-fetch) - (uri (python:pypi-uri "Cython" version)) - (sha256 - (base32 "1ysca2r23h12ai9wrym4ci0nvgwm3lfijrpj9xfyxbclvnkd84zq")))) - (properties `(('python-3.12- . #t) - ,@(package-properties python-cython))) - (arguments - (substitute-keyword-arguments (package-arguments python-cython) - ((#:tests? _ #f) #f)))))) ;; Failing... I don't know why... + (substitute-keyword-arguments (package-arguments python) + ((#:tests? _ #f) #f) + ((#:phases original-phases '()) + #~(modify-phases (or #$original-phases %standard-phases) + (replace 'install-sitecustomize.py + #$(customize-site version)))) + ((#:configure-flags flags #~()) + #~(append '("--with-ensurepip=no") + (delete "--with-ensurepip=install" #$flags)))))))) + +(define (with-property pkg) + (package + (inherit pkg) + (properties `(('python-3.12- . #t) + ,@(package-properties pkg))))) + +(define-public python-3.12-setuptools + ((package-input-rewriting `((,python . ,python-3.12-sans-pip))) + (with-property python-setuptools))) + +;; python-3.12 stopped bundling setuptools, but we need it for guix packages to work. +;; Most guix packages need setuptools, but it's nowhere to be found with python 3.12 +(define-public python-3.12-sans-pip-with-setuptools + (with-property + (package + (inherit python-3.12-sans-pip) + (propagated-inputs + (modify-inputs (package-propagated-inputs python-3.12-sans-pip) + (append python-3.12-setuptools)))))) ;; This is changed a bit compared to the original function from Guix. ;; This one also works for pyproject @@ -98,6 +84,8 @@ pre-defined variants of this transformation recorded in the 'properties' field of packages. The property value must be the promise of a package. This is a convenient way for package writers to force the transformation to use pre-defined variants." + (define python-wrapped + ((@@ (gnu packages python) wrap-python3) python)) (define package-variant (if variant-property (lambda (package) @@ -128,12 +116,21 @@ pre-defined variants." (substring name (string-length old-prefix)) name)))) + (inputs + (modify-inputs (package-inputs p) + (replace "python" python))) + (propagated-inputs + (modify-inputs (package-propagated-inputs p) + (replace "python" python))) + (native-inputs + (modify-inputs (package-native-inputs p) + (replace "python" python))) (properties `((,replacement-property . #t) ,@(package-properties p))) (arguments (let ((python (if (promise? python) - (force python) - python))) + (force python-wrapped) + python-wrapped))) (ensure-keyword-arguments (package-arguments p) `(#:python ,python)))))) (else p))) @@ -205,19 +202,22 @@ pre-defined variants." ((replace-python-deps/recursively (cdr deps)) pkgs))))) (define with-explicit-python-3.12-single - (package-with-explicit-python python-3.12-toolchain "python-" "python-3.12-")) + (package-with-explicit-python python-3.12-sans-pip-with-setuptools "python-" "python-3.12-")) (define python-3.12-cython-inner (with-explicit-python-3.12-single python-cython)) +(define python-3.12-cython-0.29.35 + (with-explicit-python-3.12-single python-cython-0.29.35)) + (define with-python-3.12-single (lambda (pkg) (let ((rewritten (with-explicit-python-3.12-single pkg))) - ((package-input-rewriting `((,python-3.12-cython-inner . ,python-3.12-cython-0.29.37))) + ((package-input-rewriting `((,python-3.12-cython-inner . ,python-3.12-cython-0.29.35))) rewritten)))) -(define-public (with-python-3.12 el) +(define-public (with-explicit-python-3.12 el) (if (list? el) - (map with-python-3.12 el) + (map with-python-3.12-single el) (with-python-3.12-single el)))