Signed-off-by: Michał Górny <mgo...@gentoo.org>
---
 eclass/distutils-r1.eclass | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 014669c8c47c..e0a91001ef1f 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -2089,14 +2089,33 @@ _distutils-r1_post_python_install() {
 
        local sitedir=${D%/}$(python_get_sitedir)
        if [[ -d ${sitedir} ]]; then
+               local p
                _distutils-r1_strip_namespace_packages "${sitedir}"
 
+               local bad_versions=()
+               mapfile -d $'\0' -t bad_versions < <(
+                       find "${sitedir}" -maxdepth 1 '(' \
+                               -name '*-0.0.0.dist-info' -o \
+                               -name '*-UNKNOWN.dist-info' -o \
+                               -name '*-0.0.0.egg-info' -o \
+                               -name '*-UNKNOWN.egg-info' \
+                               ')' -print0
+               )
+
+               if [[ -n ${bad_versions[@]} ]]; then
+                       eqawarn "The following Python packages were installed 
with invalid/suspicious"
+                       eqawarn "versions in the site-packages directory:"
+                       eqawarn
+                       for p in "${bad_versions[@]}"; do
+                               eqawarn "  ${p##*/}"
+                       done
+               fi
+
                local forbidden_package_names=(
                        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 \
-- 
2.43.0


Reply via email to