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 1566E138334 for ; Sat, 15 Sep 2018 21:52:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 75D71E0C38; Sat, 15 Sep 2018 21:51:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 21947E0B11 for ; Sat, 15 Sep 2018 21:51:55 +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 0C89B335CE4 for ; Sat, 15 Sep 2018 21:51:50 +0000 (UTC) Date: Sat, 15 Sep 2018 22:51:28 +0100 From: James Le Cuirot To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Simplify sed call in python_fix_shebang Message-ID: <20180915225128.5e560b81@symphony.aura-online.co.uk> In-Reply-To: <1537021648.30445.0.camel@gentoo.org> References: <20180914224438.29404-1-chewi@gentoo.org> <1537021648.30445.0.camel@gentoo.org> X-Mailer: Claws Mail 3.17.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) 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 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/TlAbSfNobUmGMQ/35H/ctzS"; protocol="application/pgp-signature" X-Archives-Salt: 6bc6950d-cfdb-4b50-8dce-b235e358a819 X-Archives-Hash: f23c033c3d140bd8518a402856b838eb --Sig_/TlAbSfNobUmGMQ/35H/ctzS Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, 15 Sep 2018 16:27:28 +0200 Micha=C5=82 G=C3=B3rny wrote: > 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.ecl= ass > > 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 =20 >=20 > Hmm, I wonder if we could just utilize '\b' here. I also considered it but that would match /, which is no good. For example, it would replace python in /usr/python/foo. I am now working on a new approach to better accommodate my cross stuff that would supersede this anyway but it's not ready yet. > > any_fixed=3D1 > > else > > eerror "The file has incompatible shebang:" =20 --=20 James Le Cuirot (chewi) Gentoo Linux Developer --Sig_/TlAbSfNobUmGMQ/35H/ctzS Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQKTBAEBCgB9FiEEUo3mvYaRpDkf2i7UIcYyEpxtfeQFAludfuBfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDUy OERFNkJEODY5MUE0MzkxRkRBMkVENDIxQzYzMjEyOUM2RDdERTQACgkQIcYyEpxt feS3cw/+KO4860X4mQ+L7zGJrlL3Csk4p+6/ElYpC/P+v+xqeCzkUXODqe72ig6Q gn/n/ItX5BzNLp6SJJ4T686zmLK3EqMSCPns8SYNtXWXbcaCAN+DTAmoo1bZY/cr mkRYWsyB7s4jioRE7oBXwN+FYvD+H4UieopMay4g9JiMJ/YpdT+GMjxgvBDza8pm XXo+9i5qozq8wGKhOs85aAEO2a208TxLbMaCHcqavRkLQTGIjBaV+x0jFHfYU0+b +ZuFDDjCSEPKlDqKSK4zCNSweSJ+8SecTC6ughtQa2LTFiuql83W3TYSlYYbl8pB 3H1hBJR5BSUS2ppu086zhV4X8M7eZbFUQjxc62DvmQ2VvZeW71bokjHbsBQKhihX E5tCOyUv2VREGNVVQe0V3ebKLCMTZf8ATEBL1TJ0qgKFRfJVYizH1unEAgYzamEF QemYQn5Ns+QE5m3phYhen28Hk5ZBq0A/0LByZRxfimtX9ehgAGYA5mtw/aH/xDDH TN73XDKecIN6qrVYl9vNg4knNG3jWQ9NrXFEnhdtVEaNpeICtepWVenBRCsiO7lL u7wJTw8cXeDdOZlITA+CrwBnt+wLGlt5S0ay5KcD+dszchBLKel+G+4NJSdkowRL hNE8wsC373LYGUHvWARkBMGVWZjoV7XZ0JBw2BOeFXI1ia0ZemI= =XmyN -----END PGP SIGNATURE----- --Sig_/TlAbSfNobUmGMQ/35H/ctzS--