summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-06-07 17:39:10 +0200
committerMichał Górny <mgorny@gentoo.org>2022-06-08 09:53:49 +0200
commitba7451e29bdb6b35971f8639981a2c905bd9bf6b (patch)
tree516d6a32adec3982b4a3ac51997958d594effafe /eclass/distutils-r1.eclass
parentdistutils-r1.eclass: Move venv creation to post-compile (diff)
downloadgentoo-ba7451e29bdb6b35971f8639981a2c905bd9bf6b.tar.gz
gentoo-ba7451e29bdb6b35971f8639981a2c905bd9bf6b.tar.bz2
gentoo-ba7451e29bdb6b35971f8639981a2c905bd9bf6b.zip
distutils-r1.eclass: Future-proof python_install() for empty root
Account for the possibility that ${BUILD_DIR}/install does not contain any files to merge, in preparation for DISTUTILS_USE_PEP517=no. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass9
1 files changed, 8 insertions, 1 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e5e11c75e39f..370b8bb7c6e0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1484,6 +1484,7 @@ distutils-r1_python_install() {
_python_check_EPYTHON
local scriptdir=${EPREFIX}/usr/bin
+ local merge_root=
if [[ ${DISTUTILS_USE_PEP517} ]]; then
local root=${BUILD_DIR}/install
# remove the altered bindir, executables from the package
@@ -1495,6 +1496,10 @@ distutils-r1_python_install() {
mv "${wrapped_scriptdir}" "${root}${scriptdir}" || die
fi
fi
+ # prune empty directories to see if ${root} contains anything
+ # to merge
+ find "${BUILD_DIR}"/install -type d -empty -delete || die
+ [[ -d ${BUILD_DIR}/install ]] && merge_root=1
else
local root=${D%/}/_${EPYTHON}
[[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D%/}
@@ -1521,6 +1526,8 @@ distutils-r1_python_install() {
addpredict /usr/local # bug 498232
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+ merge_root=1
+
# user may override --install-scripts
# note: this is poor but distutils argv parsing is dumb
@@ -1549,7 +1556,7 @@ distutils-r1_python_install() {
esetup.py "${args[@]}"
fi
- if [[ ! ${DISTUTILS_SINGLE_IMPL} || ${DISTUTILS_USE_PEP517} ]]; then
+ if [[ ${merge_root} ]]; then
multibuild_merge_root "${root}" "${D%/}"
if [[ ${DISTUTILS_USE_PEP517} ]]; then
# we need to recompile everything here in order to embed