On Fri, 2018-09-14 at 23:44 +0100, James Le Cuirot wrote:
> There's no need for two separate sed calls here.
> ---
>  eclass/python-utils-r1.eclass | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
> index e3cf82b4b58f..121f2382ba78 100644
> --- a/eclass/python-utils-r1.eclass
> +++ b/eclass/python-utils-r1.eclass
> @@ -1247,11 +1247,7 @@ python_fix_shebang() {
>                       if [[ ! ${error} ]]; then
>                               # We either want to match ${from} followed by 
> space
>                               # or at end-of-string.
> -                             if [[ ${shebang} == *${from}" "* ]]; then
> -                                     sed -i -e "1s:${from} :${EPYTHON} :" 
> "${f}" || die
> -                             else
> -                                     sed -i -e "1s:${from}$:${EPYTHON}:" 
> "${f}" || die
> -                             fi
> +                             sed -i -e "1s:${from}\( \|\$\):${EPYTHON}\1:" 
> "${f}" || die

Hmm, I wonder if we could just utilize '\b' here.

>                               any_fixed=1
>                       else
>                               eerror "The file has incompatible shebang:"

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to