commit:     67f008f6acc086e0a58dfebd1b019bcdad73620a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 26 11:32:32 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Apr  2 07:06:18 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67f008f6

distutils-r1.eclass: Add a safety check for wheel install done

Add a safety check to verify that distutils_wheel_install is being
(usually indirectly) called in python_compile(), when using PEP517
build.  If it weren't, this usually indicates that
distutils-r1_python_compile (or distutils_pep517_install) was not
called.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/41222
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/distutils-r1.eclass | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 42e47a5b3028..e1672dd3c3b0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1246,6 +1246,8 @@ distutils_wheel_install() {
                -o -path '*.dist-info/licenses' \
                -o -path '*.dist-info/zip-safe' \
                \) -delete || die
+
+       _DISTUTILS_WHL_INSTALLED=1
 }
 
 # @VARIABLE: DISTUTILS_WHEEL_PATH
@@ -2011,6 +2013,11 @@ _distutils-r1_compare_installed_files() {
 _distutils-r1_post_python_compile() {
        debug-print-function ${FUNCNAME} "$@"
 
+       if [[ ! ${_DISTUTILS_WHL_INSTALLED} && ${DISTUTILS_USE_PEP517:-no} != 
no ]]
+       then
+               die "No wheel installed in python_compile(), did you call 
distutils-r1_python_compile?"
+       fi
+
        local root=${BUILD_DIR}/install
        if [[ ${DISTUTILS_USE_PEP517} && -d ${root} ]]; then
                # copy executables to python-exec directory

Reply via email to