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 <mgo...@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 7a28644252ba..2f173b741896 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