update generates files again

This commit is contained in:
2023-02-09 15:51:36 +01:00
parent 59689f2af6
commit 15f8b9d0fb
14 changed files with 709 additions and 107 deletions

View File

@ -29,6 +29,7 @@ GENERATE_CPP = True
COPY_CPP = True
GENERATE_HEADER = True
PRINT_OBJECTS = False
class BspConfig:
@ -83,7 +84,7 @@ VALUES(?,?)
"""
def parse_objects(bsp_select: BspType, print_object_list: bool = True):
def parse_objects(bsp_select: BspType, copy_to_eive_tmtc: bool):
cfg = BspConfig(bsp_select)
# fetch objects
object_parser = ObjectDefinitionParser(cfg.objects_defs)
@ -92,10 +93,10 @@ def parse_objects(bsp_select: BspType, print_object_list: bool = True):
list_items = sorted(subsystem_definitions.items())
_LOGGER.info(f"ObjectParser: Number of objects: {len(list_items)}")
if print_object_list:
if PRINT_OBJECTS:
PrettyPrinter.pprint(list_items)
handle_file_export(cfg, list_items)
handle_file_export(cfg, list_items, copy_to_eive_tmtc)
if EXPORT_TO_SQL:
_LOGGER.info("ObjectParser: Exporting to SQL")
sql_object_exporter(
@ -107,7 +108,7 @@ def parse_objects(bsp_select: BspType, print_object_list: bool = True):
)
def handle_file_export(cfg: BspConfig, list_items):
def handle_file_export(cfg: BspConfig, list_items, copy_to_eive_tmtc: bool):
if GENERATE_CPP:
_LOGGER.info("ObjectParser: Generating C++ translation file")
write_translation_file(
@ -130,8 +131,12 @@ def handle_file_export(cfg: BspConfig, list_items):
object_list=list_items,
file_separator=FILE_SEPARATOR,
)
copy_file(
filename=Path(cfg.csv_obj_filename),
destination=Path(CSV_COPY_DEST),
delete_existing_file=True,
)
if copy_to_eive_tmtc:
_LOGGER.info(
f"ObjectParser: Copying CSV file to {CSV_COPY_DEST}"
)
copy_file(
filename=Path(cfg.csv_obj_filename),
destination=Path(CSV_COPY_DEST),
delete_existing_file=True,
)

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 152 translations.
* Generated on: 2023-02-09 14:24:39
* Generated on: 2023-02-09 15:45:44
*/
#include "translateObjects.h"