summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rtemsqual/applconfig.py6
-rw-r--r--rtemsqual/content.py8
-rw-r--r--rtemsqual/glossary.py2
-rw-r--r--rtemsqual/interface.py2
-rw-r--r--rtemsqual/items.py8
-rw-r--r--rtemsqual/validation.py2
6 files changed, 14 insertions, 14 deletions
diff --git a/rtemsqual/applconfig.py b/rtemsqual/applconfig.py
index 7b9be118..2d1b947d 100644
--- a/rtemsqual/applconfig.py
+++ b/rtemsqual/applconfig.py
@@ -128,7 +128,7 @@ def _resolve_constraint_links(content: SphinxContent, item: Item,
constraint["custom"] = []
for link in reversed(constraint["links"]):
other = item.map(link)
- other.register_license_and_copyrights(content)
+ content.register_license_and_copyrights_of_item(other)
constraint["custom"].append(other["text"])
@@ -190,12 +190,12 @@ def _generate_notes(content: SphinxContent, notes: Optional[str]) -> None:
def _generate_file(group: Item, options: ItemMap, target: str) -> None:
content = SphinxContent()
- group.register_license_and_copyrights(content)
+ content.register_license_and_copyrights_of_item(group)
content.add_header(group["appl-config-group-name"], level="=")
content.add(group["appl-config-group-description"])
for item in sorted(options.values(), key=lambda x: x.uid):
name = item["appl-config-option-name"]
- item.register_license_and_copyrights(content)
+ content.register_license_and_copyrights_of_item(item)
content.add_index_entries([name] + item["appl-config-option-index"])
content.add_label(name)
content.add_header(name, level="-")
diff --git a/rtemsqual/content.py b/rtemsqual/content.py
index 8be6c56f..46aa5699 100644
--- a/rtemsqual/content.py
+++ b/rtemsqual/content.py
@@ -31,6 +31,8 @@ import re
import textwrap
from typing import Callable, ContextManager, Iterator, List, Optional, Union
+from rtemsqual.items import Item
+
AddContext = Callable[["Content"], ContextManager[None]]
GenericContent = Union[str, List[str], "Content"]
@@ -267,6 +269,12 @@ class Content:
""" Registers a copyright statement for the content. """
self._copyrights.register(statement)
+ def register_license_and_copyrights_of_item(self, item: Item) -> None:
+ """ Registers the license and copyrights of the item. """
+ self.register_license(item["SPDX-License-Identifier"])
+ for statement in item["copyrights"]:
+ self.register_copyright(statement)
+
def write(self, path: str) -> None:
""" Writes the content to the file specified by the path. """
directory = os.path.dirname(path)
diff --git a/rtemsqual/glossary.py b/rtemsqual/glossary.py
index bcac7fca..e75e0da2 100644
--- a/rtemsqual/glossary.py
+++ b/rtemsqual/glossary.py
@@ -59,7 +59,7 @@ def _generate_glossary_content(terms: ItemMap) -> SphinxContent:
for item in sorted(terms.values(),
key=lambda x: x["glossary-term"].lower()):
text = macro_to_sphinx.substitute(item["text"].strip())
- item.register_license_and_copyrights(content)
+ content.register_license_and_copyrights_of_item(item)
with content.indent():
content.add_definition_item(item["glossary-term"], text)
content.add_licence_and_copyrights()
diff --git a/rtemsqual/interface.py b/rtemsqual/interface.py
index 7beddda1..6c9454dd 100644
--- a/rtemsqual/interface.py
+++ b/rtemsqual/interface.py
@@ -374,7 +374,7 @@ class HeaderFile:
ingroups = _get_ingroups(item)
self._ingroups.update(ingroups)
self._nodes[item.uid] = Node(self, item, ingroups)
- item.register_license_and_copyrights(self._content)
+ self._content.register_license_and_copyrights_of_item(item)
def add_potential_edge(self, node: Node, item: Item) -> None:
"""
diff --git a/rtemsqual/items.py b/rtemsqual/items.py
index 46ee7add..ce0c2bcf 100644
--- a/rtemsqual/items.py
+++ b/rtemsqual/items.py
@@ -33,8 +33,6 @@ from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, \
Tuple
import yaml
-from rtemsqual.content import Content
-
ItemMap = Dict[str, "Item"]
ItemGetValue = Callable[["Item", str, Any, str, Optional[int]], Any]
@@ -209,12 +207,6 @@ class Item:
""" Adds a link to a child item of this items. """
self._links_to_children.append(link)
- def register_license_and_copyrights(self, content: Content):
- """ Registers the license and copyrights of this item. """
- content.register_license(self["SPDX-License-Identifier"])
- for statement in self["copyrights"]:
- content.register_copyright(statement)
-
def is_enabled(self, enabled: List[str]):
""" Returns true if the item is enabled by the specified enables. """
return _is_enabled(enabled, self["enabled-by"])
diff --git a/rtemsqual/validation.py b/rtemsqual/validation.py
index e51653a1..0250c6eb 100644
--- a/rtemsqual/validation.py
+++ b/rtemsqual/validation.py
@@ -172,7 +172,7 @@ class SourceFile:
for item in itertools.chain(self._test_suites, self._test_cases):
includes.extend(item["includes"])
local_includes.extend(item["local-includes"])
- item.register_license_and_copyrights(content)
+ content.register_license_and_copyrights_of_item(item)
content.add_spdx_license_identifier()
with content.file_block():
_add_ingroup(content, self._test_suites, "RTEMSTestSuite",