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 updated 1/3] Set env for best Python impl in *_all() phases.
Date: Mon, 03 Dec 2012 11:00:20
Message-Id: 1354532406-5591-1-git-send-email-mgorny@gentoo.org
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 | 31 ++++++++++++++++++++++++++-----
5 1 file changed, 26 insertions(+), 5 deletions(-)
6
7 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
8 index b1b3f90..db8fe86 100644
9 --- a/gx86/eclass/distutils-r1.eclass
10 +++ b/gx86/eclass/distutils-r1.eclass
11 @@ -388,6 +388,27 @@ distutils-r1_run_phase() {
12 if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
13 popd &>/dev/null || die
14 fi
15 +
16 + # Store them for reuse.
17 + _DISTUTILS_BEST_IMPL=(
18 + "${EPYTHON}" "${PYTHON}" "${BUILD_DIR}" "${PYTHONPATH}"
19 + )
20 +}
21 +
22 +# @FUNCTION: _distutils-r1_run_common_phase
23 +# @USAGE: [<argv>...]
24 +# @INTERNAL
25 +# @DESCRIPTION:
26 +# Run the given command, restoring the best-implementation state.
27 +_distutils-r1_run_common_phase() {
28 + local EPYTHON=${_DISTUTILS_BEST_IMPL[0]}
29 + local PYTHON=${_DISTUTILS_BEST_IMPL[1]}
30 + local BEST_BUILD_DIR=${_DISTUTILS_BEST_IMPL[2]}
31 + local PYTHONPATH=${_DISTUTILS_BEST_IMPL[3]}
32 +
33 + export EPYTHON PYTHON PYTHONPATH
34 +
35 + "${@}"
36 }
37
38 distutils-r1_src_prepare() {
39 @@ -419,7 +440,7 @@ distutils-r1_src_configure() {
40 multijob_finish
41
42 if declare -f python_configure_all >/dev/null; then
43 - python_configure_all
44 + _distutils-r1_run_common_phase python_configure_all
45 fi
46 }
47
48 @@ -435,7 +456,7 @@ distutils-r1_src_compile() {
49 multijob_finish
50
51 if declare -f python_compile_all >/dev/null; then
52 - python_compile_all
53 + _distutils-r1_run_common_phase python_compile_all
54 fi
55 }
56
57 @@ -451,7 +472,7 @@ distutils-r1_src_test() {
58 multijob_finish
59
60 if declare -f python_test_all >/dev/null; then
61 - python_test_all
62 + _distutils-r1_run_common_phase python_test_all
63 fi
64 }
65
66 @@ -467,9 +488,9 @@ distutils-r1_src_install() {
67 multijob_finish
68
69 if declare -f python_install_all >/dev/null; then
70 - python_install_all
71 + _distutils-r1_run_common_phase python_install_all
72 else
73 - distutils-r1_python_install_all
74 + _distutils-r1_run_common_phase distutils-r1_python_install_all
75 fi
76 }
77
78 --
79 1.8.0

Replies