|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/2] build/mkheader: Fix Syntax/DeprecationWarnings
On Wed, Jul 03, 2024 at 11:55:25PM +0100, Andrew Cooper wrote:
> With Python 3.11, the following is emitted during a build:
>
> tools/include/xen-foreign/mkheader.py:162: DeprecationWarning: invalid
> escape sequence '\s'
> regex = "#define\s+%s\\b" % define;
> tools/include/xen-foreign/mkheader.py:177: DeprecationWarning: invalid
> escape sequence '\*'
> input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
> tools/include/xen-foreign/mkheader.py:178: DeprecationWarning: invalid
> escape sequence '\s'
> input = re.compile("\n\s*\n", re.S).sub("\n", input);
> tools/include/xen-foreign/mkheader.py:182: DeprecationWarning: invalid
> escape sequence '\s'
> regex = "union\s+%s\s*\{(.*?)\n\};" % union;
> tools/include/xen-foreign/mkheader.py:192: DeprecationWarning: invalid
> escape sequence '\s'
> regex = "(?:#ifdef ([A-Z_]+))?\nstruct\s+%s\s*\{(.*?)\n\};" % struct;
> tools/include/xen-foreign/mkheader.py:218: DeprecationWarning: invalid
> escape sequence '\s'
> output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
> tools/include/xen-foreign/mkheader.py:222: DeprecationWarning: invalid
> escape sequence '\s'
> output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);
>
> Python regexes should use raw strings. Convert all regexes, and drop escaped
> backslashes. Note that regular escape sequences are interpreted normally when
> parsing a regex, so \n even in a raw-string regex is a newline.
>
> No functional change.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Thanks,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |