1 |
On Sat, 15 Sep 2018 16:27:28 +0200 |
2 |
Michał Górny <mgorny@g.o> wrote: |
3 |
|
4 |
> On Fri, 2018-09-14 at 23:44 +0100, James Le Cuirot wrote: |
5 |
> > There's no need for two separate sed calls here. |
6 |
> > --- |
7 |
> > eclass/python-utils-r1.eclass | 6 +----- |
8 |
> > 1 file changed, 1 insertion(+), 5 deletions(-) |
9 |
> > |
10 |
> > diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
11 |
> > index e3cf82b4b58f..121f2382ba78 100644 |
12 |
> > --- a/eclass/python-utils-r1.eclass |
13 |
> > +++ b/eclass/python-utils-r1.eclass |
14 |
> > @@ -1247,11 +1247,7 @@ python_fix_shebang() { |
15 |
> > if [[ ! ${error} ]]; then |
16 |
> > # We either want to match ${from} followed by space |
17 |
> > # or at end-of-string. |
18 |
> > - if [[ ${shebang} == *${from}" "* ]]; then |
19 |
> > - sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die |
20 |
> > - else |
21 |
> > - sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die |
22 |
> > - fi |
23 |
> > + sed -i -e "1s:${from}\( \|\$\):${EPYTHON}\1:" "${f}" || die |
24 |
> |
25 |
> Hmm, I wonder if we could just utilize '\b' here. |
26 |
|
27 |
I also considered it but that would match /, which is no good. For |
28 |
example, it would replace python in /usr/python/foo. |
29 |
|
30 |
I am now working on a new approach to better accommodate my cross stuff |
31 |
that would supersede this anyway but it's not ready yet. |
32 |
|
33 |
> > any_fixed=1 |
34 |
> > else |
35 |
> > eerror "The file has incompatible shebang:" |
36 |
|
37 |
-- |
38 |
James Le Cuirot (chewi) |
39 |
Gentoo Linux Developer |