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 2/7] distutils-r1.eclass: Future-proof python_install() for empty root
Date: Tue, 07 Jun 2022 20:09:39
Message-Id: 20220607200840.4112-3-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 Account for the possibility that ${BUILD_DIR}/install does not contain
2 any files to merge, in preparation for DISTUTILS_USE_PEP517=no.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 eclass/distutils-r1.eclass | 9 ++++++++-
7 1 file changed, 8 insertions(+), 1 deletion(-)
8
9 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
10 index e5e11c75e39f..370b8bb7c6e0 100644
11 --- a/eclass/distutils-r1.eclass
12 +++ b/eclass/distutils-r1.eclass
13 @@ -1484,6 +1484,7 @@ distutils-r1_python_install() {
14 _python_check_EPYTHON
15
16 local scriptdir=${EPREFIX}/usr/bin
17 + local merge_root=
18 if [[ ${DISTUTILS_USE_PEP517} ]]; then
19 local root=${BUILD_DIR}/install
20 # remove the altered bindir, executables from the package
21 @@ -1495,6 +1496,10 @@ distutils-r1_python_install() {
22 mv "${wrapped_scriptdir}" "${root}${scriptdir}" || die
23 fi
24 fi
25 + # prune empty directories to see if ${root} contains anything
26 + # to merge
27 + find "${BUILD_DIR}"/install -type d -empty -delete || die
28 + [[ -d ${BUILD_DIR}/install ]] && merge_root=1
29 else
30 local root=${D%/}/_${EPYTHON}
31 [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D%/}
32 @@ -1521,6 +1526,8 @@ distutils-r1_python_install() {
33 addpredict /usr/local # bug 498232
34
35 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
36 + merge_root=1
37 +
38 # user may override --install-scripts
39 # note: this is poor but distutils argv parsing is dumb
40
41 @@ -1549,7 +1556,7 @@ distutils-r1_python_install() {
42 esetup.py "${args[@]}"
43 fi
44
45 - if [[ ! ${DISTUTILS_SINGLE_IMPL} || ${DISTUTILS_USE_PEP517} ]]; then
46 + if [[ ${merge_root} ]]; then
47 multibuild_merge_root "${root}" "${D%/}"
48 if [[ ${DISTUTILS_USE_PEP517} ]]; then
49 # we need to recompile everything here in order to embed
50 --
51 2.35.1