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

Replies