commit:     8c8c938e158a9e10f1c5a4280c16e435e354122e
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 22:54:40 2022 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Thu Dec 29 21:30:53 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c8c938e

dev-lang/python: Fix cross-compiling for prefixed systems

Cross-compiling Python involves doing a native build first. The prefix profile
prefixifies setup.py, but this has been done before the native build when it
needs to be done after. Handle this in the ebuild with hprefixify instead of
with sed in the profile.

Also drop some other obsolete Python prefix hacks from the profile.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 dev-lang/python/python-3.10.9.ebuild               |  3 ++-
 dev-lang/python/python-3.11.1.ebuild               |  3 ++-
 dev-lang/python/python-3.12.0_alpha3-r1.ebuild     |  3 ++-
 dev-lang/python/python-3.8.16.ebuild               |  3 ++-
 dev-lang/python/python-3.9.16.ebuild               |  3 ++-
 profiles/features/prefix/standalone/profile.bashrc | 11 -----------
 6 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/dev-lang/python/python-3.10.9.ebuild 
b/dev-lang/python/python-3.10.9.ebuild
index bb4dfcde3ea3..1b3700f2b2b9 100644
--- a/dev-lang/python/python-3.10.9.ebuild
+++ b/dev-lang/python/python-3.10.9.ebuild
@@ -5,7 +5,7 @@ EAPI="7"
 WANT_LIBTOOL="none"
 
 inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
-inherit python-utils-r1 toolchain-funcs verify-sig
+inherit prefix python-utils-r1 toolchain-funcs verify-sig
 
 MY_PV=${PV/_rc/rc}
 MY_P="Python-${MY_PV%_p*}"
@@ -299,6 +299,7 @@ src_configure() {
                append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
        fi
 
+       hprefixify setup.py
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/dev-lang/python/python-3.11.1.ebuild 
b/dev-lang/python/python-3.11.1.ebuild
index 57e49df5e368..f0e59a041105 100644
--- a/dev-lang/python/python-3.11.1.ebuild
+++ b/dev-lang/python/python-3.11.1.ebuild
@@ -5,7 +5,7 @@ EAPI="7"
 WANT_LIBTOOL="none"
 
 inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
-inherit python-utils-r1 toolchain-funcs verify-sig
+inherit prefix python-utils-r1 toolchain-funcs verify-sig
 
 MY_PV=${PV/_rc/rc}
 MY_P="Python-${MY_PV%_p*}"
@@ -291,6 +291,7 @@ src_configure() {
                append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
        fi
 
+       hprefixify setup.py
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/dev-lang/python/python-3.12.0_alpha3-r1.ebuild 
b/dev-lang/python/python-3.12.0_alpha3-r1.ebuild
index 9cdbb7bfcca9..860a12f15586 100644
--- a/dev-lang/python/python-3.12.0_alpha3-r1.ebuild
+++ b/dev-lang/python/python-3.12.0_alpha3-r1.ebuild
@@ -5,7 +5,7 @@ EAPI="7"
 WANT_LIBTOOL="none"
 
 inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
-inherit python-utils-r1 toolchain-funcs verify-sig
+inherit prefix python-utils-r1 toolchain-funcs verify-sig
 
 MY_PV=${PV/_alpha/a}
 MY_P="Python-${MY_PV%_p*}"
@@ -287,6 +287,7 @@ src_configure() {
                append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
        fi
 
+       hprefixify setup.py
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/dev-lang/python/python-3.8.16.ebuild 
b/dev-lang/python/python-3.8.16.ebuild
index 6469ad3212ff..086407df8721 100644
--- a/dev-lang/python/python-3.8.16.ebuild
+++ b/dev-lang/python/python-3.8.16.ebuild
@@ -5,7 +5,7 @@ EAPI="7"
 WANT_LIBTOOL="none"
 
 inherit autotools flag-o-matic multiprocessing pax-utils
-inherit python-utils-r1 toolchain-funcs verify-sig
+inherit prefix python-utils-r1 toolchain-funcs verify-sig
 
 MY_PV=${PV/_rc/rc}
 MY_P="Python-${MY_PV%_p*}"
@@ -253,6 +253,7 @@ src_configure() {
                append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
        fi
 
+       hprefixify setup.py
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/dev-lang/python/python-3.9.16.ebuild 
b/dev-lang/python/python-3.9.16.ebuild
index e6b279292564..f6dbbd4312df 100644
--- a/dev-lang/python/python-3.9.16.ebuild
+++ b/dev-lang/python/python-3.9.16.ebuild
@@ -5,7 +5,7 @@ EAPI="7"
 WANT_LIBTOOL="none"
 
 inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
-inherit python-utils-r1 toolchain-funcs verify-sig
+inherit prefix python-utils-r1 toolchain-funcs verify-sig
 
 MY_PV=${PV/_rc/rc}
 MY_P="Python-${MY_PV%_p*}"
@@ -293,6 +293,7 @@ src_configure() {
                append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
        fi
 
+       hprefixify setup.py
        econf "${myeconfargs[@]}"
 
        if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then

diff --git a/profiles/features/prefix/standalone/profile.bashrc 
b/profiles/features/prefix/standalone/profile.bashrc
index d23eeb81797d..fd95e43f7f30 100644
--- a/profiles/features/prefix/standalone/profile.bashrc
+++ b/profiles/features/prefix/standalone/profile.bashrc
@@ -74,17 +74,6 @@ elif [[ ${CATEGORY}/${PN} == sys-libs/glibc && 
${EBUILD_PHASE} == configure ]];
        -e "s,/(etc|var),${EPREFIX}/\1,g" \
        nss/db-Makefile
     eend $?
-elif [[ ${CATEGORY}/${PN} == dev-lang/python && ${EBUILD_PHASE} == configure 
]]; then
-    # Guide h2py to look into glibc of Prefix
-    ebegin "Guiding h2py to look into Prefix"
-    export include="${EPREFIX}"/usr/include
-    sed -i -r \
-       -e "s,/usr/include,\"${EPREFIX}\"/usr/include,g" 
"${S}"/Lib/plat-linux*/regen
-    eend $?
-    ebegin "Prefixifying distutils paths"
-    sed -re 
"s,([^[:alnum:]])(/usr[/[:alnum:]]*/(lib[[:alnum:]]*|include)|/lib[[:alnum:]]*),\1${EPREFIX}\2,g"
 \
-       -i "${S}"/setup.py
-    eend $?
 elif [[ ${CATEGORY}/${PN} == dev-lang/perl && ${EBUILD_PHASE} == configure ]]; 
then
     ebegin "Prefixifying pwd path"
     sed -r "s,'((|/usr)/bin/pwd),'${EPREFIX}\1," -i 
"${S}"/dist/PathTools/Cwd.pm

Reply via email to