Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> 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@xxxxxxxxxx> > --- > 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