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: Sat, 26 Nov 2022 21:12:36
Message-Id: 1669497145.14d96ed19073458a6b4893c072fc342ea765b002.mgorny@gentoo
1 commit: 14d96ed19073458a6b4893c072fc342ea765b002
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 21 16:06:13 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 26 21:12:25 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14d96ed1
7
8 distutils-r1.eclass: Pass options to meson-python backend
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 eclass/distutils-r1.eclass | 50 ++++++++++++++++++++++++++++++++++++----------
13 1 file changed, 39 insertions(+), 11 deletions(-)
14
15 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
16 index 4cc117dfbd54..3ac06a458483 100644
17 --- a/eclass/distutils-r1.eclass
18 +++ b/eclass/distutils-r1.eclass
19 @@ -178,7 +178,7 @@ esac
20 if [[ ! ${_DISTUTILS_R1} ]]; then
21
22 [[ ${EAPI} == 6 ]] && inherit eutils xdg-utils
23 -inherit multibuild multiprocessing toolchain-funcs
24 +inherit multibuild multiprocessing ninja-utils toolchain-funcs
25
26 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
27 inherit python-r1
28 @@ -1319,9 +1319,34 @@ distutils_pep517_install() {
29 fi
30
31 local config_settings=
32 - if [[ -n ${DISTUTILS_ARGS[@]} ]]; then
33 - case ${DISTUTILS_USE_PEP517} in
34 - setuptools)
35 + case ${DISTUTILS_USE_PEP517} in
36 + meson-python)
37 + # TODO: remove the condition once we BDEP on >=0.11
38 + if has_version -b ">=dev-python/meson-python-0.11"; then
39 + local -x NINJAOPTS=$(get_NINJAOPTS)
40 + config_settings=$(
41 + "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
42 + import json
43 + import os
44 + import shlex
45 + import sys
46 +
47 + ninjaopts = shlex.split(os.environ["NINJAOPTS"])
48 + print(json.dumps({
49 + "setup-args": sys.argv[1:],
50 + "compile-args": [
51 + "-v",
52 + f"--ninja-args={ninjaopts!r}",
53 + ],
54 + }))
55 + EOF
56 + )
57 + elif [[ -n ${DISTUTILS_ARGS[@]} ]]; then
58 + die "DISTUTILS_ARGS requires >=dev-python/meson-python-0.11 (missing BDEP?)"
59 + fi
60 + ;;
61 + setuptools)
62 + if [[ -n ${DISTUTILS_ARGS[@]} ]]; then
63 config_settings=$(
64 "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
65 import json
66 @@ -1329,8 +1354,10 @@ distutils_pep517_install() {
67 print(json.dumps({"--global-option": sys.argv[1:]}))
68 EOF
69 )
70 - ;;
71 - sip)
72 + fi
73 + ;;
74 + sip)
75 + if [[ -n ${DISTUTILS_ARGS[@]} ]]; then
76 # NB: for practical reasons, we support only --foo=bar,
77 # not --foo bar
78 local arg
79 @@ -1353,12 +1380,13 @@ distutils_pep517_install() {
80 print(json.dumps(args))
81 EOF
82 )
83 - ;;
84 - *)
85 + fi
86 + ;;
87 + *)
88 + [[ -n ${DISTUTILS_ARGS[@]} ]] &&
89 die "DISTUTILS_ARGS are not supported by ${DISTUTILS_USE_PEP517}"
90 - ;;
91 - esac
92 - fi
93 + ;;
94 + esac
95
96 local build_backend=$(_distutils-r1_get_backend)
97 einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}"