From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1609977-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 1CA72158041
	for <garchives@archives.gentoo.org>; Tue, 12 Mar 2024 05:13:09 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 9FE66E2A12;
	Tue, 12 Mar 2024 05:13:05 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 85E7BE2A13
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Mar 2024 05:13:05 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 617E0343003
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Mar 2024 05:13:04 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 88A981523
	for <gentoo-commits@lists.gentoo.org>; Tue, 12 Mar 2024 05:13:01 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1710220084.920edc504064fa38caa462b4d378114599f65925.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
X-VCS-Repository: repo/gentoo
X-VCS-Files: eclass/distutils-r1.eclass
X-VCS-Directories: eclass/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 920edc504064fa38caa462b4d378114599f65925
X-VCS-Branch: master
Date: Tue, 12 Mar 2024 05:13:01 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: d649d3ad-36be-4fb0-b0d5-cdd0d69affd8
X-Archives-Hash: b79d0d195382aa41d2b5a4de92c9998d

commit:     920edc504064fa38caa462b4d378114599f65925
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 10 13:51:03 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Mar 12 05:08:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=920edc50

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 <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/35695
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/distutils-r1.eclass | 42 +++++++++++++++++++-----------------------
 1 file 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