[rtems-central commit] interfacedoc: Add enabled set
Sebastian Huber
sebh at rtems.org
Thu Aug 11 06:22:53 UTC 2022
Module: rtems-central
Branch: master
Commit: b25197026601e79baa43a631d909452bcc2adf34
Changeset: http://git.rtems.org/rtems-central/commit/?id=b25197026601e79baa43a631d909452bcc2adf34
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Aug 11 08:02:32 2022 +0200
interfacedoc: Add enabled set
---
rtemsspec/interfacedoc.py | 14 ++++++++------
rtemsspec/tests/test_interfacedoc.py | 2 +-
spec2modules.py | 1 +
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/rtemsspec/interfacedoc.py b/rtemsspec/interfacedoc.py
index 65bc5443..695af5f3 100644
--- a/rtemsspec/interfacedoc.py
+++ b/rtemsspec/interfacedoc.py
@@ -160,7 +160,8 @@ def _add_definition(content: CContent, mapper: ItemMapper, item: Item,
def _generate_directive(content: SphinxContent, mapper: _Mapper,
- code_mapper: _CodeMapper, item: Item) -> None:
+ code_mapper: _CodeMapper, item: Item,
+ enabled: List[str]) -> None:
content.wrap(mapper.substitute(item["brief"]))
content.add(".. rubric:: CALLING SEQUENCE:")
with content.directive("code-block", "c"):
@@ -198,7 +199,7 @@ def _generate_directive(content: SphinxContent, mapper: _Mapper,
content.wrap(mapper.substitute(item["notes"]))
constraints = [
mapper.substitute(parent["text"], parent)
- for parent in item.parents("constraint")
+ for parent in item.parents("constraint") if parent.is_enabled(enabled)
]
if constraints:
content.add(".. rubric:: CONSTRAINTS:")
@@ -207,7 +208,7 @@ def _generate_directive(content: SphinxContent, mapper: _Mapper,
def _generate_directives(target: str, group: Item, group_uids: List[str],
- items: List[Item]) -> None:
+ items: List[Item], enabled: List[str]) -> None:
content = SphinxContent()
content.register_license_and_copyrights_of_item(group)
content.add_automatically_generated_warning()
@@ -230,7 +231,8 @@ def _generate_directives(target: str, group: Item, group_uids: List[str],
directive = f"{name}()"
content.add_index_entries([directive] + item["index-entries"])
with content.section(directive, "Interface"):
- _generate_directive(content, mapper, code_mapper, item)
+ _generate_directive(content, mapper, code_mapper, item,
+ enabled)
content.add_licence_and_copyrights()
content.write(target)
@@ -243,7 +245,7 @@ def _directive_key(order: List[Item], item: Item) -> Tuple[int, str]:
return (index, item.uid)
-def generate(config: list, item_cache: ItemCache) -> None:
+def generate(config: list, enabled: List[str], item_cache: ItemCache) -> None:
"""
Generates interface documentation according to the configuration.
@@ -263,4 +265,4 @@ def generate(config: list, item_cache: ItemCache) -> None:
_generate_introduction(doc_config["introduction-target"], group,
group_uids, items)
_generate_directives(doc_config["directives-target"], group,
- group_uids, items)
+ group_uids, items, enabled)
diff --git a/rtemsspec/tests/test_interfacedoc.py b/rtemsspec/tests/test_interfacedoc.py
index c82b923d..f66ac378 100644
--- a/rtemsspec/tests/test_interfacedoc.py
+++ b/rtemsspec/tests/test_interfacedoc.py
@@ -49,7 +49,7 @@ def test_interfacedoc(tmpdir):
item_cache_config = create_item_cache_config_and_copy_spec(
tmpdir, "spec-interface", with_spec_types=True)
- generate([doc_config, doc_config_2], ItemCache(item_cache_config))
+ generate([doc_config, doc_config_2], [], ItemCache(item_cache_config))
with open(introduction_rst, "r") as src:
content = """.. SPDX-License-Identifier: CC-BY-SA-4.0
diff --git a/spec2modules.py b/spec2modules.py
index 921a72ff..04ce48b2 100755
--- a/spec2modules.py
+++ b/spec2modules.py
@@ -77,6 +77,7 @@ def main() -> None:
rtemsspec.specdoc.document(config["spec-documentation"], item_cache)
rtemsspec.glossary.generate(config["glossary"], item_cache)
rtemsspec.interfacedoc.generate(config["interface-documentation"],
+ config["interface"]["enabled"],
item_cache)
More information about the vc
mailing list