* [gentoo-dev] [PATCH v2 0/7] distutils-r1.eclass + python-utils-r1.eclass + meson.eclass: combined patches
@ 2024-03-05 17:16 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
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
Hi,
The same set as previously + extra patches from Eli, James and Sam.
Eli Schwartz (1):
distutils-r1.eclass: wire up meson-python to meson.eclass
James Le Cuirot (1):
python-utils-r1.eclass: Fix python_doheader install location with ROOT
Michał Górny (4):
distutils-r1.eclass: Remove -Werror... hack (now in cython)
distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test
distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block
distutils-r1.eclass: Make vars local before calling filter-lto
Sam James (1):
meson.eclass: move python_export_utf8_locale to meson_src_configure
eclass/distutils-r1.eclass | 45 +++++++++++++++++++++++++----------
eclass/meson.eclass | 6 ++---
eclass/python-utils-r1.eclass | 2 +-
3 files changed, 36 insertions(+), 17 deletions(-)
--
2.44.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH v2 1/7] distutils-r1.eclass: Remove -Werror... hack (now in cython)
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 ` Michał Górny
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 2/7] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 5 -----
1 file changed, 5 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index c0d1992ccce0..fb0c2dfaa693 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1813,11 +1813,6 @@ distutils-r1_run_phase() {
tc-export AR CC CPP CXX
if [[ ${DISTUTILS_EXT} ]]; then
- if [[ ${BDEPEND} == *dev-python/cython* ]] ; then
- # Workaround for https://github.com/cython/cython/issues/2747 (bug #918983)
- local -x CFLAGS="${CFLAGS} $(test-flags-CC -Wno-error=incompatible-pointer-types)"
- fi
-
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH v2 2/7] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test
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
2024-03-05 17:16 ` [gentoo-dev] [PATCH v2 3/7] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block Michał Górny
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH v2 3/7] distutils-r1.eclass: Move filter-lto into DISTUTILS_EXT block
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 ` [gentoo-dev] [PATCH v2 2/7] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
@ 2024-03-05 17:16 ` 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
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 60554944a5a0..ee1dcef24ff6 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1824,17 +1824,17 @@ distutils-r1_run_phase() {
# bug fixes from Cython (this works only when setup.py is using
# cythonize() but it's better than nothing)
local -x CYTHON_FORCE_REGEN=1
+
+ # Rust extensions are incompatible with C/C++ LTO compiler
+ # see e.g. https://bugs.gentoo.org/910220
+ if has cargo ${INHERITED}; then
+ filter-lto
+ fi
fi
# silence warnings when pydevd is loaded on Python 3.11+
local -x PYDEVD_DISABLE_FILE_VALIDATION=1
- # Rust extensions are incompatible with C/C++ LTO compiler
- # see e.g. https://bugs.gentoo.org/910220
- if has cargo ${INHERITED}; then
- filter-lto
- fi
-
# How to build Python modules in different worlds...
local ldopts
case "${CHOST}" in
--
2.44.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH v2 4/7] distutils-r1.eclass: Make vars local before calling filter-lto
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
` (2 preceding siblings ...)
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 ` Michał Górny
2024-03-09 19:59 ` Mike Gilbert
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
` (2 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: Michał Górny
Make LTO filtering local to the compilation code. This avoids disabling
LTO for non-Python parts of an ebuild.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index ee1dcef24ff6..134cb39f276a 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1828,6 +1828,10 @@ distutils-r1_run_phase() {
# Rust extensions are incompatible with C/C++ LTO compiler
# see e.g. https://bugs.gentoo.org/910220
if has cargo ${INHERITED}; then
+ local x
+ for x in $(all-flag-vars); do
+ local -x "${x}=${!x}"
+ done
filter-lto
fi
fi
--
2.44.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH v2 5/7] python-utils-r1.eclass: Fix python_doheader install location with ROOT
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
` (3 preceding siblings ...)
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-05 17:16 ` 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
6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: James Le Cuirot
From: James Le Cuirot <chewi@gentoo.org>
python_get_includedir is prefixed with ESYSROOT, not EPREFIX, so we need
to strip off the former, not the latter.
This is currently only used for dev-python/pillow, which I have tested.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
eclass/python-utils-r1.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 3af3cbdb075e..caa39813feec 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -884,7 +884,7 @@ python_doheader() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local includedir=$(python_get_includedir)
- local d=${includedir#${EPREFIX}}
+ local d=${includedir#${ESYSROOT}}
(
insopts -m 0644
--
2.44.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH v2 6/7] meson.eclass: move python_export_utf8_locale to meson_src_configure
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
` (4 preceding siblings ...)
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 ` 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
6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: Sam James
From: Sam James <sam@gentoo.org>
We don't need it in setup_meson_src_configure as distutils-r1 uses it and
it'll get called twice then.
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/meson.eclass | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 3bf0ba9ebe97..85f024de1b0c 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -393,9 +393,6 @@ setup_meson_src_configure() {
tc-export NM
tc-getPROG READELF readelf >/dev/null
- # https://bugs.gentoo.org/625396
- python_export_utf8_locale
-
# https://bugs.gentoo.org/721786
export BOOST_INCLUDEDIR="${BOOST_INCLUDEDIR-${EPREFIX}/usr/include}"
export BOOST_LIBRARYDIR="${BOOST_LIBRARYDIR-${EPREFIX}/usr/$(get_libdir)}"
@@ -412,6 +409,9 @@ meson_src_configure() {
BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
+ # https://bugs.gentoo.org/625396
+ python_export_utf8_locale
+
(
setup_meson_src_configure "$@"
MESONARGS+=(
--
2.44.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-dev] [PATCH v2 7/7] distutils-r1.eclass: wire up meson-python to meson.eclass
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
` (5 preceding siblings ...)
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 ` Michał Górny
6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2024-03-05 17:16 UTC (permalink / raw)
To: gentoo-dev; +Cc: Eli Schwartz, Sam James, Michał Górny
From: Eli Schwartz <eschwartz93@gmail.com>
The meson-python build backend -- as the name suggests -- uses meson
under the hood. We have a meson eclass which does lots of useful things
pertinent to meson. Make sure it gets invoked, by prying out the options
that meson_src_configure would use and setting passing them as our seed
values for gpep517.
[sam: Tweak '=' style.]
[sam: Tweak mesonargs->MESONARGS for final version of e9189344b971f7ee0e2bec36650c57dbade4f122.]
[sam: Update local variable list.]
[mgorny: Add local variables for LTO filtering.]
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 134cb39f276a..e0c54d81a846 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -197,6 +197,10 @@ _DISTUTILS_R1_ECLASS=1
inherit flag-o-matic
inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs
+if [[ ${DISTUTILS_USE_PEP517} == meson-python ]]; then
+ inherit meson
+fi
+
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
inherit python-r1
else
@@ -1386,9 +1390,19 @@ distutils_pep517_install() {
)
;;
meson-python)
+ # variables defined by setup_meson_src_configure
+ local MESONARGS=() BOOST_INCLUDEDIR BOOST_LIBRARYDIR NM READELF
+ # it also calls filter-lto
+ local x
+ for x in $(all-flag-vars); do
+ local -x "${x}=${!x}"
+ done
+
+ setup_meson_src_configure "${DISTUTILS_ARGS[@]}"
+
local -x NINJAOPTS=$(get_NINJAOPTS)
config_settings=$(
- "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
+ "${EPYTHON}" - "${MESONARGS[@]}" <<-EOF || die
import json
import os
import shlex
--
2.44.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH v2 4/7] distutils-r1.eclass: Make vars local before calling filter-lto
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
0 siblings, 1 reply; 10+ messages in thread
From: Mike Gilbert @ 2024-03-09 19:59 UTC (permalink / raw)
To: gentoo-dev
On Tue, Mar 5, 2024 at 12:16 PM Michał Górny <mgorny@gentoo.org> wrote:
>
> Make LTO filtering local to the compilation code. This avoids disabling
> LTO for non-Python parts of an ebuild.
>
> Signed-off-by: Michał Górny <mgorny@gentoo.org>
> ---
> eclass/distutils-r1.eclass | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
> index ee1dcef24ff6..134cb39f276a 100644
> --- a/eclass/distutils-r1.eclass
> +++ b/eclass/distutils-r1.eclass
> @@ -1828,6 +1828,10 @@ distutils-r1_run_phase() {
> # Rust extensions are incompatible with C/C++ LTO compiler
> # see e.g. https://bugs.gentoo.org/910220
> if has cargo ${INHERITED}; then
> + local x
> + for x in $(all-flag-vars); do
> + local -x "${x}=${!x}"
> + done
> filter-lto
> fi
> fi
I had never thought to loop over all-flag-vars like this. Added to my
mental code repo, thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] [PATCH v2 4/7] distutils-r1.eclass: Make vars local before calling filter-lto
2024-03-09 19:59 ` Mike Gilbert
@ 2024-03-10 1:58 ` Eli Schwartz
0 siblings, 0 replies; 10+ messages in thread
From: Eli Schwartz @ 2024-03-10 1:58 UTC (permalink / raw)
To: gentoo-dev
[-- Attachment #1.1.1: Type: text/plain, Size: 1636 bytes --]
On 3/9/24 2:59 PM, Mike Gilbert wrote:
> On Tue, Mar 5, 2024 at 12:16 PM Michał Górny <mgorny@gentoo.org> wrote:
>>
>> Make LTO filtering local to the compilation code. This avoids disabling
>> LTO for non-Python parts of an ebuild.
>>
>> Signed-off-by: Michał Górny <mgorny@gentoo.org>
>> ---
>> eclass/distutils-r1.eclass | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
>> index ee1dcef24ff6..134cb39f276a 100644
>> --- a/eclass/distutils-r1.eclass
>> +++ b/eclass/distutils-r1.eclass
>> @@ -1828,6 +1828,10 @@ distutils-r1_run_phase() {
>> # Rust extensions are incompatible with C/C++ LTO compiler
>> # see e.g. https://bugs.gentoo.org/910220
>> if has cargo ${INHERITED}; then
>> + local x
>> + for x in $(all-flag-vars); do
>> + local -x "${x}=${!x}"
>> + done
>> filter-lto
>> fi
>> fi
>
> I had never thought to loop over all-flag-vars like this. Added to my
> mental code repo, thanks!
To be fair, when I suggested this in review of the patch it wasn't my
idea either. I shamelessly stole it from... flag-o-matic.eclass, where
it is used by filter-flags, replace-flags, is-flagq, strip-flags, get-flag.
filter-flags in turn is used by filter-lto, hence all-flag-vars is the
direct API that governs what variables filter-lto will modify. It seemed
fitting to single-source that information.
--
Eli Schwartz
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 18399 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-03-10 1:58 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [gentoo-dev] [PATCH v2 2/7] distutils-r1.eclass: Limit DISTUTILS_EXT logic to compile & test Michał Górny
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox