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

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 5/8] python-r1: calculate final list of enabled impls for foreach.
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2013-02-27 21:43:22
Message-ID: 1362001405-25636-5-git-send-email-mgorny () gentoo ! org
[Download RAW message or body]

---
 gx86/eclass/python-r1.eclass | 61 +++++++++++++++++++++++++++-----------------
 1 file changed, 37 insertions(+), 24 deletions(-)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 310859e..a1d9228 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -586,6 +586,22 @@ _python_check_USE_PYTHON() {
 	fi
 }
 
+# @FUNCTION: _python_obtain_impls
+# @INTERNAL
+# @DESCRIPTION:
+# Set up the enabled implementation list.
+_python_obtain_impls() {
+	MULTIBUILD_VARIANTS=()
+
+	for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
+		if has "${impl}" "${PYTHON_COMPAT[@]}" \
+			&& use "python_targets_${impl}"
+		then
+			MULTIBUILD_VARIANTS+=( "${impl}" )
+		fi
+	done
+}
+
 # @FUNCTION: python_foreach_impl
 # @USAGE: <command> [<args>...]
 # @DESCRIPTION:
@@ -608,33 +624,30 @@ python_foreach_impl() {
 	local impl
 	local bdir=${BUILD_DIR:-${S}}
 	local ret=0 lret=0
+	local MULTIBUILD_VARIANTS
 
 	debug-print "${FUNCNAME}: bdir = ${bdir}"
-	for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
-		if has "${impl}" "${PYTHON_COMPAT[@]}" \
-			&& _python_impl_supported "${impl}" \
-			&& use "python_targets_${impl}"
-		then
-			local EPYTHON PYTHON
-			python_export "${impl}" EPYTHON PYTHON
-			local BUILD_DIR=${bdir%%/}-${impl}
-			export EPYTHON PYTHON
-
-			einfo "${EPYTHON}: running ${@}" \
-				| tee -a "${T}/build-${EPYTHON}.log"
-
-			# _python_parallel() does redirection internally.
-			# note: this is a hidden API to avoid writing python_foreach_impl
-			# twice. do *not* even think of using it anywhere else.
-			if [[ ${1} == _python_parallel ]]; then
-				"${@}"
-			else
-				"${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log"
-			fi
-			lret=${?}
-
-			[[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
+	_python_obtain_impls
+	for impl in "${MULTIBUILD_VARIANTS[@]}"; do
+		local EPYTHON PYTHON
+		python_export "${impl}" EPYTHON PYTHON
+		local BUILD_DIR=${bdir%%/}-${impl}
+		export EPYTHON PYTHON
+
+		einfo "${EPYTHON}: running ${@}" \
+			| tee -a "${T}/build-${EPYTHON}.log"
+
+		# _python_parallel() does redirection internally.
+		# note: this is a hidden API to avoid writing python_foreach_impl
+		# twice. do *not* even think of using it anywhere else.
+		if [[ ${1} == _python_parallel ]]; then
+			"${@}"
+		else
+			"${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log"
 		fi
+		lret=${?}
+
+		[[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
 	done
 
 	return ${ret}
-- 
1.8.1.4


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

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