From a9b1c42f403737a2abfeae31e6b5fd43f1d7869f Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 28 Jun 2021 17:03:13 +0200 Subject: [PATCH] doc: extensions: remove eager_only The eager_only is currently breaking the usage of the `.. only`` directive, so remove it. Documentation seems to build fine without it, so it has been removed for now. Signed-off-by: Gerard Marull-Paretas --- doc/_extensions/only/eager_only.py | 56 ------------------------------ doc/conf.py | 1 - 2 files changed, 57 deletions(-) delete mode 100644 doc/_extensions/only/eager_only.py diff --git a/doc/_extensions/only/eager_only.py b/doc/_extensions/only/eager_only.py deleted file mode 100644 index dcdec26fa8a..00000000000 --- a/doc/_extensions/only/eager_only.py +++ /dev/null @@ -1,56 +0,0 @@ -# -# This is a Sphinx documentation tool extension which makes .only:: -# directives be eagerly processed early in the parsing stage. This -# makes sure that content in .only:: blocks gets actually excluded -# as a typical user expects, instead of bits of information in -# these blocks leaking to documentation in various ways (e.g., -# indexes containing entries for functions which are actually in -# .only:: blocks and thus excluded from documentation, etc.) -# Note that with this extension, you may need to completely -# rebuild a doctree when switching builders (i.e. completely -# remove _build/doctree dir between generation of HTML vs PDF -# documentation). -# -# This extension works by monkey-patching Sphinx core, so potentially -# may not work with untested Sphinx versions. It tested to work with -# 1.2.2 and 1.4.2 -# -# Copyright (c) 2016 Paul Sokolovsky -# Based on idea by Andrea Cassioli: -# https://github.com/sphinx-doc/sphinx/issues/2150#issuecomment-171912290 -# -# SPDX-License-Identifier: Apache-2.0 -# -import sphinx -from docutils.parsers.rst import directives - - -class EagerOnly(sphinx.directives.other.Only): - - def run(self, *args): - # Evaluate the condition eagerly, and if false return no nodes right away - env = self.state.document.settings.env - env.app.builder.tags.add('TRUE') - - if not env.app.builder.tags.eval_condition(self.arguments[0]): - return [] - - # Otherwise, do the usual processing - nodes = super(EagerOnly, self).run() - if len(nodes) == 1: - nodes[0]['expr'] = 'TRUE' - return nodes - - -def setup(app): - directives.register_directive('only', EagerOnly) - - # The tags.add call above is setting tags.tags['TRUE'] = True. - # The operation is idempotent and will have taken effect before - # the next eval_condition() which may rely on it so this is thread - # safe both for read and writes (all other operations are local to - # the local nodes variable). - return { - 'parallel_read_safe': True, - 'parallel_write_safe': True, - } diff --git a/doc/conf.py b/doc/conf.py index 3e3b74786e2..c8c61692b8e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -76,7 +76,6 @@ extensions = [ "sphinx.ext.autodoc", "zephyr.application", "zephyr.html_redirects", - "only.eager_only", "zephyr.kconfig-role", "zephyr.dtcompatible-role", "zephyr.link-roles",