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 02/30] distutils-r1.eclass: Get wheel name from the backend
Date: Sun, 06 Feb 2022 12:49:48
Message-Id: 20220206124841.1299133-3-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/30] One batch of Python eclass updates to rule them all by "Michał Górny"
1 Use the wheel name returned by build_wheel() rather than trying to guess
2 it from WHEEL_DIR.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 eclass/distutils-r1.eclass | 14 +++++---------
7 1 file changed, 5 insertions(+), 9 deletions(-)
8
9 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
10 index 81eea83c67b3..22070f6b74f4 100644
11 --- a/eclass/distutils-r1.eclass
12 +++ b/eclass/distutils-r1.eclass
13 @@ -1032,22 +1032,18 @@ distutils-r1_python_compile() {
14
15 local build_backend=$(_distutils-r1_get_backend)
16 einfo " Building the wheel via ${build_backend}"
17 - "${EPYTHON}" -c "import ${build_backend%:*}; \
18 + local wheel=$("${EPYTHON}" -c "import ${build_backend%:*}; \
19 import os; \
20 - ${build_backend/:/.}.build_wheel(os.environ['WHEEL_BUILD_DIR'])" ||
21 - die "Wheel build failed"
22 -
23 - local wheel=( "${WHEEL_BUILD_DIR}"/*.whl )
24 - if [[ ${#wheel[@]} -ne 1 ]]; then
25 - die "Incorrect number of wheels created (${#wheel[@]}): ${wheel[*]}"
26 - fi
27 + print(${build_backend/:/.}.build_wheel(os.environ['WHEEL_BUILD_DIR']))" ||
28 + die "Wheel build failed")
29 + [[ -n ${wheel} ]] || die "No wheel name returned"
30
31 local root=${BUILD_DIR}/install
32 einfo " Installing the wheel to ${root}"
33 # NB: --compile-bytecode does not produce the correct paths,
34 # and python_optimize doesn't handle being called outside D,
35 # so we just defer compiling until the final merge
36 - "${EPYTHON}" -m installer -d "${root}" "${wheel}" \
37 + "${EPYTHON}" -m installer -d "${root}" "${WHEEL_BUILD_DIR}/${wheel}" \
38 --no-compile-bytecode ||
39 die "installer failed"
40
41 --
42 2.35.1