From bdbd21acd3c3a0e63954c3d40cad6e6f92e373d3 Mon Sep 17 00:00:00 2001 From: Holger Lamm Date: Thu, 4 Apr 2024 23:04:33 +0200 Subject: [PATCH] Python is python --- hammocking/hammocking.py | 14 +++++++------- tests/data/mini_c_test/CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hammocking/hammocking.py b/hammocking/hammocking.py index b40852c..84a6cc6 100755 --- a/hammocking/hammocking.py +++ b/hammocking/hammocking.py @@ -65,12 +65,12 @@ def is_array(self) -> bool: or self.t.kind == TypeKind.INCOMPLETEARRAY \ or self.t.kind == TypeKind.VARIABLEARRAY \ or self.t.kind == TypeKind.DEPENDENTSIZEDARRAY - + @property def is_struct(self) -> bool: fields = list(self.t.get_canonical().get_fields()) return len(fields) > 0 - + def initializer(self) -> str: if self.is_struct: return f"({self.spelling}){{0}}" @@ -96,9 +96,9 @@ def __init__(self, configfile: Path = None): return config = configparser.ConfigParser() config.read_string(configfile.read_text()) - # Read generic settings + # Read generic settings self._scan(config.items(section=self.section)) - # Read OS-specific settings + # Read OS-specific settings self._scan(config.items(section=f"{self.section}.{sys.platform}")) def _scan(self, items: Iterator[Tuple[str, str]]) -> None: @@ -132,13 +132,13 @@ def get_definition(self, with_type: bool = True) -> str: return self._type.render(self.name) else: return self.name - + def is_constant(self) -> bool: """Is constant qualified""" return self._type.is_constant - + def initializer(self) -> str: - """C expression to represent the value "0" according to the variable type""" + """C expression to represent the value "0" according to the variable type""" return self._type.initializer() def __repr__(self) -> str: diff --git a/tests/data/mini_c_test/CMakeLists.txt b/tests/data/mini_c_test/CMakeLists.txt index 20b522e..c59b31c 100644 --- a/tests/data/mini_c_test/CMakeLists.txt +++ b/tests/data/mini_c_test/CMakeLists.txt @@ -47,7 +47,7 @@ add_custom_command( BYPRODUCTS mockup.h WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} COMMAND_EXPAND_LISTS - COMMAND python3 ${HAMMOCK_DIR}/hammocking.py --sources ${PROD_SRC} --plink ${CMAKE_CURRENT_BINARY_DIR}/${PROD_PARTIAL_LINK} --outdir ${CMAKE_CURRENT_BINARY_DIR} "-I$,;-I>" + COMMAND python ${HAMMOCK_DIR}/hammocking.py --sources ${PROD_SRC} --plink ${CMAKE_CURRENT_BINARY_DIR}/${PROD_PARTIAL_LINK} --outdir ${CMAKE_CURRENT_BINARY_DIR} "-I$,;-I>" DEPENDS ${HAMMOCK_DIR}/hammocking.py ${PROD_PARTIAL_LINK}