Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH corrected] Set env for best Python impl in *_all() phases.
Date: Mon, 03 Dec 2012 10:22:20
Message-Id: 1354530128-11850-1-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] [PATCH] Set env for best Python impl in *_all() phases. by "Michał Górny"
1 Export the best implementation's build dir as BEST_BUILD_DIR, in order
2 to avoid clobbering original BUILD_DIR.
3 ---
4 gx86/eclass/distutils-r1.eclass | 23 +++++++++++++++++++++--
5 1 file changed, 21 insertions(+), 2 deletions(-)
6
7 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
8 index b1b3f90..75378fc 100644
9 --- a/gx86/eclass/distutils-r1.eclass
10 +++ b/gx86/eclass/distutils-r1.eclass
11 @@ -375,8 +375,7 @@ distutils-r1_run_phase() {
12 if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
13 pushd "${BUILD_DIR}" &>/dev/null || die
14 else
15 - local PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
16 - export PYTHONPATH
17 + export PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
18 fi
19
20 if [[ ${DISTUTILS_NO_PARALLEL_BUILD} ]]; then
21 @@ -388,6 +387,22 @@ distutils-r1_run_phase() {
22 if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
23 popd &>/dev/null || die
24 fi
25 +
26 + # Store them for reuse.
27 + _DISTUTILS_BEST_IMPL=(
28 + "${EPYTHON}" "${PYTHON}" "${BUILD_DIR}"
29 + )
30 +}
31 +
32 +# @FUNCTION: _distutils-r1_restore_best
33 +# @INTERNAL
34 +# @DESCRIPTION:
35 +# Restore the saved state for best implementation.
36 +_distutils-r1_restore_best() {
37 + EPYTHON=${_DISTUTILS_BEST_IMPL[0]}
38 + PYTHON=${_DISTUTILS_BEST_IMPL[1]}
39 + BEST_BUILD_DIR=${_DISTUTILS_BEST_IMPL[2]}
40 + # PYTHONPATH we declared non-local.
41 }
42
43 distutils-r1_src_prepare() {
44 @@ -419,6 +434,7 @@ distutils-r1_src_configure() {
45 multijob_finish
46
47 if declare -f python_configure_all >/dev/null; then
48 + _distutils-r1_restore_best
49 python_configure_all
50 fi
51 }
52 @@ -435,6 +451,7 @@ distutils-r1_src_compile() {
53 multijob_finish
54
55 if declare -f python_compile_all >/dev/null; then
56 + _distutils-r1_restore_best
57 python_compile_all
58 fi
59 }
60 @@ -451,6 +468,7 @@ distutils-r1_src_test() {
61 multijob_finish
62
63 if declare -f python_test_all >/dev/null; then
64 + _distutils-r1_restore_best
65 python_test_all
66 fi
67 }
68 @@ -466,6 +484,7 @@ distutils-r1_src_install() {
69 fi
70 multijob_finish
71
72 + _distutils-r1_restore_best
73 if declare -f python_install_all >/dev/null; then
74 python_install_all
75 else
76 --
77 1.8.0