All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>,
	xen-devel@lists.xenproject.org
Cc: Jan Beulich <jbeulich@suse.com>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Luca Fancellu <luca.fancellu@arm.com>
Subject: Re: [PATCH v2 1/1] tools, xen/scripts: clear out Python syntax warnings
Date: Tue, 17 Dec 2024 16:26:39 +0000	[thread overview]
Message-ID: <fe201e59-beb0-4134-abbb-13a55a4ec987@citrix.com> (raw)
In-Reply-To: <20241216231128.211648-2-Ariel.Otilibili-Anieli@eurecom.fr>

On 16/12/2024 11:07 pm, Ariel Otilibili wrote:
> * since 3.12 invalid escape sequences generate SyntaxWarning
> * in the future, these invalid sequences will generate SyntaxError
> * therefore changed syntax to raw string notation.
>
> Link: https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
> Fixes: d8f3a67bf98 ("pygrub: further improve grub2 support")
> Fixes: dd03048708a ("xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry")
> Fixes: d1b93ea2615 ("tools/pygrub: Make pygrub understand default entry in string format")
> Fixes: 622e368758b ("Add ZFS libfsimage support patch")
> Fixes: 02b26c02c7c ("xen/scripts: add cppcheck tool to the xen-analysis.py script")
> Fixes: 56c0063f4e7 ("xen/misra: xen-analysis.py: Improve the cppcheck version check")
>
> Cc: Anthony PERARD <anthony.perard@vates.tech>
> Cc: Luca Fancellu <luca.fancellu@arm.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>

Having poked about a bit more, this is all a big mess, but these do now
work with Py3.12.

leading \ for non-special characters are ignored in [], which is why ...

> ---
>  tools/pygrub/src/GrubConf.py                  | 4 ++--
>  tools/pygrub/src/pygrub                       | 6 +++---
>  xen/scripts/xen_analysis/cppcheck_analysis.py | 4 ++--
>  3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
> index 580c9628ca..904e7d5567 100644
> --- a/tools/pygrub/src/GrubConf.py
> +++ b/tools/pygrub/src/GrubConf.py
> @@ -320,7 +320,7 @@ class GrubConfigFile(_GrubConfigFile):
>  def grub2_handle_set(arg):
>      (com,arg) = grub_split(arg,2)
>      com="set:" + com
> -    m = re.match("([\"\'])(.*)\\1", arg)
> +    m = re.match(r"([\"\'])(.*)\1", arg)

... the \' works here.

Anyway, I've checked the others and they seem to work, so I suggest
taking this roughly this form.

Some notes about the commit message.  The subject ought to be:

tools: Fix syntax warnings with Python 3.12

The text should be a regular paragraph, rather than bullet points like this.

I can fix this all on commit if you're happy.

~Andrew


  parent reply	other threads:[~2024-12-17 16:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14 16:09 [PATCH 0/1] tools, xen/scripts: clear out Python syntax warnings Ariel Otilibili
2024-12-14 16:09 ` [PATCH 1/1] " Ariel Otilibili
2024-12-16 11:34   ` Andrew Cooper
2024-12-16 16:51     ` Ariel Otilibili-Anieli
2024-12-16 23:07 ` [PATCH v2 0/1] " Ariel Otilibili
2024-12-16 23:07   ` [PATCH v2 1/1] " Ariel Otilibili
2024-12-17  8:31     ` Luca Fancellu
2024-12-17 13:26       ` Ariel Otilibili-Anieli
2024-12-17 16:26     ` Andrew Cooper [this message]
2024-12-17 17:13       ` Ariel Otilibili-Anieli
2024-12-18 14:21         ` Andrew Cooper
2024-12-18 15:20           ` Ariel Otilibili-Anieli

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=fe201e59-beb0-4134-abbb-13a55a4ec987@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ariel.Otilibili-Anieli@eurecom.fr \
    --cc=anthony.perard@vates.tech \
    --cc=jbeulich@suse.com \
    --cc=luca.fancellu@arm.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.