Skip to content
Snippets Groups Projects
Commit 7b41b33b authored by Antoine Lambert's avatar Antoine Lambert
Browse files

sphinx/conf.py: Filter out all warnings related to parallel processing

Sphinx prints warnings when an extension does not declare it is safe to use
with parallel build and switch back to sequential build in that case.

Previously only parallel read warnings were filtered out so ensure parallel
write ones are also considered.
parent fe8bc53e
No related branches found
No related tags found
No related merge requests found
......@@ -371,15 +371,19 @@ def setup(app):
# the documentation
os.environ["SWH_DOC_BUILD"] = "1"
# filter out parallel read in sphinx extension warnings
# filter out parallel read/write in sphinx extension warnings
# to not consider them as errors when using -W option of sphinx-build
class ParallelReadWarningFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
message = record.getMessage()
return (
"extension does not declare if it is safe for parallel reading"
not in message
) and message != "doing serial read"
return all(
text not in message
for text in (
"extension does not declare if it is safe for parallel",
"extension is not safe for parallel",
"doing serial",
)
)
# insert a custom filter in the warning log handler of sphinx
get_sphinx_warning_handler().filters.insert(0, ParallelReadWarningFilter())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment