In addition to checking for known-bad package names, detect stray
files installed into top-level site-packages directory. This is
primarily meant to cover the common mistake in using `include`
in Poetry-built packages.
Closes:
https://bugs.gentoo.org/893172
Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 8896768d3ce9..a6be88ad858d 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -171,7 +171,7 @@ esac
if [[ ! ${_DISTUTILS_R1} ]]; then
-inherit multibuild multiprocessing ninja-utils toolchain-funcs
+inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
inherit python-r1
@@ -1985,12 +1985,34 @@ _distutils-r1_post_python_install() {
examples test tests
.pytest_cache .hypothesis _trial_temp
)
+ local strays=()
local p
+ mapfile -d $'\0' -t strays < <(
+ find "${sitedir}" -maxdepth 1 -type f '!' '(' \
+ -name '*.egg-info' -o \
+ -name '*.pth' -o \
+ -name '*.py' -o \
+ -name '*.pyi' -o \
+ -name "*$(get_modname)" \
+ ')' -print0
+ )
for p in "${forbidden_pa