eclass/distutils-r1: Sync with Gentoo

It's from Gentoo commit 3f87d0f277763f1cd621a78e34eb226d89020863.
This commit is contained in:
Flatcar Buildbot 2024-01-01 07:12:29 +00:00 committed by Krzesimir Nowak
parent d8b23cf9f2
commit 5ec97a6227

View File

@ -50,6 +50,7 @@ case ${EAPI} in
esac esac
# @ECLASS_VARIABLE: DISTUTILS_EXT # @ECLASS_VARIABLE: DISTUTILS_EXT
# @PRE_INHERIT
# @DEFAULT_UNSET # @DEFAULT_UNSET
# @DESCRIPTION: # @DESCRIPTION:
# Set this variable to a non-null value if the package (possibly # Set this variable to a non-null value if the package (possibly
@ -1242,7 +1243,7 @@ _distutils-r1_get_backend() {
if [[ -f pyproject.toml ]]; then if [[ -f pyproject.toml ]]; then
# if pyproject.toml exists, try getting the backend from it # if pyproject.toml exists, try getting the backend from it
# NB: this could fail if pyproject.toml doesn't list one # NB: this could fail if pyproject.toml doesn't list one
build_backend=$(gpep517 get-backend) build_backend=$("${EPYTHON}" -m gpep517 get-backend)
fi fi
if [[ -z ${build_backend} && ${DISTUTILS_USE_PEP517} == setuptools && if [[ -z ${build_backend} && ${DISTUTILS_USE_PEP517} == setuptools &&
-f setup.py ]] -f setup.py ]]
@ -1316,7 +1317,7 @@ distutils_wheel_install() {
einfo " Installing ${wheel##*/} to ${root}" einfo " Installing ${wheel##*/} to ${root}"
local cmd=( local cmd=(
gpep517 install-wheel "${EPYTHON}" -m gpep517 install-wheel
--destdir="${root}" --destdir="${root}"
--interpreter="${PYTHON}" --interpreter="${PYTHON}"
--prefix="${EPREFIX}/usr" --prefix="${EPREFIX}/usr"
@ -1445,7 +1446,7 @@ distutils_pep517_install() {
local build_backend=$(_distutils-r1_get_backend) local build_backend=$(_distutils-r1_get_backend)
einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}" einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}"
local cmd=( local cmd=(
gpep517 build-wheel "${EPYTHON}" -m gpep517 build-wheel
--prefix="${EPREFIX}/usr" --prefix="${EPREFIX}/usr"
--backend "${build_backend}" --backend "${build_backend}"
--output-fd 3 --output-fd 3
@ -1806,6 +1807,11 @@ distutils-r1_run_phase() {
tc-export AR CC CPP CXX tc-export AR CC CPP CXX
if [[ ${DISTUTILS_EXT} ]]; then 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')" 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