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] Introduce run_in_build_dir() as requested in a few ebuilds.
Date: Sat, 26 Jan 2013 15:43:35
Message-Id: CAJ0EP43BN87tzSggswnwfDg8caxyEwKD1qP9KOJWvoMy3vuaAg@mail.gmail.com
In Reply to: [gentoo-python] [PATCH] Introduce run_in_build_dir() as requested in a few ebuilds. by "Michał Górny"
1 On Sat, Jan 26, 2013 at 6:28 AM, Michał Górny <mgorny@g.o> wrote:
2 > As people wanted to make a horrible monster out of this if added
3 > to eutils, just add it here.
4 > ---
5 > gx86/eclass/python-r1.eclass | 19 +++++++++++++++++++
6 > 1 file changed, 19 insertions(+)
7 >
8 > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
9 > index 63dc556..27653af 100644
10 > --- a/gx86/eclass/python-r1.eclass
11 > +++ b/gx86/eclass/python-r1.eclass
12 > @@ -681,5 +681,24 @@ python_replicate_script() {
13 > done
14 > }
15 >
16 > +# @FUNCTION: run_in_build_dir
17 > +# @USAGE: <argv>...
18 > +# @DESCRIPTION:
19 > +# Run the given command in the directory pointed by BUILD_DIR.
20 > +run_in_build_dir() {
21 > + debug-print-function ${FUNCNAME} "${@}"
22 > + local ret
23 > +
24 > + [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified."
25 > + [[ ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set."
26 > +
27 > + pushd "${BUILD_DIR}" &>/dev/null || die
28 > + "${@}"
29 > + ret=${?}
30 > + popd &>/dev/null || die
31 > +
32 > + return ${ret}
33 > +}
34 > +
35 > _PYTHON_R1=1
36 > fi
37 > --
38 > 1.8.1.1
39 >
40
41 Maybe this should be prefixed with "python_" so as not to clobber the
42 same function which may be added to some other eclass?

Replies