From 4c951a29372232789b290721a6159c1d3dc06bdd Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Thu, 12 Sep 2024 10:08:05 +0200 Subject: [PATCH] Ensure sphinx doc attributes are available before trying to access them (#3156) Very old versions of sphinx (e.g. as shipped in Ubuntu 20.04 LTS) might not have them. Close #3155 --- docs/conf.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bfd32064e..a1d785871 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -289,13 +289,15 @@ def env_get_outdated(app, env, added, changed, removed): Remove the items listed in `docs_to_remove` from known pages. """ to_remove = set() - for doc in env.found_docs: - if _to_be_removed(doc): - to_remove.add(doc) + if hasattr(env, 'found_docs'): + for doc in env.found_docs: + if _to_be_removed(doc): + to_remove.add(doc) added.difference_update(to_remove) changed.difference_update(to_remove) removed.update(to_remove) - env.project.docnames.difference_update(to_remove) + if hasattr(env, 'project'): + env.project.docnames.difference_update(to_remove) return []