From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3C97C158041 for ; Tue, 5 Mar 2024 17:19:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D6118E29FD; Tue, 5 Mar 2024 17:18:20 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 23C71E29E1 for ; Tue, 5 Mar 2024 17:18:20 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= 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 Message-ID: <20240305171812.125985-3-mgorny@gentoo.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240305171812.125985-1-mgorny@gentoo.org> References: <20240305171812.125985-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 5eb7133d-07f8-4f3f-a2e5-be35e51498cd X-Archives-Hash: d727385afd02de582321bfb3f18457e1 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 --- 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