public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call in python_fix_shebang
@ 2018-09-14 22:44 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 ` [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call " Michał Górny
  0 siblings, 2 replies; 4+ messages in thread
From: James Le Cuirot @ 2018-09-14 22:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: python, James Le Cuirot

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-15 21:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call " Michał Górny
2018-09-15 21:51   ` James Le Cuirot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox