[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 06/11] distutils-r1.eclass: Let gpep517 compile bytecode when 9+ is used
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2022-07-29 10:30:58
Message-ID: 20220729103103.1185162-7-mgorny () gentoo ! org
[Download RAW message or body]

Use the new --optimize option of gpep517 >= 9 when it is installed,
and remove the python_optimize call then.  This conditional logic is
meant to give some additional testing while gpep517-9 is still in ~arch.

Note that this also removes python_optimize call for "no" mode.
However, this mode is used only by a handful of ebuilds, so if any of
them needs an explicit python_optimize call, we can quickly fix them.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 495eead1d5fd..60f81473c0a6 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1270,13 +1270,25 @@ distutils_wheel_install() {
 	local wheel=${2}
 
 	einfo "  Installing ${wheel##*/} to ${root}"
-	local cmd=(
-		gpep517 install-wheel
-			--destdir="${root}"
-			--interpreter="${PYTHON}"
-			--prefix="${EPREFIX}/usr"
-			"${wheel}"
-	)
+	if has_version -b ">=dev-python/gpep517-9"; then
+		# TODO: inline when we dep on >=9
+		local cmd=(
+			gpep517 install-wheel
+				--destdir="${root}"
+				--interpreter="${PYTHON}"
+				--prefix="${EPREFIX}/usr"
+				--optimize=all
+				"${wheel}"
+		)
+	else
+		local cmd=(
+			gpep517 install-wheel
+				--destdir="${root}"
+				--interpreter="${PYTHON}"
+				--prefix="${EPREFIX}/usr"
+				"${wheel}"
+		)
+	fi
 	printf '%s\n' "${cmd[*]}"
 	"${cmd[@]}" || die "Wheel install failed"
 
@@ -1994,9 +2006,13 @@ _distutils-r1_post_python_install() {
 		done
 
 		if [[ ${DISTUTILS_USE_PEP517} ]]; then
-			# we need to recompile everything here in order to embed
-			# the correct paths
-			python_optimize "${sitedir}"
+			if ! has_version -b ">=dev-python/gpep517-9"
+			then
+				# TODO: remove when we dep on >=9
+				# we need to recompile everything here in order to embed
+				# the correct paths
+				python_optimize "${sitedir}"
+			fi
 		fi
 	fi
 }
-- 
2.35.1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic