[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lduu7efu.fsf@trenco.lwn.net>
Date: Tue, 28 Jan 2025 15:37:25 -0700
From: Jonathan Corbet <corbet@....net>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>, Linux Doc Mailing
List <linux-doc@...r.kernel.org>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>, Mauro Carvalho Chehab
<mchehab+huawei@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [RFC v2 18/38] docs: sphinx/kernel_abi: use AbiParser directly
Mauro Carvalho Chehab <mchehab+huawei@...nel.org> writes:
> Instead of running get_abi.py script, import AbiParser class and
> handle messages directly there using an interactor. This shold save some
> memory, as there's no need to exec python inside the Sphinx python
> extension.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
> ---
> Documentation/sphinx/kernel_abi.py | 26 +++++++++++++++-----------
> scripts/get_abi.py | 2 +-
> 2 files changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py
> index fc7500fad119..93d537d8cb6c 100644
> --- a/Documentation/sphinx/kernel_abi.py
> +++ b/Documentation/sphinx/kernel_abi.py
> @@ -42,6 +42,11 @@ from docutils.parsers.rst import directives, Directive
> from sphinx.util.docutils import switch_source_input
> from sphinx.util import logging
>
> +srctree = os.path.abspath(os.environ["srctree"])
> +sys.path.insert(0, os.path.join(srctree, "scripts"))
> +
> +from get_abi import AbiParser
I have to admit that I don't like this bit of messing around with the
path. And importing things out of scripts/ seems ... inelegant.
I take it you still want to be able to run get_abi.py standalone even
after it's directly integrated into Sphinx? In this case, it might be
nicer to have the common library functionality in its own module that
can be imported into both sphinx and the standalone command. That still
leaves open the question of where that module lives
(Documentation/sphinx perhaps?) and how the Python path gets set up
correctly...
jon
Powered by blists - more mailing lists