Skip to content
Snippets Groups Projects
Commit 4d69a749 authored by Matthew Woehlke's avatar Matthew Woehlke
Browse files

Utilities/Sphinx: Fix parallel documentation builds for 3.27


In commit d78bfa1e (Utilities/Sphinx: support cmakedomain running in
parallel, 2022-10-24, v3.26.0-rc1~495^2) we declared the domain as
parallel-safe without actually implementing the required
`merge_domaindata` method. Since then, 37e015d4 (Utilities/Sphinx:
Refactor Sphinx reference recording) changed how we store resolved
references, such that the fix for 3.26 does not work with 3.27.

This implements the required method for 3.27 and also corrects a crusty
comment that was overlooked during the aforementioned refactoring. A
separate fix is being applied to 3.26.

Issue: #24076

Co-authored-by: default avatarJared Dillard <jared.dillard@gmail.com>
parent cb5b1483
Branches master
No related tags found
No related merge requests found
......@@ -669,7 +669,7 @@ class CMakeDomain(Domain):
'manual': CMakeXRefRole(),
}
initial_data = {
'objects': {}, # fullname -> docname, objtype
'objects': {}, # fullname -> ObjectEntry
}
def clear_doc(self, docname):
......@@ -680,6 +680,20 @@ class CMakeDomain(Domain):
for fullname in to_clear:
del self.data['objects'][fullname]
def merge_domaindata(self, docnames, otherdata):
"""Merge domaindata from the workers/chunks when they return.
Called once per parallelization chunk.
Only used when sphinx is run in parallel mode.
:param docnames: a Set of the docnames that are part of the current
chunk to merge
:param otherdata: the partial data calculated by the current chunk
"""
for refname, obj in otherdata['objects'].items():
if obj.docname in docnames:
self.data['objects'][refname] = obj
def resolve_xref(self, env, fromdocname, builder,
typ, target, node, contnode):
targetid = f'{typ}:{target}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment