summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-03-10 14:51:03 +0100
committerMichał Górny <mgorny@gentoo.org>2024-03-12 06:08:04 +0100
commit920edc504064fa38caa462b4d378114599f65925 (patch)
treefeba620b50be3130af65b10723fc8b4393d9ad62 /eclass
parentdev-python/requests-oauthlib: Bump to 1.4.0 (diff)
downloadgentoo-920edc504064fa38caa462b4d378114599f65925.tar.gz
gentoo-920edc504064fa38caa462b4d378114599f65925.tar.bz2
gentoo-920edc504064fa38caa462b4d378114599f65925.zip
distutils-r1.eclass: Set setuptools build config for all backends
Create the build config and set DIST_EXTRA_CONFIG independently of the PEP517 backend used (but only in PEP517 mode). This ensures that our build directory (and parallel build) is respected when backend values other than `setuptools` are used, particularly standalone build in dev-python/setuptools, custom backends wrapping setuptools and other PEP517 that might use setuptools internally. As an immediate benefit, this stops new versions of dev-python/setuptools from installing their `build` tree into site-packages. Thanks to Eli Schwartz for noticing this and bringing to our attention. Signed-off-by: Michał Górny <mgorny@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/35695 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass42
1 files changed, 19 insertions, 23 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e0c54d81a846..9be994595529 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1505,32 +1505,28 @@ distutils-r1_python_compile() {
_python_check_EPYTHON
- case ${DISTUTILS_USE_PEP517:-setuptools} in
- setuptools)
- # call setup.py build when using setuptools (either via PEP517
- # or in legacy mode)
-
- # distutils is parallel-capable since py3.5
- local jobs=$(makeopts_jobs "${MAKEOPTS} ${*}")
-
- if [[ ${DISTUTILS_USE_PEP517} ]]; then
- 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
-
- [build_ext]
- parallel = ${jobs}
- EOF
- else
- _distutils-r1_copy_egg_info
- esetup.py build -j "${jobs}" "${@}"
- fi
- ;;
+ case ${DISTUTILS_USE_PEP517:-unset} in
no)
return
;;
+ unset)
+ # legacy mode
+ _distutils-r1_copy_egg_info
+ esetup.py build -j "$(makeopts_jobs "${MAKEOPTS} ${*}")" "${@}"
+ ;;
+ *)
+ # we do this for all build systems, since other backends
+ # and custom hooks may wrap setuptools
+ 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
+
+ [build_ext]
+ parallel = $(makeopts_jobs "${MAKEOPTS} ${*}")
+ EOF
+ ;;
esac
if [[ ${DISTUTILS_USE_PEP517} ]]; then