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 5/6] distutils-r1.eclass: Add DISTUTILS_DEPS output var for PEP 517 mode
Date: Mon, 31 Jan 2022 23:01:07
Message-Id: 20220131225920.192125-6-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/6] Another batch of distutils-r1.eclass fixes by "Michał Górny"
1 The PEP 517 build-time deps have gotten more complex, and largely depend
2 on the internal eclass logic used to build and install wheels.
3 Introduce a DISTUTILS_DEPS output variable that contains the correct
4 BDEPEND string for use in DISTUTILS_OPTIONAL=1 ebuilds.
5
6 Signed-off-by: Michał Górny <mgorny@g.o>
7 ---
8 eclass/distutils-r1.eclass | 34 +++++++++++++++++++++++++++++++++-
9 1 file changed, 33 insertions(+), 1 deletion(-)
10
11 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
12 index 4a9fdb4018b4..a0ad598eb58f 100644
13 --- a/eclass/distutils-r1.eclass
14 +++ b/eclass/distutils-r1.eclass
15 @@ -128,6 +128,24 @@ esac
16 # It is available only in non-PEP517 mode. It needs to be set before
17 # the inherit line.
18
19 +# @ECLASS-VARIABLE: DISTUTILS_DEPS
20 +# @OUTPUT_VARIABLE
21 +# @DESCRIPTION:
22 +# This is an eclass-generated build-time dependency string for the build
23 +# system packages. This string is automatically appended to BDEPEND
24 +# unless DISTUTILS_OPTIONAL is used. This variable is available only
25 +# in PEP 517 mode.
26 +#
27 +# Example use:
28 +# @CODE
29 +# DISTUTILS_OPTIONAL=1
30 +# # ...
31 +# RDEPEND="${PYTHON_DEPS}"
32 +# BDEPEND="
33 +# ${PYTHON_DEPS}
34 +# ${DISTUTILS_DEPS}"
35 +# @CODE
36 +
37 if [[ ! ${_DISTUTILS_R1} ]]; then
38
39 [[ ${EAPI} == 6 ]] && inherit eutils xdg-utils
40 @@ -156,7 +174,7 @@ _distutils_set_globals() {
41
42 # installer is used to install the wheel
43 # tomli is used to read build-backend from pyproject.toml
44 - bdep+='
45 + bdep='
46 >=dev-python/installer-0.4.0_p20220124[${PYTHON_USEDEP}]
47 dev-python/tomli[${PYTHON_USEDEP}]'
48 case ${DISTUTILS_USE_PEP517} in
49 @@ -213,6 +231,20 @@ _distutils_set_globals() {
50 [[ -n ${rdep} ]] && rdep="$(python_gen_cond_dep "${rdep}")"
51 fi
52
53 + if [[ ${DISTUTILS_USE_PEP517} ]]; then
54 + if [[ ${DISTUTILS_DEPS+1} ]]; then
55 + if [[ ${DISTUTILS_DEPS} != "${bdep}" ]]; then
56 + eerror "DISTUTILS_DEPS have changed between inherits!"
57 + eerror "Before: ${DISTUTILS_DEPS}"
58 + eerror "Now : ${bdep}"
59 + die "DISTUTILS_DEPS integrity check failed"
60 + fi
61 + else
62 + DISTUTILS_DEPS=${bdep}
63 + readonly DISTUTILS_DEPS
64 + fi
65 + fi
66 +
67 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
68 RDEPEND="${PYTHON_DEPS} ${rdep}"
69 if [[ ${EAPI} != 6 ]]; then
70 --
71 2.35.1

Replies