From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 58C12138334 for ; Fri, 14 Sep 2018 22:44:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 82BCCE0A53; Fri, 14 Sep 2018 22:44:51 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3244EE09E6 for ; Fri, 14 Sep 2018 22:44:50 +0000 (UTC) Received: from symphony.aura-online.co.uk (154.189.187.81.in-addr.arpa [81.187.189.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: chewi) by smtp.gentoo.org (Postfix) with ESMTPSA id 83219335CF3; Fri, 14 Sep 2018 22:44:48 +0000 (UTC) From: James Le Cuirot To: gentoo-dev@lists.gentoo.org Cc: python@gentoo.org, James Le Cuirot 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 Message-Id: <20180914224438.29404-1-chewi@gentoo.org> X-Mailer: git-send-email 2.18.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 6aef7a4a-1044-4230-8b5e-2d34580a9367 X-Archives-Hash: e733702b0b8604ea7fdc2d34df84d0b2 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