Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 23/28] distutils-r1.eclass: Replace mydistutilsargs with DISTUTILS_ARGS
Date: Sun, 20 Jun 2021 10:03:35
Message-Id: 20210620095552.625633-24-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/28] python-r1 suite EAPI 8 support/cleanup by "Michał Górny"
1 Add a new correctly-cased DISTUTILS_ARGS variable that replaces
2 mydistutilsargs. Ban the latter in EAPI 8.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 eclass/distutils-r1.eclass | 23 ++++++++++++++++-------
7 1 file changed, 16 insertions(+), 7 deletions(-)
8
9 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
10 index 217f457d6bf3..d7a476f48586 100644
11 --- a/eclass/distutils-r1.eclass
12 +++ b/eclass/distutils-r1.eclass
13 @@ -248,15 +248,16 @@ unset -f _distutils_set_globals
14 # }
15 # @CODE
16
17 -# @ECLASS-VARIABLE: mydistutilsargs
18 +# @ECLASS-VARIABLE: DISTUTILS_ARGS
19 # @DEFAULT_UNSET
20 # @DESCRIPTION:
21 -# An array containing options to be passed to setup.py.
22 +# An array containing options to be passed to setup.py. They are passed
23 +# before the default arguments, i.e. before the first command.
24 #
25 # Example:
26 # @CODE
27 # python_configure_all() {
28 -# mydistutilsargs=( --enable-my-hidden-option )
29 +# DISTUTILS_ARGS=( --enable-my-hidden-option )
30 # }
31 # @CODE
32
33 @@ -446,8 +447,9 @@ distutils_enable_tests() {
34 # (if ${EPYTHON} is set; fallback 'python' otherwise).
35 #
36 # setup.py will be passed the following, in order:
37 -# 1. ${mydistutilsargs[@]}
38 -# 2. additional arguments passed to the esetup.py function.
39 +# 1. ${DISTUTILS_ARGS[@]}
40 +# 2. ${mydistutilsargs[@]} (deprecated)
41 +# 3. additional arguments passed to the esetup.py function.
42 #
43 # Please note that setup.py will respect defaults (unless overridden
44 # via command-line options) from setup.cfg that is created
45 @@ -467,7 +469,12 @@ esetup.py() {
46 setup_py=( -m pyproject2setuppy.main )
47 fi
48
49 - set -- "${EPYTHON}" "${setup_py[@]}" "${mydistutilsargs[@]}" "${@}"
50 + if [[ ${EAPI} != [67] && ${mydistutilsargs[@]} ]]; then
51 + die "mydistutilsargs is banned in EAPI ${EAPI} (use DISTUTILS_ARGS)"
52 + fi
53 +
54 + set -- "${EPYTHON}" "${setup_py[@]}" "${DISTUTILS_ARGS[@]}" \
55 + "${mydistutilsargs[@]}" "${@}"
56
57 echo "${@}" >&2
58 "${@}" || die -n
59 @@ -839,13 +846,15 @@ distutils-r1_python_install() {
60 local root=${D%/}/_${EPYTHON}
61 [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D%/}
62
63 - # inline mydistutilsargs logic from esetup.py in order to make
64 + # inline DISTUTILS_ARGS logic from esetup.py in order to make
65 # argv overwriting easier
66 local args=(
67 + "${DISTUTILS_ARGS[@]}"
68 "${mydistutilsargs[@]}"
69 install --skip-build --root="${root}" "${args[@]}"
70 "${@}"
71 )
72 + local DISTUTILS_ARGS=()
73 local mydistutilsargs=()
74
75 # enable compilation for the install phase.
76 --
77 2.32.0