diff options
-rw-r--r-- | Help/command/enable_language.rst | 4 | ||||
-rw-r--r-- | Help/command/project.rst | 3 | ||||
-rw-r--r-- | Utilities/Sphinx/cmake.py | 29 |
3 files changed, 30 insertions, 6 deletions
diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst index 21b38ba..2f1cc23 100644 --- a/Help/command/enable_language.rst +++ b/Help/command/enable_language.rst @@ -13,10 +13,6 @@ variables that are created by the project command. .. include:: SUPPORTED_LANGUAGES.txt -By default ``C`` and ``CXX`` are enabled if no language options are given. -Specify language ``NONE``, or use the ``LANGUAGES`` keyword and list no languages, -to skip enabling any languages. - This command must be called in file scope, not in a function call. Furthermore, it must be called in the highest directory common to all targets using the named language directly for compiling sources or diff --git a/Help/command/project.rst b/Help/command/project.rst index ab93f3d..d695789 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -105,6 +105,9 @@ The options are: .. include:: SUPPORTED_LANGUAGES.txt +By default ``C`` and ``CXX`` are enabled if no language options are given. +Specify language ``NONE``, or use the ``LANGUAGES`` keyword and list no languages, +to skip enabling any languages. The variables set through the ``VERSION``, ``DESCRIPTION`` and ``HOMEPAGE_URL`` options are intended for use as default values in package metadata and documentation. diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 0afd705..60bfb33 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -582,12 +582,23 @@ class CMakeXRefTransform(Transform): # after the sphinx (210) and docutils (220) substitutions. default_priority = 221 + # This helper supports docutils < 0.18, which is missing 'findall', + # and docutils == 0.18.0, which is missing 'traverse'. + def _document_findall_as_list(self, condition): + if hasattr(self.document, 'findall'): + # Fully iterate into a list so the caller can grow 'self.document' + # while iterating. + return list(self.document.findall(condition)) + + # Fallback to 'traverse' on old docutils, which returns a list. + return self.document.traverse(condition) + def apply(self): env = self.document.settings.env # Find CMake cross-reference nodes and add index and target # nodes for them. - for ref in self.document.traverse(addnodes.pending_xref): + for ref in self._document_findall_as_list(addnodes.pending_xref): if not ref['refdomain'] == 'cmake': continue @@ -668,7 +679,7 @@ class CMakeDomain(Domain): 'manual': CMakeXRefRole(), } initial_data = { - 'objects': {}, # fullname -> docname, objtype + 'objects': {}, # fullname -> ObjectEntry } def clear_doc(self, docname): @@ -679,6 +690,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}' |