Message ID | 20240220135248.1277809-1-trini@konsulko.com |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
Series | pylibfdt: Fix "invalid escape sequence '\w'" in setup.py | expand |
On 2/20/24 14:52, Tom Rini wrote: > From: Florian Schmaus <flo@geekplace.eu> > > Once u-boot's build system invokes > > python3 scripts/dtc/pylibfdt/setup.py --quiet build_ext --inplace > > it may fail with > > scripts/dtc/pylibfdt/setup.py:40: SyntaxWarning: invalid escape sequence '\w' > RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$') > > depending on the used Python version. > > Explicitly mark the regex string as raw string to avoid the warning. > > Signed-off-by: Florian Schmaus <flo@geekplace.eu> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > --- > scripts/dtc/pylibfdt/setup.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/dtc/pylibfdt/setup.py b/scripts/dtc/pylibfdt/setup.py > index 8baae08770ca..c6fe5a6a446f 100755 > --- a/scripts/dtc/pylibfdt/setup.py > +++ b/scripts/dtc/pylibfdt/setup.py > @@ -37,7 +37,7 @@ > long_description = fh.read() > > # Decodes a Makefile assignment line into key and value (and plus for +=) > -RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$') > +RE_KEY_VALUE = re.compile(r'(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$') > > def get_top_builddir(): > if '--top-builddir' in sys.argv:
On Tue, Feb 20, 2024 at 08:52:48AM -0500, Tom Rini wrote: > From: Florian Schmaus <flo@geekplace.eu> > > Once u-boot's build system invokes > > python3 scripts/dtc/pylibfdt/setup.py --quiet build_ext --inplace > > it may fail with > > scripts/dtc/pylibfdt/setup.py:40: SyntaxWarning: invalid escape sequence '\w' > RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$') > > depending on the used Python version. > > Explicitly mark the regex string as raw string to avoid the warning. > > Signed-off-by: Florian Schmaus <flo@geekplace.eu> > Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Applied to u-boot/master, thanks!
diff --git a/scripts/dtc/pylibfdt/setup.py b/scripts/dtc/pylibfdt/setup.py index 8baae08770ca..c6fe5a6a446f 100755 --- a/scripts/dtc/pylibfdt/setup.py +++ b/scripts/dtc/pylibfdt/setup.py @@ -37,7 +37,7 @@ long_description = fh.read() # Decodes a Makefile assignment line into key and value (and plus for +=) -RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$') +RE_KEY_VALUE = re.compile(r'(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$') def get_top_builddir(): if '--top-builddir' in sys.argv: