The eclass code in distutils-r1_python_install makes some assumptions
specific to _distutils-r1_post_python_compile being called,
and scriptdir not being modified since. Make them more explicit by:
1) explicitly removing the files that we expect to have been created,
2) verifying that both the copied and the original scriptdir have
the same list of files.
Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index f3d224a51224..0e069597b3ab 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1514,11 +1514,33 @@ distutils-r1_python_install() {
local merge_root=
if [[ ${DISTUTILS_USE_PEP517} ]]; then
local root=${BUILD_DIR}/install
+ local wrapped_scriptdir=${root}$(python_get_scriptdir)
+
+ # we are assuming that _distutils-r1_post_python_compile
+ # has been called and ${root} has not been altered since
+ # let's explicitly verify these assumptions
+
+ # remove files that we've created explicitly
+ rm "${root}${scriptdir}"/{"${EPYTHON}",python3,python,pyvenv.cfg} || die
+ # verify that scriptdir & wrapped_scriptdir both contain
+ # the same files
+ local ck1=$(
+ { cd "${root}${scriptdir}" && find . -type f -print0; } |
+ sort -z | cksum
+ )
+ local ck2=$(
+ {