diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-01-05 17:48:14 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-01-08 15:48:21 +0100 |
commit | 840cd24f4adc643b949f8e45d17ab3f7dc5347fc (patch) | |
tree | 6a5098d0328a33513cc1998f87a66f7e097c975a /metadata | |
parent | install-qa-check.d/60python-site: Check for UNKNOWN package name (diff) | |
download | gentoo-840cd24f4adc643b949f8e45d17ab3f7dc5347fc.tar.gz gentoo-840cd24f4adc643b949f8e45d17ab3f7dc5347fc.tar.bz2 gentoo-840cd24f4adc643b949f8e45d17ab3f7dc5347fc.zip |
install-qa-check.d/60python-site: Check for out-of-sitepkg install
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'metadata')
-rw-r--r-- | metadata/install-qa-check.d/60python-site | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/metadata/install-qa-check.d/60python-site b/metadata/install-qa-check.d/60python-site index 323539107900..00962b0448b0 100644 --- a/metadata/install-qa-check.d/60python-site +++ b/metadata/install-qa-check.d/60python-site @@ -31,6 +31,7 @@ python_site_check() { local stray=() local bad_versions=() + local outside_site=() local stray_packages=() # Avoid running the check if sufficiently new gpep517 is not installed @@ -46,7 +47,24 @@ python_site_check() { impl=${impl##*/} # NB: using ${impl}* to catch pypy3.* for pypy3 - local sitedir=( "${ED}"/usr/lib/${impl}*/site-packages ) + local pydir=( "${ED}"/usr/lib/${impl}* ) + [[ -d ${pydir} ]] || continue + + # check for packages installing outside site-packages + case ${CATEGORY}/${PN} in + dev-lang/python|dev-python/pypy*) + ;; + *) + while IFS= read -d $'\0' -r f; do + outside_site+=( "${f}" ) + done < <( + find "${pydir}" -mindepth 1 -maxdepth 1 \ + '!' -name site-packages -print0 + ) + ;; + esac + + local sitedir=( "${pydir}"/site-packages ) [[ -d ${sitedir} ]] || continue # check for bad package versions @@ -197,6 +215,14 @@ python_site_check() { eqawarn eqatag -v python-site.libdir "${bad_libdirs[@]#${ED}}" fi + + if [[ ${outside_site[@]} ]]; then + eqawarn + eqawarn "QA Notice: Files found installed directly into Python stdlib," + eqawarn "instead of site-packages (use \$(python_get_sitedir)):" + eqawarn + eqatag -v python-site.stdlib "${outside_site[@]}" + fi } python_site_check |