On Sat, 15 Sep 2018 16:27:28 +0200 Michał Górny wrote: > 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. I also considered it but that would match /, which is no good. For example, it would replace python in /usr/python/foo. I am now working on a new approach to better accommodate my cross stuff that would supersede this anyway but it's not ready yet. > > any_fixed=1 > > else > > eerror "The file has incompatible shebang:" -- James Le Cuirot (chewi) Gentoo Linux Developer