eclass/distutils-r1: Sync with Gentoo

It's from Gentoo commit 94d7e7e96945ed47e6d3ea6591cf498fd77994b8.
This commit is contained in:
Flatcar Buildbot 2024-03-11 07:13:20 +00:00 committed by Krzesimir Nowak
parent 2aa068119c
commit a04cf778f6

View File

@ -197,6 +197,10 @@ _DISTUTILS_R1_ECLASS=1
inherit flag-o-matic inherit flag-o-matic
inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs
if [[ ${DISTUTILS_USE_PEP517} == meson-python ]]; then
inherit meson
fi
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
inherit python-r1 inherit python-r1
else else
@ -1386,9 +1390,19 @@ distutils_pep517_install() {
) )
;; ;;
meson-python) 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) local -x NINJAOPTS=$(get_NINJAOPTS)
config_settings=$( config_settings=$(
"${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die "${EPYTHON}" - "${MESONARGS[@]}" <<-EOF || die
import json import json
import os import os
import shlex import shlex
@ -1812,27 +1826,32 @@ distutils-r1_run_phase() {
local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX} local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
tc-export AR CC CPP CXX tc-export AR CC CPP CXX
if [[ ${DISTUTILS_EXT} ]]; then # Perform additional environment modifications only for python_compile
if [[ ${BDEPEND} == *dev-python/cython* ]] ; then # phase. This is the only phase where we expect to be calling the Python
# Workaround for https://github.com/cython/cython/issues/2747 (bug #918983) # build system. We want to localize the altered variables to avoid them
local -x CFLAGS="${CFLAGS} $(test-flags-CC -Wno-error=incompatible-pointer-types)" # leaking to other parts of multi-language ebuilds. However, we want
fi # 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')" local -x CPPFLAGS="${CPPFLAGS} $(usex debug '-UNDEBUG' '-DNDEBUG')"
# always generate .c files from .pyx files to ensure we get latest # always generate .c files from .pyx files to ensure we get latest
# bug fixes from Cython (this works only when setup.py is using # bug fixes from Cython (this works only when setup.py is using
# cythonize() but it's better than nothing) # cythonize() but it's better than nothing)
local -x CYTHON_FORCE_REGEN=1 local -x CYTHON_FORCE_REGEN=1
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 # Rust extensions are incompatible with C/C++ LTO compiler
# see e.g. https://bugs.gentoo.org/910220 # see e.g. https://bugs.gentoo.org/910220
if has cargo ${INHERITED}; then if has cargo ${INHERITED}; then
local x
for x in $(all-flag-vars); do
local -x "${x}=${!x}"
done
filter-lto filter-lto
fi fi
fi
# silence warnings when pydevd is loaded on Python 3.11+
local -x PYDEVD_DISABLE_FILE_VALIDATION=1
# How to build Python modules in different worlds... # How to build Python modules in different worlds...
local ldopts local ldopts