aboutsummaryrefslogtreecommitdiff
path: root/docs/sphinx/qapidoc.py
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2024-07-03 13:52:35 -0400
committerJohn Snow <jsnow@redhat.com>2024-07-12 16:46:21 -0400
commitdd23f9ec519db9c424223cff8767715de5532718 (patch)
treef085e0a4c4085f5cc047aaafd6bb65ae591e06fc /docs/sphinx/qapidoc.py
parentfe791b7fcc760cd332cfabe5a328bc63e0437aa4 (diff)
docs: remove Sphinx 1.x compatibility code
In general, the Use_SSI workaround is no longer needed, and neither is the pre-1.6 logging shim for kerneldoc. Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-id: 20240703175235.239004-3-jsnow@redhat.com [rebased on top of origin/master. --js] Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'docs/sphinx/qapidoc.py')
-rw-r--r--docs/sphinx/qapidoc.py33
1 files changed, 3 insertions, 30 deletions
diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py
index 2b06750a3c..62b39833ca 100644
--- a/docs/sphinx/qapidoc.py
+++ b/docs/sphinx/qapidoc.py
@@ -35,22 +35,11 @@ from qapi.error import QAPIError, QAPISemError
from qapi.gen import QAPISchemaVisitor
from qapi.schema import QAPISchema
-import sphinx
from sphinx.errors import ExtensionError
+from sphinx.util.docutils import switch_source_input
from sphinx.util.nodes import nested_parse_with_titles
-# Sphinx up to 1.6 uses AutodocReporter; 1.7 and later
-# use switch_source_input. Check borrowed from kerneldoc.py.
-USE_SSI = sphinx.__version__[:3] >= "1.7"
-if USE_SSI:
- from sphinx.util.docutils import switch_source_input
-else:
- from sphinx.ext.autodoc import ( # pylint: disable=no-name-in-module
- AutodocReporter,
- )
-
-
__version__ = "1.0"
@@ -539,24 +528,8 @@ class QAPIDocDirective(Directive):
subheadings (titles) without confusing the rendering of
anything else.
"""
- # This is from kerneldoc.py -- it works around an API change in
- # Sphinx between 1.6 and 1.7. Unlike kerneldoc.py, we use
- # sphinx.util.nodes.nested_parse_with_titles() rather than the
- # plain self.state.nested_parse(), and so we can drop the saving
- # of title_styles and section_level that kerneldoc.py does,
- # because nested_parse_with_titles() does that for us.
- if USE_SSI:
- with switch_source_input(self.state, rstlist):
- nested_parse_with_titles(self.state, rstlist, node)
- else:
- save = self.state.memo.reporter
- self.state.memo.reporter = AutodocReporter(
- rstlist, self.state.memo.reporter
- )
- try:
- nested_parse_with_titles(self.state, rstlist, node)
- finally:
- self.state.memo.reporter = save
+ with switch_source_input(self.state, rstlist):
+ nested_parse_with_titles(self.state, rstlist, node)
def setup(app):