Gentoo Archives: gentoo-python

From: Mike Gilbert <floppym@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-python@l.g.o, python@g.o
Subject: [gentoo-python] Re: [PATCH updated 1/3] Set env for best Python impl in *_all() phases.
Date: Mon, 03 Dec 2012 15:46:57
Message-Id: 50BCC962.4080100@gentoo.org
In Reply to: [gentoo-python] [PATCH updated 1/3] Set env for best Python impl in *_all() phases. by "Michał Górny"
1 On 12/3/2012 6:00 AM, Michał Górny wrote:
2 > Export the best implementation's build dir as BEST_BUILD_DIR, in order
3 > to avoid clobbering original BUILD_DIR.
4 > ---
5 > gx86/eclass/distutils-r1.eclass | 31 ++++++++++++++++++++++++++-----
6 > 1 file changed, 26 insertions(+), 5 deletions(-)
7 >
8 > diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
9 > index b1b3f90..db8fe86 100644
10 > --- a/gx86/eclass/distutils-r1.eclass
11 > +++ b/gx86/eclass/distutils-r1.eclass
12 > @@ -388,6 +388,27 @@ distutils-r1_run_phase() {
13 > if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
14 > popd &>/dev/null || die
15 > fi
16 > +
17 > + # Store them for reuse.
18 > + _DISTUTILS_BEST_IMPL=(
19 > + "${EPYTHON}" "${PYTHON}" "${BUILD_DIR}" "${PYTHONPATH}"
20 > + )
21
22 Why are you using an array here? To save 1 line of code?
23
24 Putting the values in an array makes them anonymous for no reason I can see.
25
26 > +}
27 > +
28 > +# @FUNCTION: _distutils-r1_run_common_phase
29 > +# @USAGE: [<argv>...]
30 > +# @INTERNAL
31 > +# @DESCRIPTION:
32 > +# Run the given command, restoring the best-implementation state.
33 > +_distutils-r1_run_common_phase() {
34 > + local EPYTHON=${_DISTUTILS_BEST_IMPL[0]}
35 > + local PYTHON=${_DISTUTILS_BEST_IMPL[1]}
36 > + local BEST_BUILD_DIR=${_DISTUTILS_BEST_IMPL[2]}
37 > + local PYTHONPATH=${_DISTUTILS_BEST_IMPL[3]}
38 > +
39 > + export EPYTHON PYTHON PYTHONPATH
40 > +
41 > + "${@}"
42 > }
43 >
44 > distutils-r1_src_prepare() {
45 > @@ -419,7 +440,7 @@ distutils-r1_src_configure() {
46 > multijob_finish
47 >
48 > if declare -f python_configure_all >/dev/null; then
49 > - python_configure_all
50 > + _distutils-r1_run_common_phase python_configure_all
51 > fi
52 > }
53 >
54 > @@ -435,7 +456,7 @@ distutils-r1_src_compile() {
55 > multijob_finish
56 >
57 > if declare -f python_compile_all >/dev/null; then
58 > - python_compile_all
59 > + _distutils-r1_run_common_phase python_compile_all
60 > fi
61 > }
62 >
63 > @@ -451,7 +472,7 @@ distutils-r1_src_test() {
64 > multijob_finish
65 >
66 > if declare -f python_test_all >/dev/null; then
67 > - python_test_all
68 > + _distutils-r1_run_common_phase python_test_all
69 > fi
70 > }
71 >
72 > @@ -467,9 +488,9 @@ distutils-r1_src_install() {
73 > multijob_finish
74 >
75 > if declare -f python_install_all >/dev/null; then
76 > - python_install_all
77 > + _distutils-r1_run_common_phase python_install_all
78 > else
79 > - distutils-r1_python_install_all
80 > + _distutils-r1_run_common_phase distutils-r1_python_install_all
81 > fi
82 > }
83 >
84
85 I haven't run into a situation that patch series is intended to address,
86 so I don't have any strong opinion on it. If you think it is useful,
87 fine by me.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies