Detect when Python packages install extensions and warn about missing
DISTUTILS_EXT appropriately.

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

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index f7510a4640cb..9b31e5db0d2f 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -2069,6 +2069,16 @@ _distutils-r1_post_python_install() {
                        eerror 
"https://projects.gentoo.org/python/guide/qawarn.html#stray-top-level-files-in-site-packages";
                        die "Failing install because of stray top-level files 
in site-packages"
                fi
+
+               if [[ ! ${DISTUTILS_EXT} && ! ${_DISTUTILS_EXT_WARNED} ]]; then
+                       if [[ $(find "${sitedir}" -name "*$(get_modname)" | 
head -n 1) ]]
+                       then
+                               eqawarn "Python extension modules 
(*$(get_modname)) found installed. Please set:"
+                               eqawarn "  DISTUTILS_EXT=1"
+                               eqawarn "in the ebuild."
+                               _DISTUTILS_EXT_WARNED=1
+                       fi
+               fi
        fi
 }
 
-- 
2.40.0


Reply via email to