summaryrefslogtreecommitdiff
path: root/eclass/distutils-r1.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass45
1 files changed, 35 insertions, 10 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index cced2b8ffef76..7dfc8c7a3c30a 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -134,13 +134,20 @@
#
# - sip - sipbuild backend
#
-# - standalone - standalone build systems without external deps
-# (used for bootstrapping).
+# - standalone - standalone/local build systems
#
# - uv-build - uv-build backend (using dev-python/uv)
#
-# The variable needs to be set before the inherit line. The eclass
-# adds appropriate build-time dependencies and verifies the value.
+# The variable needs to be set before the inherit line. If another
+# value than "standalone" and "no" is used, The eclass adds appropriate
+# build-time dependencies, verifies the value and calls the appropriate
+# modern entry point for the backend. With DISTUTILS_UPSTREAM_PEP517,
+# this variable can be used to override the upstream build backend.
+#
+# The value of "standalone" indicates that upstream is using a custom,
+# local build backend. In this mode, the eclass does not add any
+# dependencies, disables build backend verification and uses the exact
+# entry point listed in pyproject.toml.
#
# The special value "no" indicates that the package has no build system.
# This is not equivalent to unset DISTUTILS_USE_PEP517 (legacy mode).
@@ -162,6 +169,12 @@
# overriden to workaround the eclass check, when it is desirable
# to build the wheel using other backend than the one used upstream.
#
+# When using it, ideally it should list the build backend actually used
+# upstream, so the eclass will throw an error if that backend changes
+# (and therefore overrides may need to change as well). As a special
+# case, setting it to "standalone" disables the check entirely (while
+# still forcing the backend, unlike DISTUTILS_USE_PEP517=standalone).
+#
# Please note that even in packages using PEP621 metadata, there can
# be subtle differences between the behavior of different PEP517 build
# backends, for example regarding finding package files. When using
@@ -1150,11 +1163,23 @@ _distutils-r1_get_backend() {
fi
fi
+ # if DISTUTILS_USE_PEP517 is "standalone", we respect the exact
+ # backend used in pyproject.toml; otherwise we force the backend
+ # based on DISTUTILS_USE_PEP517
if [[ ${DISTUTILS_USE_PEP517} == standalone ]]; then
echo "${build_backend}"
return
fi
+ # we can output it early, even if we die below
+ echo "$(_distutils-r1_key_to_backend "${DISTUTILS_USE_PEP517}")"
+
+ # skip backend verification if DISTUTILS_UPSTREAM_PEP517
+ # is "standalone"
+ if [[ ${DISTUTILS_UPSTREAM_PEP517} == standalone ]]; then
+ return
+ fi
+
# verify that the ebuild correctly specifies the build backend
local expected_backend=$(
_distutils-r1_key_to_backend \
@@ -1189,8 +1214,6 @@ _distutils-r1_get_backend() {
> "${T}"/.distutils_deprecated_backend_warned || die
fi
fi
-
- echo "$(_distutils-r1_key_to_backend "${DISTUTILS_USE_PEP517}")"
}
# @FUNCTION: distutils_wheel_install
@@ -1662,7 +1685,7 @@ distutils-r1_python_install() {
# let's explicitly verify these assumptions
# remove files that we've created explicitly
- rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python,pyvenv.cfg} || die
+ rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python,../pyvenv.cfg} || die
# Automagically do the QA check to avoid issues when bootstrapping
# prefix.
@@ -2030,9 +2053,11 @@ _distutils-r1_post_python_compile() {
ln -s "${PYTHON}" "${bindir}/${EPYTHON}" || die
ln -s "${EPYTHON}" "${bindir}/python3" || die
ln -s "${EPYTHON}" "${bindir}/python" || die
- # python3.14t seems to require "home" being present
- # (though it does not seem to care about the actual value)
- cat > "${bindir}"/pyvenv.cfg <<-EOF || die
+ # python3.14 changed venv logic so that:
+ # 1) pyvenv.cfg location explicitly determines prefix
+ # (i.e. we no longer can be put in bin/)
+ # 2) "home =" key must be present
+ cat > "${bindir}"/../pyvenv.cfg <<-EOF || die
home = ${EPREFIX}/usr/bin
include-system-site-packages = true
EOF