From b5aef2c2bd315fe031f4a26472d418051ca8c362 Mon Sep 17 00:00:00 2001 From: jfbu <2589111+jfbu@users.noreply.github.com> Date: Sat, 25 Jun 2022 16:23:15 +0200 Subject: [PATCH] Fix #10596: Build failure if Docutils version is 0.18 (not 0.18.1) Node.findall() was added only at Docutils 0.18.1 --- CHANGES | 3 +++ sphinx/util/docutils.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 4afa807b69e..592df76341b 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,9 @@ Features added Bugs fixed ---------- +* #10596: Build failure if Docutils version is 0.18 (not 0.18.1) due + to missing ``Node.findall()`` + Testing -------- diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index e1fd780963b..b2944ec28aa 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -550,9 +550,9 @@ def unknown_visit(self, node: Node) -> None: # Node.findall() is a new interface to traverse a doctree since docutils-0.18. -# This applies a patch docutils-0.17 or older to be available Node.findall() +# This applies a patch to docutils up to 0.18 inclusive to provide Node.findall() # method to use it from our codebase. -if docutils.__version_info__ < (0, 18): +if docutils.__version_info__ <= (0, 18): def findall(self, *args, **kwargs): return iter(self.traverse(*args, **kwargs))