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 3/7] distutils-r1.eclass: Move python_optimize call to post-install
Date: Tue, 07 Jun 2022 20:09:53
Message-Id: 20220607200840.4112-4-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/7] distutils-r1.eclass: DISTUTILS_USE_PEP517=no, take two by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/distutils-r1.eclass | 32 ++++++++++++++++++--------------
4 1 file changed, 18 insertions(+), 14 deletions(-)
5
6 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
7 index 370b8bb7c6e0..9293f744c7c2 100644
8 --- a/eclass/distutils-r1.eclass
9 +++ b/eclass/distutils-r1.eclass
10 @@ -1558,11 +1558,6 @@ distutils-r1_python_install() {
11
12 if [[ ${merge_root} ]]; then
13 multibuild_merge_root "${root}" "${D%/}"
14 - if [[ ${DISTUTILS_USE_PEP517} ]]; then
15 - # we need to recompile everything here in order to embed
16 - # the correct paths
17 - python_optimize "${D%/}$(python_get_sitedir)"
18 - fi
19 fi
20 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
21 _distutils-r1_wrap_scripts "${scriptdir}"
22 @@ -1858,16 +1853,25 @@ distutils-r1_src_test() {
23 _distutils-r1_post_python_install() {
24 debug-print-function ${FUNCNAME} "${@}"
25
26 - local forbidden_package_names=(
27 - examples test tests
28 - .pytest_cache .hypothesis _trial_temp
29 - )
30 - local p
31 - for p in "${forbidden_package_names[@]}"; do
32 - if [[ -d ${D}$(python_get_sitedir)/${p} ]]; then
33 - die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
34 + local sitedir=${D%/}$(python_get_sitedir)
35 + if [[ -d ${sitedir} ]]; then
36 + local forbidden_package_names=(
37 + examples test tests
38 + .pytest_cache .hypothesis _trial_temp
39 + )
40 + local p
41 + for p in "${forbidden_package_names[@]}"; do
42 + if [[ -d ${sitedir}/${p} ]]; then
43 + die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
44 + fi
45 + done
46 +
47 + if [[ ${DISTUTILS_USE_PEP517} ]]; then
48 + # we need to recompile everything here in order to embed
49 + # the correct paths
50 + python_optimize "${sitedir}"
51 fi
52 - done
53 + fi
54 }
55
56 # @FUNCTION: _distutils-r1_check_namespace_pth
57 --
58 2.35.1