commit:     96845942dcabadb96bc0202c03d19e497278de69
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 08:42:00 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun  7 06:53:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=96845942

distutils-r1.eclass: Move install QA checks to post-phase function

Perform the install QA check (the invalid package name check) in a post-
phase function.  This enables it to be performed even when
distutils-r1_python_install is not used.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/distutils-r1.eclass | 54 ++++++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index b690f21f9159..30391ad67f3a 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1566,29 +1566,6 @@ distutils-r1_python_install() {
                esetup.py "${args[@]}"
        fi
 
-       local forbidden_package_names=(
-               examples test tests
-               .pytest_cache .hypothesis
-       )
-       local p
-       for p in "${forbidden_package_names[@]}"; do
-               if [[ -d ${root}$(python_get_sitedir)/${p} ]]; then
-                       die "Package installs '${p}' package which is forbidden 
and likely a bug in the build system."
-               fi
-       done
-
-       local shopt_save=$(shopt -p nullglob)
-       shopt -s nullglob
-       local pypy_dirs=(
-               "${root}${EPREFIX}/usr/$(get_libdir)"/pypy*/share
-               "${root}${EPREFIX}/usr/lib"/pypy*/share
-       )
-       ${shopt_save}
-
-       if [[ -n ${pypy_dirs} ]]; then
-               die "Package installs 'share' in PyPy prefix, see bug #465546."
-       fi
-
        if [[ ! ${DISTUTILS_SINGLE_IMPL} || ${DISTUTILS_USE_PEP517} ]]; then
                multibuild_merge_root "${root}" "${D%/}"
                if [[ ${DISTUTILS_USE_PEP517} ]]; then
@@ -1845,6 +1822,37 @@ distutils-r1_src_test() {
        return ${ret}
 }
 
+# @FUNCTION: _distutils-r1_post_python_install
+# @INTERNAL
+# @DESCRIPTION:
+# Post-phase function called after python_install.
+_distutils-r1_post_python_install() {
+       debug-print-function ${FUNCNAME} "${@}"
+
+       local forbidden_package_names=(
+               examples test tests
+               .pytest_cache .hypothesis
+       )
+       local p
+       for p in "${forbidden_package_names[@]}"; do
+               if [[ -d ${D}$(python_get_sitedir)/${p} ]]; then
+                       die "Package installs '${p}' package which is forbidden 
and likely a bug in the build system."
+               fi
+       done
+
+       local shopt_save=$(shopt -p nullglob)
+       shopt -s nullglob
+       local pypy_dirs=(
+               "${D}${EPREFIX}/usr/$(get_libdir)"/pypy*/share
+               "${D}${EPREFIX}/usr/lib"/pypy*/share
+       )
+       ${shopt_save}
+
+       if [[ -n ${pypy_dirs} ]]; then
+               die "Package installs 'share' in PyPy prefix, see bug #465546."
+       fi
+}
+
 # @FUNCTION: _distutils-r1_check_namespace_pth
 # @INTERNAL
 # @DESCRIPTION:

Reply via email to