summaryrefslogtreecommitdiff
path: root/docs/conf.py
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-06-24 00:28:23 +0200
committerJohn Villalovos <john@sodarock.com>2022-06-23 16:15:16 -0700
commit06871ee05b79621f0a6fea47243783df105f64d6 (patch)
treec34144d2b272dd7bbf920a6752db1563140f6913 /docs/conf.py
parent0bbcad7612f60f7c7b816c06a244ad8db9da68d9 (diff)
downloadgitlab-06871ee05b79621f0a6fea47243783df105f64d6.tar.gz
chore: patch sphinx for explicit re-exports
Diffstat (limited to 'docs/conf.py')
-rw-r--r--docs/conf.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py
index e94d2f5..11b920e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -19,10 +19,30 @@ import os
import sys
from datetime import datetime
+from sphinx.domains.python import PythonDomain
+
sys.path.append("../")
sys.path.append(os.path.dirname(__file__))
import gitlab # noqa: E402. Needed purely for readthedocs' build
+
+# Sphinx will warn when attributes are exported in multiple places. See workaround:
+# https://github.com/sphinx-doc/sphinx/issues/3866#issuecomment-768167824
+# This patch can be removed when this issue is resolved:
+# https://github.com/sphinx-doc/sphinx/issues/4961
+class PatchedPythonDomain(PythonDomain):
+ def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
+ if "refspecific" in node:
+ del node["refspecific"]
+ return super(PatchedPythonDomain, self).resolve_xref(
+ env, fromdocname, builder, typ, target, node, contnode
+ )
+
+
+def setup(sphinx):
+ sphinx.add_domain(PatchedPythonDomain, override=True)
+
+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
year = datetime.now().year