Changeset fa46b668 in rtems-central


Ignore:
Timestamp:
May 6, 2020, 9:40:24 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
a5f3cc1
Parents:
6772014
git-author:
Sebastian Huber <sebastian.huber@…> (05/06/20 09:40:24)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/28/20 08:37:29)
Message:

Move license and copyright registration of items

This avoids a future cyclic dependency between the items and content
modules.

Location:
rtemsqual
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • rtemsqual/applconfig.py

    r6772014 rfa46b668  
    129129        for link in reversed(constraint["links"]):
    130130            other = item.map(link)
    131             other.register_license_and_copyrights(content)
     131            content.register_license_and_copyrights_of_item(other)
    132132            constraint["custom"].append(other["text"])
    133133
     
    191191def _generate_file(group: Item, options: ItemMap, target: str) -> None:
    192192    content = SphinxContent()
    193     group.register_license_and_copyrights(content)
     193    content.register_license_and_copyrights_of_item(group)
    194194    content.add_header(group["appl-config-group-name"], level="=")
    195195    content.add(group["appl-config-group-description"])
    196196    for item in sorted(options.values(), key=lambda x: x.uid):
    197197        name = item["appl-config-option-name"]
    198         item.register_license_and_copyrights(content)
     198        content.register_license_and_copyrights_of_item(item)
    199199        content.add_index_entries([name] + item["appl-config-option-index"])
    200200        content.add_label(name)
  • rtemsqual/content.py

    r6772014 rfa46b668  
    3131import textwrap
    3232from typing import Callable, ContextManager, Iterator, List, Optional, Union
     33
     34from rtemsqual.items import Item
    3335
    3436AddContext = Callable[["Content"], ContextManager[None]]
     
    268270        self._copyrights.register(statement)
    269271
     272    def register_license_and_copyrights_of_item(self, item: Item) -> None:
     273        """ Registers the license and copyrights of the item. """
     274        self.register_license(item["SPDX-License-Identifier"])
     275        for statement in item["copyrights"]:
     276            self.register_copyright(statement)
     277
    270278    def write(self, path: str) -> None:
    271279        """ Writes the content to the file specified by the path. """
  • rtemsqual/glossary.py

    r6772014 rfa46b668  
    6060                       key=lambda x: x["glossary-term"].lower()):
    6161        text = macro_to_sphinx.substitute(item["text"].strip())
    62         item.register_license_and_copyrights(content)
     62        content.register_license_and_copyrights_of_item(item)
    6363        with content.indent():
    6464            content.add_definition_item(item["glossary-term"], text)
  • rtemsqual/interface.py

    r6772014 rfa46b668  
    375375        self._ingroups.update(ingroups)
    376376        self._nodes[item.uid] = Node(self, item, ingroups)
    377         item.register_license_and_copyrights(self._content)
     377        self._content.register_license_and_copyrights_of_item(item)
    378378
    379379    def add_potential_edge(self, node: Node, item: Item) -> None:
  • rtemsqual/items.py

    r6772014 rfa46b668  
    3434import yaml
    3535
    36 from rtemsqual.content import Content
    37 
    3836ItemMap = Dict[str, "Item"]
    3937ItemGetValue = Callable[["Item", str, Any, str, Optional[int]], Any]
     
    209207        """ Adds a link to a child item of this items. """
    210208        self._links_to_children.append(link)
    211 
    212     def register_license_and_copyrights(self, content: Content):
    213         """ Registers the license and copyrights of this item. """
    214         content.register_license(self["SPDX-License-Identifier"])
    215         for statement in self["copyrights"]:
    216             content.register_copyright(statement)
    217209
    218210    def is_enabled(self, enabled: List[str]):
  • rtemsqual/validation.py

    r6772014 rfa46b668  
    173173            includes.extend(item["includes"])
    174174            local_includes.extend(item["local-includes"])
    175             item.register_license_and_copyrights(content)
     175            content.register_license_and_copyrights_of_item(item)
    176176        content.add_spdx_license_identifier()
    177177        with content.file_block():
Note: See TracChangeset for help on using the changeset viewer.