scripts: snippets: Preserve snippet processing order

This commit updates the `snippets.py` script to process the snippets
in the order that the `--snippet` arguments are specified, which
corresponds to the order of snippets listed in the `SNIPPET` CMake
variable.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit is contained in:
Stephanos Ioannidis 2023-04-22 00:28:09 +09:00 committed by Carles Cufí
parent 37c2a0d4a6
commit 4f5cb1bb1e

View file

@ -78,7 +78,7 @@ class Snippets(UserDict):
def __init__(self, requested: Iterable[str] = None):
super().__init__()
self.paths: Set[Path] = set()
self.requested: Set[str] = set(requested or [])
self.requested: List[str] = list(requested or [])
class SnippetsError(Exception):
'''Class for signalling expected errors'''
@ -138,9 +138,7 @@ set(SNIPPET_PATHS {snippet_path_list})
zephyr_create_scope(snippets)
''')
for snippet_name in snippet_names:
if snippet_name not in snippets.requested:
continue
for snippet_name in snippets.requested:
self.print_cmake_for(snippets[snippet_name])
self.print()