eclass/distutils-r1: Sync with Gentoo

It's from Gentoo commit 92c33bddf2480e3a3e148e0a2caa63a07db53486.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-01-12 07:12:44 +00:00 committed by Krzesimir Nowak
parent 750639256c
commit 6fcbcb6d5e

View File

@ -1,4 +1,4 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: distutils-r1.eclass
@ -415,6 +415,28 @@ unset -f _distutils_set_globals
# }
# @CODE
# @ECLASS_VARIABLE: DISTUTILS_CONFIG_SETTINGS_JSON
# @DEFAULT_UNSET
# @DESCRIPTION:
# The JSON object deserialized into config_settings dictionary passed
# to the build backend.
#
# Allowed only for DISTUTILS_USE_PEP517=standalone. Use DISTUTILS_ARGS
# for other backends.
#
# Example:
# @CODE
# python_configure_all() {
# DISTUTILS_CONFIG_SETTINGS_JSON='
# {
# "verbose": true,
# "targets": ["foo", "bar"],
# "build-type": "release"
# }
# '
# }
# @CODE
# @FUNCTION: distutils_enable_sphinx
# @USAGE: <subdir> [--no-autodoc | <plugin-pkgs>...]
# @DESCRIPTION:
@ -1197,6 +1219,12 @@ distutils_pep517_install() {
;;
esac
if [[ ${DISTUTILS_USE_PEP517} == standalone ]]; then
config_settings=${DISTUTILS_CONFIG_SETTINGS_JSON}
elif [[ -n ${DISTUTILS_CONFIG_SETTINGS_JSON} ]]; then
die "DISTUTILS_CONFIG_SETTINGS_JSON supported only for standalone backends"
fi
# https://pyo3.rs/latest/building-and-distribution.html#cross-compiling
if tc-is-cross-compiler; then
local -x PYO3_CROSS_LIB_DIR=${SYSROOT}/$(python_get_stdlib)
@ -1260,14 +1288,15 @@ distutils-r1_python_compile() {
# we are appending a dynamic component so that
# distutils-r1_python_compile can be called multiple
# times and don't end up combining resulting packages
#
# we are no longer adding "parallel" since it is causing too many
# issues, including silent miscompilations, and upstream doesn't
# address any bugs
mkdir -p "${BUILD_DIR}" || die
local -x DIST_EXTRA_CONFIG="${BUILD_DIR}/extra-setup.cfg"
cat > "${DIST_EXTRA_CONFIG}" <<-EOF || die
[build]
build_base = ${BUILD_DIR}/build${#DISTUTILS_WHEELS[@]}
[build_ext]
parallel = $(makeopts_jobs "${MAKEOPTS} ${*}")
EOF
if [[ ${DISTUTILS_ALLOW_WHEEL_REUSE} ]]; then
@ -1486,8 +1515,8 @@ distutils-r1_run_phase() {
local -x PATH=${BUILD_DIR}/install${EPREFIX}/usr/bin:${PATH}
# Set up build environment, bug #513664.
local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
tc-export AR CC CPP CXX
local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX} PKG_CONFIG=${PKG_CONFIG}
tc-export AR CC CPP CXX PKG_CONFIG
# Perform additional environment modifications only for python_compile
# phase. This is the only phase where we expect to be calling the Python