Re: [RFC v2 17/38] scripts/get_abi.py: use an interactor for ReST output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Mauro Carvalho Chehab wrote:

> Instead of printing all results line per line, use an interactor
> to return each variable as a separate message.
> 
> This won't change much when using it via command line, but it
> will help Sphinx integration by providing an interactor that
> could be used there to handle ABI symbol by symbol.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
> ---
>  scripts/get_abi.py | 52 ++++++++++++++++++++++++++--------------------
>  1 file changed, 29 insertions(+), 23 deletions(-)
> 
> diff --git a/scripts/get_abi.py b/scripts/get_abi.py
> index 73613fb29c1c..2aec1f9dc5aa 100755
> --- a/scripts/get_abi.py
> +++ b/scripts/get_abi.py
[...]
> @@ -470,9 +472,9 @@ class AbiParser:
>  
>                  if cur_part and cur_part != part:
>                      part = cur_part
> -                    print(f"{part}\n{"-" * len(part)}\n")
> +                    msg += f"{part}\n{"-" * len(part)}\n\n"
>  
> -                print(f".. _{key}:\n")
> +                msg += f".. _{key}:\n\n"
>  
>                  max_len = 0
>                  for i in range(0, len(names)):           # pylint: disable=C0200
[...]

Testing under Ubuntu 22.04, where distro python3 is 3.10.12 and
distro Sphinx is 4.3.2, I get this exception by running "make htmldocs":

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

, which is introduced in the above hunk, I guess.

You can install Sphinx 8.1.3 on top of python3 3.10.12 using venv.
I get the same exception there.

Your change works fine against Ubuntu 24.04, whose distro python3 is 3.12.3.

I have not tested against python3 3.11.x.

It would be better to keep compatible with >= python 3.10.x if at all
possible.

        Thanks, Akira





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux