Gentoo Archives: gentoo-python

From: Mike Gilbert <floppym@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-python <gentoo-python@l.g.o>, Gentoo Python Project <python@g.o>
Subject: [gentoo-python] Re: [PATCH 2/8] Clean up python_replicate_script().
Date: Sun, 15 Sep 2013 17:11:33
Message-Id: CAJ0EP40gOhwjZzSom1YBaX+5V-RZoKwyBL_PnuHJWZPmSV5SYw@mail.gmail.com
In Reply to: [gentoo-python] [PATCH 2/8] Clean up python_replicate_script(). by "Michał Górny"
1 On Fri, Sep 13, 2013 at 2:58 PM, Michał Górny <mgorny@g.o> wrote:
2 > ---
3 > gx86/eclass/python-r1.eclass | 30 ++++++++++++------------------
4 > 1 file changed, 12 insertions(+), 18 deletions(-)
5 >
6 > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
7 > index 6994952..e006744 100644
8 > --- a/gx86/eclass/python-r1.eclass
9 > +++ b/gx86/eclass/python-r1.eclass
10 > @@ -741,28 +741,22 @@ python_export_best() {
11 > python_replicate_script() {
12 > debug-print-function ${FUNCNAME} "${@}"
13 >
14 > - local suffixes=()
15 > -
16 > - _add_suffix() {
17 > - suffixes+=( "${EPYTHON}" )
18 > - }
19 > - python_foreach_impl _add_suffix
20 > - debug-print "${FUNCNAME}: suffixes = ( ${suffixes[@]} )"
21 > -
22 > - local f suffix
23 > - for suffix in "${suffixes[@]}"; do
24 > - for f; do
25 > - local newf=${f}-${suffix}
26 > -
27 > - debug-print "${FUNCNAME}: ${f} -> ${newf}"
28 > - cp "${f}" "${newf}" || die
29 > + _python_replicate_script() {
30 > + local f
31 > + for f in "${files[@]}"; do
32 > + cp -p "${f}" "${f}-${EPYTHON}" || die
33 > done
34 > + _python_rewrite_shebang "${EPYTHON}" \
35 > + "${files[@]/%/-${EPYTHON}}"
36 > + }
37 >
38 > - _python_rewrite_shebang "${suffix}" "${@/%/-${suffix}}"
39 > - done
40 > + local files=( "${@}" )
41 > + python_foreach_impl _python_replicate_script
42
43 Why are we creating a new array variable here? Why not just pass $@ to
44 _python_replicate script as arguments?
45
46 >
47 > + # install the wrappers
48 > + local f
49 > for f; do
50 > - _python_ln_rel "${ED}"/usr/bin/python-exec "${f}" || die
51 > + _python_ln_rel "${ED%/}"/usr/bin/python-exec "${f}" || die
52 > done
53 > }
54 >
55 > --
56 > 1.8.3.2
57 >

Replies