Fix invalid escape sequence in build-many-glibcs.py
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Testing passed
|
Commit Message
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.)
Comments
* 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
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
>
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.
@@ -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)