From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: python@gentoo.org, James Le Cuirot <chewi@gentoo.org>
Subject: Re: [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call in python_fix_shebang
Date: Sat, 15 Sep 2018 16:27:28 +0200 [thread overview]
Message-ID: <1537021648.30445.0.camel@gentoo.org> (raw)
In-Reply-To: <20180914224438.29404-1-chewi@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]
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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 963 bytes --]
next prev parent reply other threads:[~2018-09-15 14:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-14 22:44 [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call in python_fix_shebang James Le Cuirot
2018-09-14 22:44 ` [gentoo-dev] [PATCH 2/2] python-utils-r1.eclass: Fix all correct check " James Le Cuirot
2018-09-15 14:27 ` Michał Górny [this message]
2018-09-15 21:51 ` [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call " James Le Cuirot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1537021648.30445.0.camel@gentoo.org \
--to=mgorny@gentoo.org \
--cc=chewi@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=python@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox