From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id E0C663858C54 for ; Sat, 5 Nov 2022 14:28:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0C663858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 4414B34109F; Sat, 5 Nov 2022 14:28:26 +0000 (UTC) Date: Sat, 5 Nov 2022 21:28:24 +0700 From: Mike Frysinger To: Torbjorn SVENSSON Cc: newlib@sourceware.org Subject: Re: [PATCH 2/5] makedocbook: Use sys.exit() Message-ID: Mail-Followup-To: Torbjorn SVENSSON , newlib@sourceware.org References: <20221104134946.13443-1-jon.turney@dronecode.org.uk> <20221104134946.13443-3-jon.turney@dronecode.org.uk> <76169a71-250e-dbf7-73ef-9f2842b61a03@foss.st.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Yl51s6hlO4V6axu7" Content-Disposition: inline In-Reply-To: <76169a71-250e-dbf7-73ef-9f2842b61a03@foss.st.com> X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Yl51s6hlO4V6axu7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 04 Nov 2022 15:52, Torbjorn SVENSSON wrote: > On 2022-11-04 14:49, Jon Turney wrote: > > Use sys.exit() to write a message to stderr and terminate with a > > non-zero exit code. > > --- > > newlib/doc/makedocbook.py | 16 ++++++---------- > > 1 file changed, 6 insertions(+), 10 deletions(-) > >=20 > > diff --git a/newlib/doc/makedocbook.py b/newlib/doc/makedocbook.py > > index 5e46082df..57cd23bfd 100755 > > --- a/newlib/doc/makedocbook.py > > +++ b/newlib/doc/makedocbook.py > > @@ -214,8 +214,7 @@ def function(c, l): > > =20 > > # FUNCTION implies starting a new refentry > > if refentry is not None: > > - print("multiple FUNCTIONs without NEWPAGE", file=3Dsys.stderr) > > - exit(1) > > + sys.exit("multiple FUNCTIONs without NEWPAGE") > > =20 > > # create the refentry > > refentry =3D lxml.etree.SubElement(rootelement, 'refentry') > > @@ -308,17 +307,15 @@ def synopsis(c, t): > > =20 > > # a prototype without a terminating ';' is an error > > if s.endswith(')'): > > - print("'%s' missing terminating semicolon" % l, file= =3Dsys.stderr) > > + sys.exit("'%s' missing terminating semicolon" % l) >=20 > I'm not sure when it was introduced in python, but you can use this synta= x: > sys.exit(f"'{l}' missing terminating semicolon") f-strings are new to Python 3.6. i don't know what version we want to require when building from git (non-releases). other GNU toolchain projects seem to be OK with requiring newer versions like 3.6. -mike --Yl51s6hlO4V6axu7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNmcwgACgkQQWM7n+g3 9YGLTQ//YgZ0Su6OZ66sJq+L4Kp1+4N3qal4AIjR6BqGtSuF9OW5pTaahqQCCWAh s55IoxnzrH4bF9VYmeyoS4jO+CcJD9ZuwBBamKFo44vCRXJPmDtT2gQ5nn0LyUnR M9UZIkfmQ6BwkIRLfhTfpnnghuDFTzsbkoWH+MVfVyGFER8d1E/RJ8o2ubYdacub vvPR4SW2Fx8wHCrNek841Tffix1ZPK242G59+HtzvOqP3tW8wWDWbJ+8qPOidQcg UkAjAbEGLaiqTp1kXRzPLsjsL+PnesZ9O+1Khg2ybPl1IEqyF0eve1AF2hUyM+pA aRUSETc1mbNRPRHgphQ3WdBDtvIt5lcuLywi4tRHmDM1fNp8MvYtFjKpEALS+BzJ XbUza2i3YG8+sBxD9dx/9qrqn0KNAv/WcO/8kT98CMJ7ygShLGpt5Rz2ZvYshWP3 CvMNN0CnJZGo+GQ3ZfQECax7PfKo+5U2CJDKkZkRb8ql7EELi8s7j2459KLlLTQi qGYbHWCc0vf7ps2CYQRFnWSHBApqRIb7iR+VGhFOv5gi234YzJ7/Rqnln9+GrZSp aTJ7nbc95s+wv3wyQy5cfNhyTQlRaZD9M4qU/d75IzKyz6DitRfs6/OvgC9iH/9J P7UJy8gRAX/aztEj5mVNIGbBvVNdw/TvaU359TPhJni2i3XH0XA= =xUBi -----END PGP SIGNATURE----- --Yl51s6hlO4V6axu7--