Skip to content
Snippets Groups Projects
Commit a9b712a1 authored by David Douard's avatar David Douard
Browse files

conf: add a hack to make httpdomain routing table referencable

this aims at eliminating a warning generated by sphinx-build on swh-web's
index, due to the presence of an explicit link to the http-routingtable.html
file (which does not exists at that time, thus generated a warning).

This should be killed once

  https://github.com/sphinx-contrib/httpdomain/pull/19

is accepted and released.
parent 0ad8ca5f
No related branches found
No related tags found
1 merge request!281Small improvements to help the CI job tracking errors and warnings in the doc
......@@ -131,9 +131,25 @@ modindex_common_prefix = ['swh.']
extlinks = {}
# XXX Kill this ASA this PR is accepted and released
# https://github.com/sphinx-contrib/httpdomain/pull/19
def register_routingtable_as_label(app, document):
from sphinx.locale import _ # noqa
labels = app.env.domaindata['std']['labels']
labels['routingtable'] = 'http-routingtable', '', _('HTTP Routing Table')
anonlabels = app.env.domaindata['std']['anonlabels']
anonlabels['routingtable'] = 'http-routingtable', ''
# hack to set the adequate django settings when building global swh doc
# to avoid autodoc build errors
def setup(app):
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'swh.docs.django_settings')
django.setup()
import pkg_resources # noqa
from distutils.version import StrictVersion # noqa
httpdomain = pkg_resources.get_distribution('sphinxcontrib-httpdomain')
if StrictVersion(httpdomain.version) <= StrictVersion('1.7.0'):
app.connect('doctree-read', register_routingtable_as_label)
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