Ignore "more than one target found for cross-reference" false positive sphinx build errors.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1927c806 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1927c806 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1927c806 Branch: refs/heads/trunk Commit: 1927c806efb9e5f2c0f3ee30c3c5d130a9a969ee Parents: da9508f Author: Tomaz Muraus <[email protected]> Authored: Wed Sep 6 17:24:11 2017 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Sun Sep 10 21:51:29 2017 +0200 ---------------------------------------------------------------------- docs/conf.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/1927c806/docs/conf.py ---------------------------------------------------------------------- diff --git a/docs/conf.py b/docs/conf.py index 3e0c983..94a2b76 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,6 +21,8 @@ from sphinx.environment import BuildEnvironment from sphinx.ext.autodoc import AutoDirective from sphinx.ext.autodoc import AutodocReporter +from sphinx.domains.python import PythonDomain + BASE_DIR = os.path.dirname(os.path.abspath(__file__)) BASE_DIR = os.path.abspath(BASE_DIR) @@ -303,3 +305,15 @@ AutoDirective.warn = noop AutodocReporter.warning = mock_warning BuildEnvironment.warn_node = ignore_more_than_one_target_found_errors + +# Ignore "more than one target found for cross-reference" errors which are false +# positives +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.override_domain(PatchedPythonDomain)
