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

sphinx/conf.py: Filter out httdomain related warning since sphinx 4.1

Since the release of sphinx 4.1, a new warning related to httpdomain
extension appeared when buidling swh-web documentation.

It is not critical and is due to httpdomain not in sync with latest
changes in sphinx, so filter out that warning as it makes sphinx
builds fail for swh-web on Jenkins.
parent e9e838d4
No related branches found
No related tags found
1 merge request!147sphinx/conf.py: Filter out httdomain related warning since sphinx 4.1
......@@ -277,7 +277,7 @@ def setup(app):
# ensure glossary will be available in package doc scope
app.connect("source-read", add_glossary_to_index)
# suppress httpdomain warnings in non web packages
# suppress some httpdomain warnings in non web packages
if "swh-web" not in app.srcdir:
# filter out httpdomain unresolved reference warnings
......@@ -286,6 +286,21 @@ def setup(app):
def filter(self, record: logging.LogRecord) -> bool:
return not record.msg.startswith("Cannot resolve reference to")
logger = logging.getLogger("sphinx")
# insert a custom filter in the warning log handler of sphinx
logger.handlers[1].filters.insert(0, HttpDomainWarningFilter())
# suppress some httpdomain warnings in web package
else:
# filter out non critical warnings appeared with sphinx 4.1 release
# TODO: remove that hack when that pull request gets merged
# https://github.com/sphinx-contrib/httpdomain/pull/51
class HttpDomainWarningFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
return not (
record.args
and type(record.args) == tuple # to keep mypy happy
and record.args[0] == "http"
and record.msg.endswith("but that role is not in the domain.")
)
logger = logging.getLogger("sphinx")
# insert a custom filter in the warning log handler of sphinx
logger.handlers[1].filters.insert(0, HttpDomainWarningFilter())
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