1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: python-cython-0: Fix build for python@3.12.

* gnu/packages/python-xyz.scm
(importlib-util-load-dynamic): Add helper string.
(python-cython-0)[arguments]<#:phases>: Add phase
'fix-pyximport-python-3.12.

Merges: https://codeberg.org/guix/guix/pulls/6222
Change-Id: I403e72cfdc82210bdfcbcb21e77cef89e8c68398
Reviewed-by: Hugo Buddelmeijer <hugo@buddelmeijer.nl>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Nicolas Graves
2026-02-07 23:01:52 +01:00
committed by Sharlatan Hellseher
parent 87aa281e3c
commit fdb102dc7b

View File

@@ -11090,6 +11090,9 @@ writing C extensions for Python as easy as Python itself.")
(base32 "1ysca2r23h12ai9wrym4ci0nvgwm3lfijrpj9xfyxbclvnkd84zq"))))
(arguments
(list
;; XXX: Tests are broken with python@3.12, but dependent packages
;; build, so keep it until unnecessary.
#:tests? #f
#:test-backend #~'custom
#:test-flags
#~(list "runtests.py"
@@ -11110,6 +11113,24 @@ writing C extensions for Python as easy as Python itself.")
"-x" "cpp_stl_conversion")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-pyximport-python-3.12
(lambda _
(let ((importlib-util-load-dynamic "\
import importlib.util
from importlib.machinery import ExtensionFileLoader
def load_dynamic(name, path):
loader = ExtensionFileLoader(name, path)
spec = importlib.util.spec_from_file_location(name, loader=loader)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
"))
(substitute* "pyximport/pyximport.py"
(("^import imp")
importlib-util-load-dynamic)
(("imp\\.load_dynamic")
"load_dynamic")))))
(add-before 'check 'pre-check
;; some tests require access to "$HOME/.cython"
(lambda _