public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix invalid escape sequence in build-many-glibcs.py
@ 2024-01-09 21:23 Joseph Myers
  2024-01-10 10:39 ` Florian Weimer
  2024-01-10 15:18 ` H.J. Lu
  0 siblings, 2 replies; 4+ messages in thread
From: Joseph Myers @ 2024-01-09 21:23 UTC (permalink / raw)
  To: libc-alpha

Running build-many-glibcs.py with Python 3.12 or later produces a
warning:

build-many-glibcs.py:173: SyntaxWarning: invalid escape sequence '\.'
  m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)

Use a raw string instead to avoid that warning.  (Note: I haven't
checked whether any other Python scripts included with glibc might
have issues with newer Python versions.)

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 7e0b90be89..9a929a6430 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -170,7 +170,7 @@ class Context(object):
             if l.startswith(starttext):
                 l = l[len(starttext):]
                 l = l.rstrip('"\n')
-                m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)
+                m = re.fullmatch(r'([0-9]+)\.([0-9]+)[.0-9]*', l)
                 return '%s.%s' % m.group(1, 2)
         print('error: could not determine glibc version')
         exit(1)

-- 
Joseph S. Myers
josmyers@redhat.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix invalid escape sequence in build-many-glibcs.py
  2024-01-09 21:23 Fix invalid escape sequence in build-many-glibcs.py Joseph Myers
@ 2024-01-10 10:39 ` Florian Weimer
  2024-01-10 15:18 ` H.J. Lu
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2024-01-10 10:39 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

* Joseph Myers:

> Running build-many-glibcs.py with Python 3.12 or later produces a
> warning:
>
> build-many-glibcs.py:173: SyntaxWarning: invalid escape sequence '\.'
>   m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)
>
> Use a raw string instead to avoid that warning.  (Note: I haven't
> checked whether any other Python scripts included with glibc might
> have issues with newer Python versions.)
>
> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> index 7e0b90be89..9a929a6430 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -170,7 +170,7 @@ class Context(object):
>              if l.startswith(starttext):
>                  l = l[len(starttext):]
>                  l = l.rstrip('"\n')
> -                m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)
> +                m = re.fullmatch(r'([0-9]+)\.([0-9]+)[.0-9]*', l)
>                  return '%s.%s' % m.group(1, 2)
>          print('error: could not determine glibc version')
>          exit(1)

Looks good.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix invalid escape sequence in build-many-glibcs.py
  2024-01-09 21:23 Fix invalid escape sequence in build-many-glibcs.py Joseph Myers
  2024-01-10 10:39 ` Florian Weimer
@ 2024-01-10 15:18 ` H.J. Lu
  2024-01-10 15:23   ` H.J. Lu
  1 sibling, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2024-01-10 15:18 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

On Tue, Jan 9, 2024 at 1:24 PM Joseph Myers <josmyers@redhat.com> wrote:
>
> Running build-many-glibcs.py with Python 3.12 or later produces a
> warning:
>
> build-many-glibcs.py:173: SyntaxWarning: invalid escape sequence '\.'
>   m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)
>
> Use a raw string instead to avoid that warning.  (Note: I haven't
> checked whether any other Python scripts included with glibc might
> have issues with newer Python versions.)

I also got:

/glibc/scripts/build-many-glibcs.py:
570: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled
for removal in a future version. Use timezone-aware objects to represent datetim
es in UTC: datetime.datetime.now(datetime.UTC).
  build_time = datetime.datetime.utcnow()

Should it also be fixed?

> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> index 7e0b90be89..9a929a6430 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -170,7 +170,7 @@ class Context(object):
>              if l.startswith(starttext):
>                  l = l[len(starttext):]
>                  l = l.rstrip('"\n')
> -                m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)
> +                m = re.fullmatch(r'([0-9]+)\.([0-9]+)[.0-9]*', l)
>                  return '%s.%s' % m.group(1, 2)
>          print('error: could not determine glibc version')
>          exit(1)
>
> --
> Joseph S. Myers
> josmyers@redhat.com
>


-- 
H.J.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix invalid escape sequence in build-many-glibcs.py
  2024-01-10 15:18 ` H.J. Lu
@ 2024-01-10 15:23   ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2024-01-10 15:23 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

On Wed, Jan 10, 2024 at 7:18 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Tue, Jan 9, 2024 at 1:24 PM Joseph Myers <josmyers@redhat.com> wrote:
> >
> > Running build-many-glibcs.py with Python 3.12 or later produces a
> > warning:
> >
> > build-many-glibcs.py:173: SyntaxWarning: invalid escape sequence '\.'
> >   m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)
> >
> > Use a raw string instead to avoid that warning.  (Note: I haven't
> > checked whether any other Python scripts included with glibc might
> > have issues with newer Python versions.)
>
> I also got:
>
> /glibc/scripts/build-many-glibcs.py:
> 570: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled
> for removal in a future version. Use timezone-aware objects to represent datetim
> es in UTC: datetime.datetime.now(datetime.UTC).
>   build_time = datetime.datetime.utcnow()
>
> Should it also be fixed?

I saw it has been fixed now.

> > diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
> > index 7e0b90be89..9a929a6430 100755
> > --- a/scripts/build-many-glibcs.py
> > +++ b/scripts/build-many-glibcs.py
> > @@ -170,7 +170,7 @@ class Context(object):
> >              if l.startswith(starttext):
> >                  l = l[len(starttext):]
> >                  l = l.rstrip('"\n')
> > -                m = re.fullmatch('([0-9]+)\.([0-9]+)[.0-9]*', l)
> > +                m = re.fullmatch(r'([0-9]+)\.([0-9]+)[.0-9]*', l)
> >                  return '%s.%s' % m.group(1, 2)
> >          print('error: could not determine glibc version')
> >          exit(1)
> >
> > --
> > Joseph S. Myers
> > josmyers@redhat.com
> >
>
>
> --
> H.J.



-- 
H.J.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-10 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 21:23 Fix invalid escape sequence in build-many-glibcs.py Joseph Myers
2024-01-10 10:39 ` Florian Weimer
2024-01-10 15:18 ` H.J. Lu
2024-01-10 15:23   ` H.J. Lu

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).