diff --git a/metadata/install-qa-check.d/60python-site b/metadata/install-qa-check.d/60python-site index 49d4b3a1a8303..4dd8d636e7cc9 100644 --- a/metadata/install-qa-check.d/60python-site +++ b/metadata/install-qa-check.d/60python-site @@ -38,6 +38,7 @@ python_site_check() { local bad_versions=() local eggs=() + local namespace_packages=() local outside_site=() local stray_packages=() local wrong_ext=() @@ -142,6 +143,16 @@ python_site_check() { ')' -a '!' -name "*${ext_suffix}" -print0 ) + # check for namespace packages + while IFS= read -d $'\0' -r f; do + if grep -q "pkg_resources.*declare_namespace" "${f}" + then + namespace_packages+=( "${f}" ) + fi + done < <( + find "${sitedir}" -maxdepth 2 -type f -name '__init__.py' -print0 + ) + einfo "Verifying compiled files for ${impl}" local kind pyc py while IFS=: read -r kind pyc py extra; do @@ -268,6 +279,18 @@ python_site_check() { eqatag -v python-site.libdir "${bad_libdirs[@]#${ED}}" fi + if [[ ${namespace_packages[@]} ]]; then + eqawarn + eqawarn "QA Notice: Package installs pkg_resources namespace packages that" + eqawarn "are deprecated. Please either remove __init__.py in favor of PEP 420" + eqawarn "implicit namespace, if possible, or replace it with pkgutil namespace." + eqawarn + eqatag -v python-site.libdir "${namespace_packages[@]#${ED}}" + eqawarn + eqawarn "Please report a bug upstream. See also:" + eqawarn "https://projects.gentoo.org/python/guide/concept.html#namespace-packages" + fi + if [[ ${outside_site[@]} ]]; then eqawarn eqawarn "QA Notice: Files found installed directly into Python stdlib,"