From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-dev+bounces-85976-garchives=archives.gentoo.org@lists.gentoo.org>
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 D5C6E138334
	for <garchives@archives.gentoo.org>; Sat, 15 Sep 2018 14:27:44 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 8E0EDE0AF4;
	Sat, 15 Sep 2018 14:27:40 +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 3A9EEE0AC4
	for <gentoo-dev@lists.gentoo.org>; Sat, 15 Sep 2018 14:27:40 +0000 (UTC)
Received: from pomiot (d202-252.icpnet.pl [109.173.202.252])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	(Authenticated sender: mgorny)
	by smtp.gentoo.org (Postfix) with ESMTPSA id E5225335CE7;
	Sat, 15 Sep 2018 14:27:37 +0000 (UTC)
Message-ID: <1537021648.30445.0.camel@gentoo.org>
Subject: Re: [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed
 call in python_fix_shebang
From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: python@gentoo.org, James Le Cuirot <chewi@gentoo.org>
Date: Sat, 15 Sep 2018 16:27:28 +0200
In-Reply-To: <20180914224438.29404-1-chewi@gentoo.org>
References: <20180914224438.29404-1-chewi@gentoo.org>
Organization: Gentoo
Content-Type: multipart/signed; micalg="pgp-sha512";
	protocol="application/pgp-signature"; boundary="=-txqq/G8aXu8aXRjypUm3"
X-Mailer: Evolution 3.26.6 
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@lists.gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
Mime-Version: 1.0
X-Archives-Salt: b0097fbe-0bd4-4fda-bdbc-f2d74b26401b
X-Archives-Hash: 30cf130240d05781a23a4a228c8b056e


--=-txqq/G8aXu8aXRjypUm3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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(-)
>=20
> diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclas=
s
> 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} =3D=3D *${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=3D1
>  			else
>  				eerror "The file has incompatible shebang:"

--=20
Best regards,
Micha=C5=82 G=C3=B3rny

--=-txqq/G8aXu8aXRjypUm3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iQKTBAABCgB9FiEEXr8g+Zb7PCLMb8pAur8dX/jIEQoFAludFtBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDVF
QkYyMEY5OTZGQjNDMjJDQzZGQ0E0MEJBQkYxRDVGRjhDODExMEEACgkQur8dX/jI
EQrk8A//XRwgnXb90ztYu9kGmDqZ3ta86PG2kGsCcGYmyi3qSY9Mwro+ZdnRWyD6
v6H+Zii8YJyi+mbYS8vpg5/NfafWnQcxwtMFb1Qgefqc7P8Dtz6ruMJE2O5JV8A0
07cnIr7f3GChIuDm6R+m1plcGsO+W54w3oXyc0RBjolRRWQKnMbwfOoQS0WqbocN
w0llC10oBtDNO6inJ5HiJg67yFF4D9cmGsOInXGkl+FlDDdGKkg7ljb/7uOwK6Fe
VuwTbPT/f2gFy6Dk1jxsXZnAaKrWnPLEkgycxVXTsQBZHxutTGBmIwGV4FKrwouY
fBww3htV37ZVbks9aykCLyDWAaEOWVMK0YrheKhFkRYsIMFDAhbDcPE1mmaH4mKo
tacTsfOhT0RXMAB4TUu4cDMu60mTqGcKgWbWWk9vyk54v15CGdB0iQNTBJ0YaAo1
x0cbPjN1Ut7fksiakyDd1DZL/VH08l8WXjO8PiHBJ3naPyNhwQFXksl80ROcDKKb
CjDZdgDb02Ttgc2/MdINlOisIRQ3dlIFdI5gxGvAju8mUf5wdpg4fsYPr93qYutN
g8FrWJQPAWzh/vrD5yhEDzTv6GOPpf/v3+biUeZqdS/66SSQyUKrTOU+uZwwiHJK
+bg4G1IfcNOsF0D+MQguzr510dXHAHHL0eRTEPhBpyAIS0w3Drs=
=Y3LX
-----END PGP SIGNATURE-----

--=-txqq/G8aXu8aXRjypUm3--