commit:     c8efb9da208b06cbcb1351f52bbcca87ab434d10
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Sat May 20 15:04:23 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 23 15:42:05 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8efb9da

distutils-r1.eclass: Use config_settings with maturin

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 <ionen <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/31143
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/distutils-r1.eclass | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

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 '<dev-util/maturin-1.0.0'; then
+                               local -x MATURIN_PEP517_ARGS="
+                                       --jobs=$(makeopts_jobs)
+                                       --skip-auditwheel
+                                       $(in_iuse debug && usex debug 
--profile=dev '')
+                               "
+                       fi
                        ;;
                no)
                        return

Reply via email to