Skip to content

Commit

Permalink
chore: patch sphinx for explicit re-exports
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch authored and JohnVillalovos committed Jun 23, 2022
1 parent 0bbcad7 commit 06871ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api/gitlab.rst
Expand Up @@ -8,6 +8,7 @@ Module contents
:members:
:undoc-members:
:show-inheritance:
:noindex:

.. autoclass:: gitlab.Gitlab
:members:
Expand Down
20 changes: 20 additions & 0 deletions docs/conf.py
Expand Up @@ -19,10 +19,30 @@
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

Expand Down

0 comments on commit 06871ee

Please sign in to comment.