commit:     293ae46213fe0e457c9ff2ff844c39be63296886
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  8 16:21:43 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Mar  8 18:28:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=293ae462

dev-util/maturin: Build maturin executable via cargo.eclass

Split the build into building the `maturin` executable via cargo.eclass,
and the Python modules via `setuptools`, in order to avoid unnecessarily
rebuilding it multiple times.  In order to achieve this, we strip
`rust_extensions=` from `setup.py` — we can also remove the dependency
on `dev-python/setuptools-rust` while at it.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/35671
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-util/maturin/maturin-1.5.0.ebuild | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/dev-util/maturin/maturin-1.5.0.ebuild 
b/dev-util/maturin/maturin-1.5.0.ebuild
index 869513291b7e..d18df31e0dcc 100644
--- a/dev-util/maturin/maturin-1.5.0.ebuild
+++ b/dev-util/maturin/maturin-1.5.0.ebuild
@@ -418,10 +418,10 @@ CRATES_TEST="
        [email protected]
        [email protected]
 "
-DISTUTILS_EXT=1 #926507
+
 DISTUTILS_USE_PEP517=setuptools
 PYTHON_COMPAT=( pypy3 python3_{10..12} )
-inherit cargo distutils-r1 edo shell-completion toolchain-funcs
+inherit cargo distutils-r1 shell-completion toolchain-funcs
 
 DESCRIPTION="Build and publish crates with pyo3, rust-cpython and cffi 
bindings"
 HOMEPAGE="https://www.maturin.rs/";
@@ -446,7 +446,6 @@ RESTRICT="!test? ( test )"
 RDEPEND="$(python_gen_cond_dep 'dev-python/tomli[${PYTHON_USEDEP}]' 3.10)"
 DEPEND="ssl? ( dev-libs/openssl:= )"
 BDEPEND="
-       dev-python/setuptools-rust[${PYTHON_USEDEP}]
        virtual/pkgconfig
        doc? ( app-text/mdbook )
        test? (
@@ -464,6 +463,9 @@ QA_FLAGS_IGNORED="usr/bin/${PN}"
 src_prepare() {
        distutils-r1_src_prepare
 
+       # we build the Rust executable (just once) via cargo_src_compile
+       sed -i -e '/setuptools_rust/d' -e '/rust_extensions/d' setup.py || die
+
        if use test; then
                # used to prevent use of network during tests, and silence pip
                # if it finds unrelated issues with system packages (bug 
#913613)
@@ -486,18 +488,19 @@ src_prepare() {
 }
 
 src_configure() {
-       local cargoargs=(
-               $(usev debug '--profile dev')
-               --no-default-features
+       export OPENSSL_NO_VENDOR=1
+
+       local myfeatures=(
                # like release.yml + native-tls for better platform support 
than rustls
-               --features full,password-storage$(usev ssl ,native-tls)
+               full
+               password-storage
+               $(usev ssl native-tls)
        )
-
-       export MATURIN_SETUP_ARGS=${cargoargs[*]}
-       export OPENSSL_NO_VENDOR=1
+       cargo_src_configure "${cargoargs[@]}"
 }
 
 python_compile_all() {
+       cargo_src_compile
        use !doc || mdbook build -d html guide || die
 
        if ! tc-is-cross-compiler; then
@@ -523,10 +526,12 @@ python_test() {
                --skip pyo3_no_extension_module
        )
 
-       edo cargo test $(usev !debug --release) ${MATURIN_SETUP_ARGS} -- 
"${skip[@]}"
+       cargo_src_test -- "${skip[@]}"
 }
 
 python_install_all() {
+       cargo_src_install
+
        dodoc Changelog.md README.md
        use doc && dodoc -r guide/html
 

Reply via email to