From c8efb9da208b06cbcb1351f52bbcca87ab434d10 Mon Sep 17 00:00:00 2001 From: Ionen Wolkens Date: Sat, 20 May 2023 11:04:23 -0400 Subject: distutils-r1.eclass: Use config_settings with maturin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the deprecated MATURIN_PEP517_ARGS and will also allow ebuilds to enable/disable cargo --features through DISTUTILS_ARGS like the rest should the need arise. Support was technically added in 0.15.3, but 1.0.0 allows passing an array rather than only a to-be-shlex.split string. Signed-off-by: Ionen Wolkens Closes: https://github.com/gentoo/gentoo/pull/31143 Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'eclass') diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index dbc4b9ccefd0..ec1dd08b197c 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1325,6 +1325,28 @@ distutils_pep517_install() { local config_settings= case ${DISTUTILS_USE_PEP517} in + maturin) + # ebuild's DISTUTILS_ARGS are currently ignored if <1.0.0, ebuilds + # should set the dependency if used until this can be cleaned up + # (reminder to cleanup the old MATURIN_PEP517_ARGS block too) + if has_version -b '>=dev-util/maturin-1.0.0'; then + # `maturin pep517 build-wheel --help` for options + local maturin_args=( + "${DISTUTILS_ARGS[@]}" + --jobs="$(makeopts_jobs)" + --skip-auditwheel # see bug #831171 + $(in_iuse debug && usex debug '--profile=dev' '') + ) + + config_settings=$( + "${EPYTHON}" - "${maturin_args[@]}" <<-EOF || die + import json + import sys + print(json.dumps({"build-args": sys.argv[1:]})) + EOF + ) + fi + ;; meson-python) local -x NINJAOPTS=$(get_NINJAOPTS) if has_version -b '>=dev-python/meson-python-0.13'; then @@ -1500,13 +1522,13 @@ distutils-r1_python_compile() { fi ;; maturin) - # auditwheel may auto-bundle libraries (bug #831171), - # also support cargo.eclass' IUSE=debug if available - local -x MATURIN_PEP517_ARGS=" - --jobs=$(makeopts_jobs) - --skip-auditwheel - $(in_iuse debug && usex debug --profile=dev '') - " + if has_version -b '