Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: Mike Gilbert <floppym@g.o>
Cc: gentoo-python <gentoo-python@l.g.o>, Gentoo Python Project <python@g.o>
Subject: Re: [gentoo-python] Re: [PATCH 2/8] Clean up python_replicate_script().
Date: Sun, 15 Sep 2013 17:37:16
Message-Id: 20130915193602.14410f76@gentoo.org
In Reply to: [gentoo-python] Re: [PATCH 2/8] Clean up python_replicate_script(). by Mike Gilbert
1 Dnia 2013-09-15, o godz. 13:11:21
2 Mike Gilbert <floppym@g.o> napisał(a):
3
4 > On Fri, Sep 13, 2013 at 2:58 PM, Michał Górny <mgorny@g.o> wrote:
5 > > ---
6 > > gx86/eclass/python-r1.eclass | 30 ++++++++++++------------------
7 > > 1 file changed, 12 insertions(+), 18 deletions(-)
8 > >
9 > > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
10 > > index 6994952..e006744 100644
11 > > --- a/gx86/eclass/python-r1.eclass
12 > > +++ b/gx86/eclass/python-r1.eclass
13 > > @@ -741,28 +741,22 @@ python_export_best() {
14 > > python_replicate_script() {
15 > > debug-print-function ${FUNCNAME} "${@}"
16 > >
17 > > - local suffixes=()
18 > > -
19 > > - _add_suffix() {
20 > > - suffixes+=( "${EPYTHON}" )
21 > > - }
22 > > - python_foreach_impl _add_suffix
23 > > - debug-print "${FUNCNAME}: suffixes = ( ${suffixes[@]} )"
24 > > -
25 > > - local f suffix
26 > > - for suffix in "${suffixes[@]}"; do
27 > > - for f; do
28 > > - local newf=${f}-${suffix}
29 > > -
30 > > - debug-print "${FUNCNAME}: ${f} -> ${newf}"
31 > > - cp "${f}" "${newf}" || die
32 > > + _python_replicate_script() {
33 > > + local f
34 > > + for f in "${files[@]}"; do
35 > > + cp -p "${f}" "${f}-${EPYTHON}" || die
36 > > done
37 > > + _python_rewrite_shebang "${EPYTHON}" \
38 > > + "${files[@]/%/-${EPYTHON}}"
39 > > + }
40 > >
41 > > - _python_rewrite_shebang "${suffix}" "${@/%/-${suffix}}"
42 > > - done
43 > > + local files=( "${@}" )
44 > > + python_foreach_impl _python_replicate_script
45 >
46 > Why are we creating a new array variable here? Why not just pass $@ to
47 > _python_replicate script as arguments?
48
49 It's because python_foreach_impl likes to verbose and prints "${@}"
50 starting with first non-underline arg. Passing files out-of-argv
51 is the simplest way of avoiding verbose output.
52
53
54 --
55 Best regards,
56 Michał Górny

Attachments

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