1 |
On Fri, 2018-09-14 at 23:44 +0100, James Le Cuirot wrote: |
2 |
> There's no need for two separate sed calls here. |
3 |
> --- |
4 |
> eclass/python-utils-r1.eclass | 6 +----- |
5 |
> 1 file changed, 1 insertion(+), 5 deletions(-) |
6 |
> |
7 |
> diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
8 |
> index e3cf82b4b58f..121f2382ba78 100644 |
9 |
> --- a/eclass/python-utils-r1.eclass |
10 |
> +++ b/eclass/python-utils-r1.eclass |
11 |
> @@ -1247,11 +1247,7 @@ python_fix_shebang() { |
12 |
> if [[ ! ${error} ]]; then |
13 |
> # We either want to match ${from} followed by space |
14 |
> # or at end-of-string. |
15 |
> - if [[ ${shebang} == *${from}" "* ]]; then |
16 |
> - sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die |
17 |
> - else |
18 |
> - sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die |
19 |
> - fi |
20 |
> + sed -i -e "1s:${from}\( \|\$\):${EPYTHON}\1:" "${f}" || die |
21 |
|
22 |
Hmm, I wonder if we could just utilize '\b' here. |
23 |
|
24 |
> any_fixed=1 |
25 |
> else |
26 |
> eerror "The file has incompatible shebang:" |
27 |
|
28 |
-- |
29 |
Best regards, |
30 |
Michał Górny |