Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 426de7200957..9ef8342486b4 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1980,6 +1980,36 @@ distutils-r1_src_test() {
return ${ret}
}
+# @FUNCTION: _distutils-r1_strip_namespace_packages
+# @USAGE: <sitedir>
+# @INTERNAL
+# @DESCRIPTION:
+# Find and remove setuptools-style namespaces in the specified
+# directory.
+_distutils-r1_strip_namespace_packages() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local sitedir=${1}
+ local f ns had_any=
+ while IFS= read -r -d '' f; do
+ while read -r ns; do
+ einfo "Stripping pkg_resources-style namespace ${ns}"
+ had_any=1
+ done < "${f}"
+
+ rm "${f}" || die
+ done < <(
+ # NB: this deliberately does not include .egg-info, in order
+ # to limit this to PEP517 mode.
+ find "${sitedir}" -path '*.dist-info/namespace_