diff --git a/swh/docs/sphinx/conf.py b/swh/docs/sphinx/conf.py --- a/swh/docs/sphinx/conf.py +++ b/swh/docs/sphinx/conf.py @@ -131,9 +131,25 @@ 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)