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 06/11] distutils-r1.eclass: Let gpep517 compile bytecode when 9+ is used
Date: Fri, 29 Jul 2022 10:33:04
Message-Id: 20220729103103.1185162-7-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/11] distutils-r1.eclass: Support for gpep517-9+ --optimize + minor changes by "Michał Górny"
1 Use the new --optimize option of gpep517 >= 9 when it is installed,
2 and remove the python_optimize call then. This conditional logic is
3 meant to give some additional testing while gpep517-9 is still in ~arch.
4
5 Note that this also removes python_optimize call for "no" mode.
6 However, this mode is used only by a handful of ebuilds, so if any of
7 them needs an explicit python_optimize call, we can quickly fix them.
8
9 Signed-off-by: Michał Górny <mgorny@g.o>
10 ---
11 eclass/distutils-r1.eclass | 36 ++++++++++++++++++++++++++----------
12 1 file changed, 26 insertions(+), 10 deletions(-)
13
14 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
15 index 495eead1d5fd..60f81473c0a6 100644
16 --- a/eclass/distutils-r1.eclass
17 +++ b/eclass/distutils-r1.eclass
18 @@ -1270,13 +1270,25 @@ distutils_wheel_install() {
19 local wheel=${2}
20
21 einfo " Installing ${wheel##*/} to ${root}"
22 - local cmd=(
23 - gpep517 install-wheel
24 - --destdir="${root}"
25 - --interpreter="${PYTHON}"
26 - --prefix="${EPREFIX}/usr"
27 - "${wheel}"
28 - )
29 + if has_version -b ">=dev-python/gpep517-9"; then
30 + # TODO: inline when we dep on >=9
31 + local cmd=(
32 + gpep517 install-wheel
33 + --destdir="${root}"
34 + --interpreter="${PYTHON}"
35 + --prefix="${EPREFIX}/usr"
36 + --optimize=all
37 + "${wheel}"
38 + )
39 + else
40 + local cmd=(
41 + gpep517 install-wheel
42 + --destdir="${root}"
43 + --interpreter="${PYTHON}"
44 + --prefix="${EPREFIX}/usr"
45 + "${wheel}"
46 + )
47 + fi
48 printf '%s\n' "${cmd[*]}"
49 "${cmd[@]}" || die "Wheel install failed"
50
51 @@ -1994,9 +2006,13 @@ _distutils-r1_post_python_install() {
52 done
53
54 if [[ ${DISTUTILS_USE_PEP517} ]]; then
55 - # we need to recompile everything here in order to embed
56 - # the correct paths
57 - python_optimize "${sitedir}"
58 + if ! has_version -b ">=dev-python/gpep517-9"
59 + then
60 + # TODO: remove when we dep on >=9
61 + # we need to recompile everything here in order to embed
62 + # the correct paths
63 + python_optimize "${sitedir}"
64 + fi
65 fi
66 fi
67 }
68 --
69 2.35.1