summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-02-27 20:37:25 +0100
committerMichał Górny <mgorny@gentoo.org>2024-03-08 06:40:20 +0100
commitbd8fbec80e9217a717f70621fdd6989a9d758466 (patch)
treeb54ef5a8ca7a4b77b9608aeafad37f5c2db74f79 /eclass
parentdistutils-r1.eclass: Remove -Werror... hack (now in cython) (diff)
downloadgentoo-bd8fbec80e9217a717f70621fdd6989a9d758466.tar.gz
gentoo-bd8fbec80e9217a717f70621fdd6989a9d758466.tar.bz2
gentoo-bd8fbec80e9217a717f70621fdd6989a9d758466.zip
distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test
Perform the environment modifications specific to DISTUTILS_EXT to python_compile and python_test phases. These are the only phases where we expect extension builds to be called. This allows us to limit the scope of localized CPPFLAGS, as we both want to avoid leaking changes to non-Python parts of the build and let ebuilds to manipulate flags at their leisure, particularly prior to python_compile. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass8
1 files changed, 7 insertions, 1 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index fb0c2dfaa693..60554944a5a0 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1812,7 +1812,13 @@ distutils-r1_run_phase() {
local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
tc-export AR CC CPP CXX
- if [[ ${DISTUTILS_EXT} ]]; then
+ # Perform additional environment modifications only for python_compile
+ # phase. This is the only phase where we expect to be calling the Python
+ # build system. We want to localize the altered variables to avoid them
+ # leaking to other parts of multi-language ebuilds. However, we want
+ # to avoid localizing them in other phases, particularly
+ # python_configure_all, where the ebuild may wish to alter them globally.
+ if [[ ${DISTUTILS_EXT} && ( ${1} == *compile* || ${1} == *test* ) ]]; then
local -x CPPFLAGS="${CPPFLAGS} $(usex debug '-UNDEBUG' '-DNDEBUG')"
# always generate .c files from .pyx files to ensure we get latest
# bug fixes from Cython (this works only when setup.py is using