gnu: python-blake3: Fix build.

* gnu/packages/python-crypto.scm (python-blake3)[arguments]
<imported-modules>: Add pyproject-build-system-modules
<modules>: Likewise.
<phases>: Simplify 'build-python-module, and 'install-python-module.
Remove 'install-python-library.
[native-inputs]: Remove python-pypa-build and python-wheel; add maturin.

Change-Id: Ib45da9873b40697ba2166bb31f11da16f4872223
This commit is contained in:
Sharlatan Hellseher 2025-09-16 10:10:33 +01:00
parent b2c83ebbd8
commit c42226ab2c
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -340,59 +340,21 @@ production use. Include this module and use its backends at your own risk.")
(arguments (arguments
(list (list
#:install-source? #f #:install-source? #f
#:imported-modules `(,@%pyproject-build-system-modules
,@%cargo-build-system-modules)
#:modules `((guix build cargo-build-system)
((guix build pyproject-build-system) #:prefix py:)
(guix build utils))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'install 'build-python-module (add-after 'build 'build-python-module
(lambda _ (assoc-ref py:%standard-phases 'build))
;; We don't use maturin.
(delete-file "pyproject.toml")
(call-with-output-file "pyproject.toml"
(lambda (port)
(format port "\
[build-system]
build-backend = 'setuptools.build_meta'
requires = ['setuptools']
")))
(call-with-output-file "setup.cfg"
(lambda (port)
(format port "\
[metadata]
name = blake3
version = ~a
[options]
packages = find:
[options.packages.find]
exclude =
src*
c_impl*
tests*
Cargo.toml
" #$version)))
;; ZIP does not support timestamps before 1980.
(setenv "SOURCE_DATE_EPOCH" "315532800")
(invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
(add-after 'build-python-module 'install-python-module (add-after 'build-python-module 'install-python-module
(lambda* (#:key outputs #:allow-other-keys) (assoc-ref py:%standard-phases 'install)))))
(let ((whl (car (find-files "dist" "\\.whl$"))))
(invoke "pip" "--no-cache-dir" "--no-input"
"install" "--no-deps" "--prefix" #$output whl))))
(add-after 'install-python-module 'install-python-library
(lambda _
(let ((site (string-append #$output "/lib/python"
#$(version-major+minor
(package-version python))
"/site-packages")))
(mkdir-p site)
(copy-file "target/release/libblake3.so"
(string-append site "/blake3.so"))))))))
(inputs (cargo-inputs 'python-blake3))
(native-inputs (native-inputs
(list python-wrapper (list python-wrapper
python-pypa-build maturin))
python-wheel)) (inputs (cargo-inputs 'python-blake3))
(home-page "https://github.com/oconnor663/blake3-py") (home-page "https://github.com/oconnor663/blake3-py")
(synopsis "Python bindings for the Rust blake3 crate") (synopsis "Python bindings for the Rust blake3 crate")
(description "This package provides Python bindings for the Rust crate of (description "This package provides Python bindings for the Rust crate of