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

@ -23,13 +23,15 @@ _LOGGER = logging.getLogger(__name__)
DATE_TODAY = datetime.datetime.now()
DATE_STRING_FULL = DATE_TODAY.strftime("%Y-%m-%d %H:%M:%S")
PRINT_EVENTS = False
PRINT_SUBSYSTEM_TABLE = False
GENERATE_CPP = True
GENERATE_CPP_H = True
GENERATE_CSV = True
COPY_CPP_FILE = True
COPY_CPP_H_FILE = True
MOVE_CSV_FILE = True
PRINT_EVENTS = False
PARSE_HOST_BSP = True
@ -89,10 +91,10 @@ class BspConfig:
def parse_events(
bsp_type: BspType, generate_csv: bool = True, generate_cpp: bool = True
bsp_type: BspType, generate_csv: bool, generate_cpp: bool, copy_csv_to_eive_tmtc: bool
):
bsp_cfg = BspConfig(bsp_type)
_LOGGER.info("EventParser: Parsing events: ")
_LOGGER.info(f"EventParser: Parsing events for {bsp_type.name}")
# Small delay for clean printout
time.sleep(0.01)
event_list = generate_event_list(bsp_cfg)
@ -106,12 +108,13 @@ def parse_events(
event_list=event_list,
file_separator=FILE_SEPARATOR,
)
_LOGGER.info(f"Copying CSV file to {bsp_cfg.cpp_copy_dest}")
copy_file(
filename=bsp_cfg.csv_filename,
destination=bsp_cfg.csv_copy_dest,
delete_existing_file=True,
)
if copy_csv_to_eive_tmtc:
_LOGGER.info(f"Copying CSV file to {bsp_cfg.cpp_copy_dest}")
copy_file(
filename=bsp_cfg.csv_filename,
destination=bsp_cfg.csv_copy_dest,
delete_existing_file=True,
)
if generate_cpp:
handle_cpp_export(
@ -127,13 +130,15 @@ def parse_events(
)
copy_file(CPP_FILENAME, bsp_cfg.cpp_copy_dest)
copy_file(CPP_H_FILENAME, bsp_cfg.cpp_copy_dest)
_LOGGER.info(f"Parsing done for {bsp_type.name}")
def generate_event_list(cfg: BspConfig) -> EventDictT:
subsystem_parser = SubsystemDefinitionParser(cfg.subsystem_defs_as_paths())
subsystem_table = subsystem_parser.parse_files()
_LOGGER.info(f"Found {len(subsystem_table)} subsystem definitions.")
PrettyPrinter.pprint(subsystem_table)
if PRINT_SUBSYSTEM_TABLE:
PrettyPrinter.pprint(subsystem_table)
event_header_parser = FileListParser(cfg.header_defs_as_paths())
event_headers = event_header_parser.parse_header_files(
True, "Parsing event header file list:\n", True