public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH v2 2/7] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test
Date: Tue,  5 Mar 2024 18:16:31 +0100	[thread overview]
Message-ID: <20240305171812.125985-3-mgorny@gentoo.org> (raw)
In-Reply-To: <20240305171812.125985-1-mgorny@gentoo.org>

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>
---
 eclass/distutils-r1.eclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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
-- 
2.44.0



  parent reply	other threads:[~2024-03-05 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 17:16 [gentoo-dev] [PATCH v2 0/7] distutils-r1.eclass + python-utils-r1.eclass + meson.eclass: combined patches Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 1/7] distutils-r1.eclass: Remove -Werror... hack (now in cython) Michał Górny
2024-03-05 17:16 ` Michał Górny [this message]
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 3/7] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 4/7] distutils-r1.eclass: Make vars local before calling filter-lto Michał Górny
2024-03-09 19:59   ` Mike Gilbert
2024-03-10  1:58     ` Eli Schwartz
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 5/7] python-utils-r1.eclass: Fix python_doheader install location with ROOT Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 6/7] meson.eclass: move python_export_utf8_locale to meson_src_configure Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 7/7] distutils-r1.eclass: wire up meson-python to meson.eclass Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240305171812.125985-3-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox