Changeset View
Changeset View
Standalone View
Standalone View
swh/web/doc_config.py
# Copyright (C) 2017-2018 The Software Heritage developers | # Copyright (C) 2017-2018 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import importlib.util | |||||
import os | import os | ||||
from sphinxcontrib import httpdomain | from sphinxcontrib import httpdomain | ||||
from sphinx.ext import autodoc | from sphinx.ext import autodoc | ||||
# guard to avoid ImportError when running tests through sbuild | # guard to avoid ImportError when running tests through sbuild | ||||
# as there is no Debian package built for swh-docs | # as there is no Debian package built for swh-docs | ||||
try: | if importlib.util.find_spec('swh.docs'): | ||||
from swh.docs.sphinx.conf import setup as orig_setup | from swh.docs.sphinx.conf import setup as orig_setup | ||||
except Exception: | |||||
pass | |||||
class SimpleDocumenter(autodoc.FunctionDocumenter): | class SimpleDocumenter(autodoc.FunctionDocumenter): | ||||
""" | """ | ||||
Custom autodoc directive to display a docstring unindented | Custom autodoc directive to display a docstring unindented | ||||
and without function signature header. | and without function signature header. | ||||
""" | """ | ||||
objtype = "simple" | objtype = "simple" | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |