aboutsummaryrefslogtreecommitdiff
path: root/docs/sphinx/fakedbusdoc.py
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-10-06 01:00:35 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-12-21 10:50:21 +0400
commit2668dc7b5d9f56d8c3e6d2876c526fddc7068eca (patch)
treeae68445b8b96de1378e3e8899808144b54d659a7 /docs/sphinx/fakedbusdoc.py
parent20f19713ef5a33bd9074bb87aea004c08a27be7b (diff)
downloadqemu-2668dc7b5d9f56d8c3e6d2876c526fddc7068eca.zip
qemu-2668dc7b5d9f56d8c3e6d2876c526fddc7068eca.tar.gz
qemu-2668dc7b5d9f56d8c3e6d2876c526fddc7068eca.tar.bz2
docs/sphinx: add sphinx modules to include D-Bus documentation
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.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'docs/sphinx/fakedbusdoc.py')
-rw-r--r--docs/sphinx/fakedbusdoc.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/sphinx/fakedbusdoc.py b/docs/sphinx/fakedbusdoc.py
new file mode 100644
index 0000000..a680b25
--- /dev/null
+++ b/docs/sphinx/fakedbusdoc.py
@@ -0,0 +1,25 @@
+# D-Bus XML documentation extension, compatibility gunk for <sphinx4
+#
+# Copyright (C) 2021, Red Hat Inc.
+#
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# Author: Marc-André Lureau <marcandre.lureau@redhat.com>
+"""dbus-doc is a Sphinx extension that provides documentation from D-Bus XML."""
+
+from sphinx.application import Sphinx
+from sphinx.util.docutils import SphinxDirective
+from typing import Any, Dict
+
+
+class FakeDBusDocDirective(SphinxDirective):
+ has_content = True
+ required_arguments = 1
+
+ def run(self):
+ return []
+
+
+def setup(app: Sphinx) -> Dict[str, Any]:
+ """Register a fake dbus-doc directive with Sphinx"""
+ app.add_directive("dbus-doc", FakeDBusDocDirective)