public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: James Le Cuirot <chewi@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: python@gentoo.org, James Le Cuirot <chewi@gentoo.org>
Subject: [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call in python_fix_shebang
Date: Fri, 14 Sep 2018 23:44:37 +0100	[thread overview]
Message-ID: <20180914224438.29404-1-chewi@gentoo.org> (raw)

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
 				any_fixed=1
 			else
 				eerror "The file has incompatible shebang:"
-- 
2.18.0



             reply	other threads:[~2018-09-14 22:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 22:44 James Le Cuirot [this message]
2018-09-14 22:44 ` [gentoo-dev] [PATCH 2/2] python-utils-r1.eclass: Fix all correct check in python_fix_shebang James Le Cuirot
2018-09-15 14:27 ` [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call " Michał Górny
2018-09-15 21:51   ` 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=20180914224438.29404-1-chewi@gentoo.org \
    --to=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