]> www.infradead.org Git - users/dwmw2/linux.git/commit
scripts/lib/abi/abi_parser.py: make it backward-compatible with Python 3.6
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 10 Feb 2025 10:18:14 +0000 (11:18 +0100)
committerJonathan Corbet <corbet@lwn.net>
Mon, 10 Feb 2025 18:19:57 +0000 (11:19 -0700)
commit6649b4217089c5d17dc210946baf9c9537c7fb5d
tree2eed1526471a4491f6a8edde27c5c25dabcb6908
parentdc525a7650d70668c4d54cf03b4cba793b72cb5a
scripts/lib/abi/abi_parser.py: make it backward-compatible with Python 3.6

Despite being introduced on Python 3.6, the original implementation
was too limited: it doesn't accept anything but the argument.

Even on python 3.10.12, support was still limited, as more complex
operations cause SyntaxError:

Exception occurred:
  File ".../linux/Documentation/sphinx/kernel_abi.py", line 48, in <module>
    from get_abi import AbiParser
  File ".../linux/scripts/lib/abi/abi_parser.py", line 525
    msg += f"{part}\n{"-" * len(part)}\n\n"
                       ^
SyntaxError: f-string: expecting '}'

Replace f-strings by normal string concatenation when it doesn't
work on Python 3.6.

Reported-by: Akira Yokosawa <akiyks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/41d2f85df134a46db46fed73a0f9697a3d2ae9ba.1739182025.git.mchehab+huawei@kernel.org
scripts/lib/abi/abi_parser.py