From 5de805bea21af6c20f35afcbb925b1856d643bbe Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 12 Jun 2023 17:33:59 -0400 Subject: Utilities/Sphinx: Fix flake8 E124 diagnostic in cmake.py --- Utilities/Sphinx/cmake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index ffef5b3..faca2ed 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -514,7 +514,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 -- cgit v0.12 From 1f39a3cd1a5b397d26cb9dfa1242573c1ee45143 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 12 Jun 2023 17:37:13 -0400 Subject: Utilities/Sphinx: Restore explicit check for Sphinx 2.x or later Refactoring in commit adbc8c982d (Utilities/Sphinx: Fix flake8 gripes in cmake.py, 2023-03-13, v3.27.0-rc1~317^2) moved the assertion added by commit cef51925a4 (Utilities/Sphinx: Require Sphinx 2.x or later, 2023-03-13, v3.27.0-rc1~317^2~2) to after imports, which is too late to clearly reject older Sphinx versions. --- Utilities/Sphinx/.flake8 | 3 +++ Utilities/Sphinx/cmake.py | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 Utilities/Sphinx/.flake8 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 faca2ed..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. -- cgit v0.12