diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-08-19 11:00:29 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-08-19 11:29:34 +0200 |
commit | 3e4902afb9e5b7b5611157552c8ee87319c247cc (patch) | |
tree | fa6d0f4598f35cdb7aea446165c6c1958080a165 | |
parent | doxygen: Sort group names (diff) | |
download | rtems-central-3e4902afb9e5b7b5611157552c8ee87319c247cc.tar.bz2 |
content: Add add_automatically_generated_warning()
-rw-r--r-- | rtemsspec/applconfig.py | 15 | ||||
-rw-r--r-- | rtemsspec/content.py | 14 |
2 files changed, 16 insertions, 13 deletions
diff --git a/rtemsspec/applconfig.py b/rtemsspec/applconfig.py index cc40fc6a..830b3222 100644 --- a/rtemsspec/applconfig.py +++ b/rtemsspec/applconfig.py @@ -53,15 +53,6 @@ _OPTION_DEFAULT_CONFIG = { enabled.""" } -_AUTOMATICALLY_GENERATED_WARNING = [ - "This file was automatically generated. Do not edit it manually.", - "Please have a look at", - "", - "https://docs.rtems.org/branches/master/eng/req/howto.html", - "", - "for information how to maintain and re-generate this file.", -] - class _ContentAdaptor: """ @@ -79,8 +70,7 @@ class _ContentAdaptor: def add_group(self, name: str, description: str) -> None: """ Adds an option group. """ - with self.content.comment_block(): - self.content.append(_AUTOMATICALLY_GENERATED_WARNING) + self.content.add_automatically_generated_warning() self.content.add_header(name, level=2) self.content.add(description) @@ -529,8 +519,7 @@ def generate(config: dict, item_cache: ItemCache) -> None: doxygen_mapper = ItemMapper(EmptyItem()) _add_doxygen_get_values(doxygen_mapper) doxygen_content = _DoxygenContentAdaptor(doxygen_mapper) - with doxygen_content.content.comment_block(): - doxygen_content.content.append(_AUTOMATICALLY_GENERATED_WARNING) + doxygen_content.content.add_automatically_generated_warning() with doxygen_content.content.defgroup_block( "RTEMSApplConfig", "Application Configuration Options"): doxygen_content.content.add("@ingroup RTEMSAPI") diff --git a/rtemsspec/content.py b/rtemsspec/content.py index 3c28ab66..131f8fec 100644 --- a/rtemsspec/content.py +++ b/rtemsspec/content.py @@ -158,6 +158,15 @@ def _add_context(_content: "Content") -> Iterator[None]: _SPECIAL_BLOCK = re.compile(r"^( *\* | *[0-9]+\. | +)") +_AUTOMATICALLY_GENERATED_WARNING = [ + "This file was automatically generated. Do not edit it manually.", + "Please have a look at", + "", + "https://docs.rtems.org/branches/master/eng/req/howto.html", + "", + "for information how to maintain and re-generate this file.", +] + class Content: """ This class builds content. """ @@ -409,6 +418,11 @@ class Content: yield self.close_comment_block() + def add_automatically_generated_warning(self) -> None: + """ Adds a warning that the file is automatically generated. """ + with self.comment_block(): + self.append(_AUTOMATICALLY_GENERATED_WARNING) + def write(self, path: str) -> None: """ Writes the content to the file specified by the path. """ directory = os.path.dirname(path) |