summaryrefslogtreecommitdiffstats
path: root/Utilities/Sphinx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-06-13 14:48:24 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-06-13 14:48:32 (GMT)
commitac4bcefc884effb7a1e7e78f9e416d7da207725d (patch)
treefb77f851b3068fd054d0a512e59114089fe69937 /Utilities/Sphinx
parent704c9b5a81d6c41104ae9229b1cefa8803a58b52 (diff)
parent1f39a3cd1a5b397d26cb9dfa1242573c1ee45143 (diff)
downloadCMake-ac4bcefc884effb7a1e7e78f9e416d7da207725d.zip
CMake-ac4bcefc884effb7a1e7e78f9e416d7da207725d.tar.gz
CMake-ac4bcefc884effb7a1e7e78f9e416d7da207725d.tar.bz2
Merge topic 'doc-sphinx-2.x'
1f39a3cd1a Utilities/Sphinx: Restore explicit check for Sphinx 2.x or later 5de805bea2 Utilities/Sphinx: Fix flake8 E124 diagnostic in cmake.py Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8555
Diffstat (limited to 'Utilities/Sphinx')
-rw-r--r--Utilities/Sphinx/.flake83
-rw-r--r--Utilities/Sphinx/cmake.py10
2 files changed, 9 insertions, 4 deletions
diff --git a/Utilities/Sphinx/.flake8 b/Utilities/Sphinx/.flake8
new file mode 100644
index 0000000..7218008
--- /dev/null
+++ b/Utilities/Sphinx/.flake8
@@ -0,0 +1,3 @@
+[flake8]
+per-file-ignores =
+ cmake.py: E402
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index ffef5b3..d3eb948 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -11,6 +11,11 @@ from typing import Any, List, Tuple, Type, cast
import sphinx
+# Require at least Sphinx 2.x.
+# flake8 issues E402 for imports after this, but the purpose of this
+# check is to fail more clearly if the imports below will fail.
+assert sphinx.version_info >= (2,)
+
from docutils.utils.code_analyzer import Lexer, LexerError
from docutils.parsers.rst import Directive, directives
from docutils.transforms import Transform
@@ -110,9 +115,6 @@ CMakeLexer.tokens["root"] = [
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-# Require at least Sphinx 2.x.
-assert sphinx.version_info >= (2,)
-
logger = logging.getLogger(__name__)
# RE to split multiple command signatures.
@@ -514,7 +516,7 @@ class CMakeReferenceRole:
class Class(parent):
def __call__(self, name: str, rawtext: str, text: str,
*args, **kwargs
- ) -> Tuple[List[Node], List[system_message]]:
+ ) -> Tuple[List[Node], List[system_message]]:
text = CMakeReferenceRole._escape_angle_brackets(text)
return super().__call__(name, rawtext, text, *args, **kwargs)
return Class