public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-python] [PATCH] Set env for best Python impl in *_all() phases.
Date: Sun,  2 Dec 2012 23:09:33 +0100	[thread overview]
Message-ID: <1354486173-23190-1-git-send-email-mgorny@gentoo.org> (raw)

---
 gx86/eclass/distutils-r1.eclass | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index b1b3f90..aea6ac6 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -375,8 +375,7 @@ distutils-r1_run_phase() {
 	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
 		pushd "${BUILD_DIR}" &>/dev/null || die
 	else
-		local PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
-		export PYTHONPATH
+		export PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
 	fi
 
 	if [[ ${DISTUTILS_NO_PARALLEL_BUILD} ]]; then
@@ -388,6 +387,22 @@ distutils-r1_run_phase() {
 	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
 		popd &>/dev/null || die
 	fi
+
+	# Store them for reuse.
+	_DISTUTILS_BEST_IMPL=(
+		"${EPYTHON}" "${PYTHON}" "${BUILD_DIR}"
+	)
+}
+
+# @FUNCTION: _distutils-r1_restore_best
+# @INTERNAL
+# @DESCRIPTION:
+# Restore the saved state for best implementation.
+_distutils-r1_restore_best() {
+	EPYTHON=${_DISTUTILS_BEST_IMPL[0]}
+	PYTHON=${_DISTUTILS_BEST_IMPL[1]}
+	BUILD_DIR=${_DISTUTILS_BEST_IMPL[2]}
+	# PYTHONPATH we declared non-local.
 }
 
 distutils-r1_src_prepare() {
@@ -419,6 +434,7 @@ distutils-r1_src_configure() {
 	multijob_finish
 
 	if declare -f python_configure_all >/dev/null; then
+		_distutils-r1_restore_best
 		python_configure_all
 	fi
 }
@@ -435,6 +451,7 @@ distutils-r1_src_compile() {
 	multijob_finish
 
 	if declare -f python_compile_all >/dev/null; then
+		_distutils-r1_restore_best
 		python_compile_all
 	fi
 }
@@ -451,6 +468,7 @@ distutils-r1_src_test() {
 	multijob_finish
 
 	if declare -f python_test_all >/dev/null; then
+		_distutils-r1_restore_best
 		python_test_all
 	fi
 }
@@ -466,6 +484,7 @@ distutils-r1_src_install() {
 	fi
 	multijob_finish
 
+	_distutils-r1_restore_best
 	if declare -f python_install_all >/dev/null; then
 		python_install_all
 	else
-- 
1.8.0



             reply	other threads:[~2012-12-02 22:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-02 22:09 Michał Górny [this message]
2012-12-03 10:22 ` [gentoo-python] [PATCH corrected] Set env for best Python impl in *_all() phases Michał Górny
2012-12-03 11:04 ` [gentoo-python] [PATCH] " Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354486173-23190-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    --cc=python@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox