Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 09 May 2022 20:33:44
Message-Id: 1652128311.9fb77f35a048dfcea2cc44486382c9de765befc7.mgorny@gentoo
1 commit: 9fb77f35a048dfcea2cc44486382c9de765befc7
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 8 11:30:59 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon May 9 20:31:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9fb77f35
7
8 distutils-r1.eclass: Support DISTUTILS_ARGS in PEP517 mode
9
10 Use gpep517 --config-json support to pass DISTUTILS_ARGS in PEP517 mode.
11
12 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
13
14 eclass/distutils-r1.eclass | 32 +++++++++++++++++++++++++++-----
15 1 file changed, 27 insertions(+), 5 deletions(-)
16
17 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
18 index 1573d803f3f6..e9a28056e9cc 100644
19 --- a/eclass/distutils-r1.eclass
20 +++ b/eclass/distutils-r1.eclass
21 @@ -1091,12 +1091,38 @@ distutils_pep517_install() {
22 local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel
23 mkdir -p "${WHEEL_BUILD_DIR}" || die
24
25 + if [[ -n ${mydistutilsargs[@]} ]]; then
26 + die "mydistutilsargs are banned in PEP517 mode (use DISTUTILS_ARGS)"
27 + fi
28 +
29 + local config_settings=
30 + if [[ -n ${DISTUTILS_ARGS[@]} ]]; then
31 + case ${DISTUTILS_USE_PEP517} in
32 + setuptools)
33 + config_settings=$(
34 + "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
35 + import json
36 + import sys
37 + print(json.dumps({"--global-option": sys.argv[1:]}))
38 + EOF
39 + )
40 + ;;
41 + *)
42 + die "DISTUTILS_ARGS are not supported by ${DISTUTILS_USE_PEP517}"
43 + ;;
44 + esac
45 + fi
46 +
47 local build_backend=$(_distutils-r1_get_backend)
48 einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}"
49 + local config_args=()
50 + [[ -n ${config_settings} ]] &&
51 + config_args+=( --config-json "${config_settings}" )
52 local wheel=$(
53 gpep517 build-wheel --backend "${build_backend}" \
54 --output-fd 3 \
55 - --wheel-dir "${WHEEL_BUILD_DIR}" 3>&1 >&2 ||
56 + --wheel-dir "${WHEEL_BUILD_DIR}" \
57 + "${config_args[@]}" 3>&1 >&2 ||
58 die "Wheel build failed"
59 )
60 [[ -n ${wheel} ]] || die "No wheel name returned"
61 @@ -1181,10 +1207,6 @@ distutils-r1_python_compile() {
62 esac
63
64 if [[ ${DISTUTILS_USE_PEP517} ]]; then
65 - if [[ -n ${DISTUTILS_ARGS[@]} || -n ${mydistutilsargs[@]} ]]; then
66 - die "DISTUTILS_ARGS are not supported in PEP-517 mode"
67 - fi
68 -
69 # python likes to compile any module it sees, which triggers sandbox
70 # failures if some packages haven't compiled their modules yet.
71 addpredict "${EPREFIX}/usr/lib/${EPYTHON}"