On 21/12/2021 07.58, marcandre.lur...@redhat.com wrote:
From: Marc-André Lureau <marcandre.lur...@redhat.com>
Add a new dbus-doc directive to import D-Bus interfaces documentation
from the introspection XML. The comments annotations follow the
gtkdoc/kerneldoc style, and should be formatted with reST.
Note: I realize after the fact that I was implementing those modules
with sphinx 4, and that we have much lower requirements. Instead of
lowering the features and code (removing type annotations etc), let's
have a warning in the documentation when the D-Bus modules can't be
used, and point to the source XML file in that case.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
Acked-by: Gerd Hoffmann <kra...@redhat.com>
---
docs/conf.py | 8 +
docs/sphinx/dbusdoc.py | 166 +++++++++++++++
docs/sphinx/dbusdomain.py | 406 +++++++++++++++++++++++++++++++++++++
docs/sphinx/dbusparser.py | 373 ++++++++++++++++++++++++++++++++++
docs/sphinx/fakedbusdoc.py | 25 +++
5 files changed, 978 insertions(+)
create mode 100644 docs/sphinx/dbusdoc.py
create mode 100644 docs/sphinx/dbusdomain.py
create mode 100644 docs/sphinx/dbusparser.py
create mode 100644 docs/sphinx/fakedbusdoc.py
diff --git a/docs/conf.py b/docs/conf.py
index 763e7d243448..e79015975e6a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -73,6 +73,12 @@
# ones.
extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile', 'qapidoc']
+if sphinx.version_info[:3] > (4, 0, 0):
+ tags.add('sphinx4')
+ extensions += ['dbusdoc']
+else:
+ extensions += ['fakedbusdoc']
+
# Add any paths that contain templates here, relative to this directory.
templates_path = [os.path.join(qemu_docdir, '_templates')]
@@ -311,3 +317,5 @@
kerneldoc_srctree = os.path.join(qemu_docdir, '..')
hxtool_srctree = os.path.join(qemu_docdir, '..')
qapidoc_srctree = os.path.join(qemu_docdir, '..')
+dbusdoc_srctree = os.path.join(qemu_docdir, '..')
+dbus_index_common_prefix = ["org.qemu."]
This does not work with my version of Sphinx (v 1.7.6):
Program sphinx-build-3 found: YES (/usr/bin/sphinx-build-3)
../../home/thuth/devel/qemu/docs/meson.build:30: WARNING:
/usr/bin/sphinx-build-3:
Extension error:
Could not import extension fakedbusdoc (exception: cannot import name
'SphinxDirective')
Any ideas how to fix it?
Thomas