Changeset View
Changeset View
Standalone View
Standalone View
swh/docs/sphinx/conf.py
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | |||||
autodoc_mock_imports = ['rados'] | autodoc_mock_imports = ['rados'] | ||||
modindex_common_prefix = ['swh.'] | modindex_common_prefix = ['swh.'] | ||||
# for the extlinks extension, sub-projects should fill that dict | # for the extlinks extension, sub-projects should fill that dict | ||||
extlinks = {} | 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 | # hack to set the adequate django settings when building global swh doc | ||||
# to avoid autodoc build errors | # to avoid autodoc build errors | ||||
def setup(app): | def setup(app): | ||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', | os.environ.setdefault('DJANGO_SETTINGS_MODULE', | ||||
'swh.docs.django_settings') | 'swh.docs.django_settings') | ||||
django.setup() | 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) |