Following the changes in python-utils-r1.eclass, Python is now needed
in both BDEPEND and DEPEND.

As distutils does not call our eclass helpers, we need to pass the
correct include and library directories in setup.cfg. Unfortunately it
is still hardcoded to add -I/usr/include/pythonX.X and -L/usr/lib but
these appear after the SYSROOT paths so the build succeeds anyway. If
a missing header or library were to cause it to fall back to the build
host paths then it would most likely fail but it does not matter as it
would have failed either way.

Closes: https://bugs.gentoo.org/648652
Signed-off-by: James Le Cuirot <ch...@gentoo.org>
---
 eclass/distutils-r1.eclass | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index fa7a3ab5c12b..ff7792f11a87 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: distutils-r1.eclass
@@ -99,11 +99,8 @@ if [[ ! ${_DISTUTILS_R1} ]]; then
 
 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
        RDEPEND=${PYTHON_DEPS}
-       if [[ ${EAPI} != [56] ]]; then
-               BDEPEND=${PYTHON_DEPS}
-       else
-               DEPEND=${PYTHON_DEPS}
-       fi
+       DEPEND=${PYTHON_DEPS}
+       [[ ${EAPI} != [56] ]] && BDEPEND=${PYTHON_DEPS}
        REQUIRED_USE=${PYTHON_REQUIRED_USE}
 fi
 
@@ -407,8 +404,21 @@ _distutils-r1_create_setup_cfg() {
                # setuptools like to create .egg files for install --home.
                [bdist_egg]
                dist-dir = ${BUILD_DIR}/dist
+
+               # this is needed when cross-compiling
+               [build_ext]
        _EOF_
 
+       if [[ ${EPYTHON} != jython* ]]; then
+               echo "include-dirs = $(python_get_includedir)" \
+                       >> "${HOME}"/.pydistutils.cfg || die
+       fi
+
+       if [[ ${EPYTHON} == python* ]]; then
+               echo "library-dirs = $(dirname $(python_get_library_path))" \
+                       >> "${HOME}"/.pydistutils.cfg || die
+       fi
+
        # we can't refer to ${D} before src_install()
        if [[ ${EBUILD_PHASE} == install ]]; then
                cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
-- 
2.19.2


Reply via email to