diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-16 08:35:03 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-16 13:57:51 +0100 |
commit | 765ed1cffb363ccf4b23dd2300abfed6ac1b6394 (patch) | |
tree | 33c9b2c36cefe2c76c508cbfd10ec0d7bce41b3b | |
parent | applconfig: Use rubric instead of definition list (diff) | |
download | rtems-central-765ed1cffb363ccf4b23dd2300abfed6ac1b6394.tar.bz2 |
applconfig: Check enabled for constraints
-rw-r--r-- | config.yml | 1 | ||||
-rw-r--r-- | rtemsspec/applconfig.py | 20 | ||||
-rw-r--r-- | rtemsspec/tests/spec-applconfig/l.yml | 2 | ||||
-rw-r--r-- | rtemsspec/tests/spec-applconfig/not-x.yml | 9 | ||||
-rw-r--r-- | rtemsspec/tests/test_applconfig.py | 1 |
5 files changed, 26 insertions, 7 deletions
@@ -76,6 +76,7 @@ glossary: target: modules/rtems-docs/eng/glossary.rst appl-config: doxygen-target: modules/rtems/cpukit/doxygen/appl-config.h + enabled: [] groups: - uid: /acfg/if/group-bdbuf target: modules/rtems-docs/c-user/config/bdbuf.rst diff --git a/rtemsspec/applconfig.py b/rtemsspec/applconfig.py index 70030b68..72e65de8 100644 --- a/rtemsspec/applconfig.py +++ b/rtemsspec/applconfig.py @@ -204,9 +204,12 @@ def _generate_feature(content: _ContentAdaptor, item: Item, content.substitute(_OPTION_DEFAULT_CONFIG[option_type](item))) -def _get_constraints(content: _ContentAdaptor, item: Item) -> List[str]: +def _get_constraints(content: _ContentAdaptor, item: Item, + enabled: List[str]) -> List[str]: constraints = [] # type: List[str] for parent in item.parents("constraint"): + if not parent.is_enabled(enabled): + continue content.register_license_and_copyrights_of_item(parent) constraints.append( content.substitute(parent["text"]).replace( @@ -214,8 +217,9 @@ def _get_constraints(content: _ContentAdaptor, item: Item) -> List[str]: return constraints -def _generate_constraints(content: _ContentAdaptor, item: Item) -> None: - constraints = _get_constraints(content, item) +def _generate_constraints(content: _ContentAdaptor, item: Item, + enabled: List[str]) -> None: + constraints = _get_constraints(content, item, enabled) if len(constraints) > 1: constraint_list = Content("BSD-2-Clause", False) prologue = ("The following constraints apply " @@ -241,7 +245,8 @@ _OPTION_GENERATORS = { } -def _generate(group: Item, options: ItemMap, content: _ContentAdaptor) -> None: +def _generate(group: Item, options: ItemMap, enabled: List[str], + content: _ContentAdaptor) -> None: content.register_license_and_copyrights_of_item(group) content.add_group(group.uid, group["name"], content.substitute(group["description"])) @@ -255,7 +260,7 @@ def _generate(group: Item, options: ItemMap, content: _ContentAdaptor) -> None: _OPTION_GENERATORS[option_type](content, item, option_type) content.add_option_description(content.substitute(item["description"])) content.add_option_notes(content.substitute(item["notes"])) - _generate_constraints(content, item) + _generate_constraints(content, item, enabled) content.add_licence_and_copyrights() @@ -317,6 +322,7 @@ def generate(config: dict, item_cache: ItemCache) -> None: with doxygen_content.content.defgroup_block( "RTEMSApplConfig", "Application Configuration Options"): doxygen_content.content.add("@ingroup RTEMSAPI") + enabled = config["enabled"] for group_config in config["groups"]: group = item_cache[group_config["uid"]] assert group.type == "interface/appl-config-group" @@ -325,9 +331,9 @@ def generate(config: dict, item_cache: ItemCache) -> None: assert child.type.startswith("interface/appl-config-option") options[child.uid] = child sphinx_content = _SphinxContentAdaptor(sphinx_mapper) - _generate(group, options, sphinx_content) + _generate(group, options, enabled, sphinx_content) sphinx_content.write(group_config["target"]) - _generate(group, options, doxygen_content) + _generate(group, options, enabled, doxygen_content) doxygen_content.content.prepend_copyrights_and_licenses() doxygen_content.content.prepend_spdx_license_identifier() doxygen_content.write(config["doxygen-target"]) diff --git a/rtemsspec/tests/spec-applconfig/l.yml b/rtemsspec/tests/spec-applconfig/l.yml index c0d5fe60..2e4881f9 100644 --- a/rtemsspec/tests/spec-applconfig/l.yml +++ b/rtemsspec/tests/spec-applconfig/l.yml @@ -14,6 +14,8 @@ links: uid: min-zero - role: constraint uid: max-two +- role: constraint + uid: not-x name: l notes: null type: interface diff --git a/rtemsspec/tests/spec-applconfig/not-x.yml b/rtemsspec/tests/spec-applconfig/not-x.yml new file mode 100644 index 00000000..a707666f --- /dev/null +++ b/rtemsspec/tests/spec-applconfig/not-x.yml @@ -0,0 +1,9 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: + not: X +links: [] +text: | + Not X. +type: constraint diff --git a/rtemsspec/tests/test_applconfig.py b/rtemsspec/tests/test_applconfig.py index c88f537f..adb8d3d4 100644 --- a/rtemsspec/tests/test_applconfig.py +++ b/rtemsspec/tests/test_applconfig.py @@ -37,6 +37,7 @@ def test_applconfig(tmpdir): item_cache = ItemCache(item_cache_config) applconfig_config = {} + applconfig_config["enabled"] = ["X"] g_rst = os.path.join(tmpdir, "g.rst") applconfig_config["groups"] = [{"uid": "/g", "target": g_rst}] doxygen_h = os.path.join(tmpdir, "doxygen.h") |