From 293ae46213fe0e457c9ff2ff844c39be63296886 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 8 Mar 2024 17:21:43 +0100 Subject: dev-util/maturin: Build maturin executable via cargo.eclass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Closes: https://github.com/gentoo/gentoo/pull/35671 Signed-off-by: Michał Górny --- dev-util/maturin/maturin-1.5.0.ebuild | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'dev-util') 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=" windows_x86_64_msvc@0.36.1 windows_x86_64_msvc@0.48.0 " -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 -- cgit v1.2.3-65-gdbad