public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
Cc: newlib@sourceware.org
Subject: Re: [PATCH 2/5] makedocbook: Use sys.exit()
Date: Sat, 5 Nov 2022 21:28:24 +0700	[thread overview]
Message-ID: <Y2ZzCE2C7dvDa7uN@vapier> (raw)
In-Reply-To: <76169a71-250e-dbf7-73ef-9f2842b61a03@foss.st.com>

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]

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(-)
> > 
> > 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):
> >   
> >       # FUNCTION implies starting a new refentry
> >       if refentry is not None:
> > -        print("multiple FUNCTIONs without NEWPAGE", file=sys.stderr)
> > -        exit(1)
> > +        sys.exit("multiple FUNCTIONs without NEWPAGE")
> >   
> >       # create the refentry
> >       refentry = lxml.etree.SubElement(rootelement, 'refentry')
> > @@ -308,17 +307,15 @@ def synopsis(c, t):
> >   
> >               # a prototype without a terminating ';' is an error
> >               if s.endswith(')'):
> > -                print("'%s' missing terminating semicolon" % l, file=sys.stderr)
> > +                sys.exit("'%s' missing terminating semicolon" % l)
> 
> I'm not sure when it was introduced in python, but you can use this syntax:
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-11-05 14:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 13:49 [PATCH 0/5] makedocbook improvements (v2) Jon Turney
2022-11-04 13:49 ` [PATCH 1/5] makedocbook: Use raw strings for regexes Jon Turney
2022-11-04 13:49 ` [PATCH 2/5] makedocbook: Use sys.exit() Jon Turney
2022-11-04 14:52   ` Torbjorn SVENSSON
2022-11-05 14:28     ` Mike Frysinger [this message]
2022-11-04 13:49 ` [PATCH 3/5] makedocbook: Drop stray semicolons Jon Turney
2022-11-04 13:49 ` [PATCH 4/5] makedocbook: Adjust inline whitespace to fix flake8 warnings Jon Turney
2022-11-04 13:49 ` [PATCH 5/5] makedocbook: Fix false report of unhandled texinfo command Jon Turney
2022-11-05 14:28 ` [PATCH 0/5] makedocbook improvements (v2) Mike Frysinger
2022-11-07  8:48   ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2ZzCE2C7dvDa7uN@vapier \
    --to=vapier@gentoo.org \
    --cc=newlib@sourceware.org \
    --cc=torbjorn.svensson@foss.st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).