public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH] Set env for best Python impl in *_all() phases.
@ 2012-12-02 22:09 Michał Górny
  2012-12-03 10:22 ` [gentoo-python] [PATCH corrected] " Michał Górny
  2012-12-03 11:04 ` [gentoo-python] [PATCH] " Michał Górny
  0 siblings, 2 replies; 3+ messages in thread
From: Michał Górny @ 2012-12-02 22:09 UTC (permalink / raw
  To: gentoo-python; +Cc: python, Michał Górny

---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-python] [PATCH corrected] Set env for best Python impl in *_all() phases.
  2012-12-02 22:09 [gentoo-python] [PATCH] Set env for best Python impl in *_all() phases Michał Górny
@ 2012-12-03 10:22 ` Michał Górny
  2012-12-03 11:04 ` [gentoo-python] [PATCH] " Michał Górny
  1 sibling, 0 replies; 3+ messages in thread
From: Michał Górny @ 2012-12-03 10:22 UTC (permalink / raw
  To: gentoo-python; +Cc: python, Michał Górny

Export the best implementation's build dir as BEST_BUILD_DIR, in order
to avoid clobbering original BUILD_DIR.
---
 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..75378fc 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]}
+	BEST_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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [gentoo-python] [PATCH] Set env for best Python impl in *_all() phases.
  2012-12-02 22:09 [gentoo-python] [PATCH] Set env for best Python impl in *_all() phases Michał Górny
  2012-12-03 10:22 ` [gentoo-python] [PATCH corrected] " Michał Górny
@ 2012-12-03 11:04 ` Michał Górny
  1 sibling, 0 replies; 3+ messages in thread
From: Michał Górny @ 2012-12-03 11:04 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python, python

[-- Attachment #1: Type: text/plain, Size: 125 bytes --]

Please ignore this thread, a new and corrected patches were sent
in a following one.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-03 11:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-02 22:09 [gentoo-python] [PATCH] Set env for best Python impl in *_all() phases Michał Górny
2012-12-03 10:22 ` [gentoo-python] [PATCH corrected] " Michał Górny
2012-12-03 11:04 ` [gentoo-python] [PATCH] " Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox