update generator scripts
This commit is contained in:
parent
b8a4384c91
commit
2a730df2a8
@ -2,9 +2,18 @@ import os
|
|||||||
import enum
|
import enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
PATH_VAR_ROOT = Path(os.path.abspath(os.curdir))
|
|
||||||
ROOT_DIR = PATH_VAR_ROOT.absolute()
|
def determine_obsw_root_path() -> str:
|
||||||
OBSW_ROOT_DIR = PATH_VAR_ROOT.parent.absolute()
|
for _ in range(5):
|
||||||
|
if os.path.exists("CMakeLists.txt"):
|
||||||
|
return os.curdir
|
||||||
|
else:
|
||||||
|
os.chdir("..")
|
||||||
|
|
||||||
|
|
||||||
|
PATH_VAR_ROOT = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
ROOT_DIR = PATH_VAR_ROOT
|
||||||
|
OBSW_ROOT_DIR = Path(determine_obsw_root_path())
|
||||||
DATABASE_NAME = "eive_mod.db"
|
DATABASE_NAME = "eive_mod.db"
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,12 +3,17 @@ Event exporter.
|
|||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
from fsfwgen.events.event_parser import handle_csv_export, handle_cpp_export, \
|
from fsfwgen.events.event_parser import (
|
||||||
SubsystemDefinitionParser, EventParser
|
handle_csv_export,
|
||||||
|
handle_cpp_export,
|
||||||
|
SubsystemDefinitionParser,
|
||||||
|
EventParser,
|
||||||
|
)
|
||||||
from fsfwgen.parserbase.file_list_parser import FileListParser
|
from fsfwgen.parserbase.file_list_parser import FileListParser
|
||||||
from fsfwgen.utility.printer import PrettyPrinter
|
from fsfwgen.utility.printer import PrettyPrinter
|
||||||
from fsfwgen.utility.file_management import copy_file, move_file
|
from fsfwgen.utility.file_management import copy_file
|
||||||
from fsfwgen.core import get_console_logger
|
from fsfwgen.core import get_console_logger
|
||||||
from definitions import BspType, ROOT_DIR, OBSW_ROOT_DIR
|
from definitions import BspType, ROOT_DIR, OBSW_ROOT_DIR
|
||||||
|
|
||||||
@ -25,15 +30,16 @@ MOVE_CSV_FILE = True
|
|||||||
|
|
||||||
PARSE_HOST_BSP = True
|
PARSE_HOST_BSP = True
|
||||||
|
|
||||||
CPP_FILENAME = f'{__package__}/translateEvents.cpp'
|
# Store these files relative to the events folder
|
||||||
CPP_H_FILENAME = f'{__package__}/translateEvents.h'
|
CPP_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.cpp"
|
||||||
|
CPP_H_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}/translateEvents.h"
|
||||||
|
|
||||||
BSP_SELECT = BspType.BSP_Q7S
|
BSP_SELECT = BspType.BSP_Q7S
|
||||||
|
|
||||||
BSP_DIR_NAME = BSP_SELECT.value
|
BSP_DIR_NAME = BSP_SELECT.value
|
||||||
|
|
||||||
CSV_FILENAME = f"{BSP_SELECT.value}_events.csv"
|
# Store this file in the root of the generators folder
|
||||||
CSV_MOVE_DESTINATION = f'{ROOT_DIR}'
|
CSV_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_events.csv"
|
||||||
|
|
||||||
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
|
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
|
||||||
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/linux/fsfwconfig"
|
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/linux/fsfwconfig"
|
||||||
@ -47,11 +53,15 @@ FILE_SEPARATOR = ";"
|
|||||||
SUBSYSTEM_DEFINITION_DESTINATIONS = [
|
SUBSYSTEM_DEFINITION_DESTINATIONS = [
|
||||||
f"{FSFW_CONFIG_ROOT}/events/subsystemIdRanges.h",
|
f"{FSFW_CONFIG_ROOT}/events/subsystemIdRanges.h",
|
||||||
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/events/fwSubsystemIdRanges.h",
|
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/events/fwSubsystemIdRanges.h",
|
||||||
f"{OBSW_ROOT_DIR}/common/config/commonSubsystemIds.h"
|
f"{OBSW_ROOT_DIR}/common/config/commonSubsystemIds.h",
|
||||||
]
|
]
|
||||||
HEADER_DEFINITION_DESTINATIONS = [
|
HEADER_DEFINITION_DESTINATIONS = [
|
||||||
f"{OBSW_ROOT_DIR}/mission/", f"{OBSW_ROOT_DIR}/fsfw/", f"{FSFW_CONFIG_ROOT}",
|
f"{OBSW_ROOT_DIR}/mission/",
|
||||||
f"{OBSW_ROOT_DIR}/test/", f"{OBSW_ROOT_DIR}/bsp_q7s", f"{OBSW_ROOT_DIR}/linux/"
|
f"{OBSW_ROOT_DIR}/fsfw/",
|
||||||
|
f"{FSFW_CONFIG_ROOT}",
|
||||||
|
f"{OBSW_ROOT_DIR}/test/",
|
||||||
|
f"{OBSW_ROOT_DIR}/bsp_q7s",
|
||||||
|
f"{OBSW_ROOT_DIR}/linux/",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -73,11 +83,14 @@ def parse_events(
|
|||||||
)
|
)
|
||||||
if generate_cpp:
|
if generate_cpp:
|
||||||
handle_cpp_export(
|
handle_cpp_export(
|
||||||
event_list=event_list, date_string=DATE_STRING_FULL, file_name=CPP_FILENAME,
|
event_list=event_list,
|
||||||
generate_header=GENERATE_CPP_H, header_file_name=CPP_H_FILENAME
|
date_string=DATE_STRING_FULL,
|
||||||
|
file_name=CPP_FILENAME,
|
||||||
|
generate_header=GENERATE_CPP_H,
|
||||||
|
header_file_name=CPP_H_FILENAME,
|
||||||
)
|
)
|
||||||
if COPY_CPP_FILE:
|
if COPY_CPP_FILE:
|
||||||
LOGGER.info(f'EventParser: Copying file to {CPP_COPY_DESTINATION}')
|
LOGGER.info(f"EventParser: Copying file to {CPP_COPY_DESTINATION}")
|
||||||
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
|
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
|
||||||
copy_file(CPP_H_FILENAME, CPP_COPY_DESTINATION)
|
copy_file(CPP_H_FILENAME, CPP_COPY_DESTINATION)
|
||||||
|
|
||||||
@ -85,7 +98,7 @@ def parse_events(
|
|||||||
def generate_event_list() -> list:
|
def generate_event_list() -> list:
|
||||||
subsystem_parser = SubsystemDefinitionParser(SUBSYSTEM_DEFINITION_DESTINATIONS)
|
subsystem_parser = SubsystemDefinitionParser(SUBSYSTEM_DEFINITION_DESTINATIONS)
|
||||||
subsystem_table = subsystem_parser.parse_files()
|
subsystem_table = subsystem_parser.parse_files()
|
||||||
LOGGER.info(f'Found {len(subsystem_table)} subsystem definitions.')
|
LOGGER.info(f"Found {len(subsystem_table)} subsystem definitions.")
|
||||||
PrettyPrinter.pprint(subsystem_table)
|
PrettyPrinter.pprint(subsystem_table)
|
||||||
event_header_parser = FileListParser(HEADER_DEFINITION_DESTINATIONS)
|
event_header_parser = FileListParser(HEADER_DEFINITION_DESTINATIONS)
|
||||||
event_headers = event_header_parser.parse_header_files(
|
event_headers = event_header_parser.parse_header_files(
|
||||||
@ -94,8 +107,9 @@ def generate_event_list() -> list:
|
|||||||
# PrettyPrinter.pprint(event_headers)
|
# PrettyPrinter.pprint(event_headers)
|
||||||
# myEventList = parseHeaderFiles(subsystem_table, event_headers)
|
# myEventList = parseHeaderFiles(subsystem_table, event_headers)
|
||||||
event_parser = EventParser(event_headers, subsystem_table)
|
event_parser = EventParser(event_headers, subsystem_table)
|
||||||
|
event_parser.obsw_root_path = OBSW_ROOT_DIR
|
||||||
event_parser.set_moving_window_mode(moving_window_size=7)
|
event_parser.set_moving_window_mode(moving_window_size=7)
|
||||||
event_table = event_parser.parse_files()
|
event_table = event_parser.parse_files()
|
||||||
event_list = sorted(event_table.items())
|
event_list = sorted(event_table.items())
|
||||||
LOGGER.info(f'Found {len(event_list)} entries')
|
LOGGER.info(f"Found {len(event_list)} entries")
|
||||||
return event_list
|
return event_list
|
||||||
|
@ -4,26 +4,31 @@ import time
|
|||||||
from objects.objects import parse_objects
|
from objects.objects import parse_objects
|
||||||
from events.event_parser import parse_events
|
from events.event_parser import parse_events
|
||||||
from returnvalues.returnvalues_parser import parse_returnvalues
|
from returnvalues.returnvalues_parser import parse_returnvalues
|
||||||
from fsfwgen.core import return_generic_args_parser, init_printout, get_console_logger, ParserTypes
|
from fsfwgen.core import (
|
||||||
|
return_generic_args_parser,
|
||||||
|
init_printout,
|
||||||
|
get_console_logger,
|
||||||
|
ParserTypes,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
init_printout(project_string='EIVE')
|
init_printout(project_string="EIVE")
|
||||||
parser = return_generic_args_parser()
|
parser = return_generic_args_parser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.type == 'objects':
|
if args.type == "objects":
|
||||||
LOGGER.info(f'Generating objects data..')
|
LOGGER.info(f"Generating objects data..")
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
parse_objects()
|
parse_objects()
|
||||||
elif args.type == 'events':
|
elif args.type == "events":
|
||||||
LOGGER.info(f'Generating event data')
|
LOGGER.info(f"Generating event data")
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
parse_events()
|
parse_events()
|
||||||
elif args.type == 'returnvalues':
|
elif args.type == "returnvalues":
|
||||||
LOGGER.info('Generating returnvalue data')
|
LOGGER.info("Generating returnvalue data")
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
parse_returnvalues()
|
parse_returnvalues()
|
||||||
pass
|
pass
|
||||||
|
@ -2,13 +2,18 @@
|
|||||||
Object exporter.
|
Object exporter.
|
||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
|
|
||||||
from fsfwgen.core import get_console_logger
|
from fsfwgen.core import get_console_logger
|
||||||
from fsfwgen.objects.objects import sql_object_exporter, ObjectDefinitionParser, \
|
from fsfwgen.objects.objects import (
|
||||||
write_translation_file, \
|
sql_object_exporter,
|
||||||
export_object_file, write_translation_header_file
|
ObjectDefinitionParser,
|
||||||
|
write_translation_file,
|
||||||
|
export_object_file,
|
||||||
|
write_translation_header_file,
|
||||||
|
)
|
||||||
from fsfwgen.utility.printer import PrettyPrinter
|
from fsfwgen.utility.printer import PrettyPrinter
|
||||||
from fsfwgen.utility.file_management import copy_file, move_file
|
from fsfwgen.utility.file_management import copy_file
|
||||||
|
|
||||||
from definitions import BspType, DATABASE_NAME, OBSW_ROOT_DIR, ROOT_DIR
|
from definitions import BspType, DATABASE_NAME, OBSW_ROOT_DIR, ROOT_DIR
|
||||||
|
|
||||||
@ -34,16 +39,17 @@ else:
|
|||||||
EXPORT_TO_SQL = True
|
EXPORT_TO_SQL = True
|
||||||
|
|
||||||
CPP_COPY_DESTINATION = f"{FSFW_CONFIG_ROOT}/objects/"
|
CPP_COPY_DESTINATION = f"{FSFW_CONFIG_ROOT}/objects/"
|
||||||
CSV_MOVE_DESTINATION = f"{ROOT_DIR}"
|
CPP_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}//translateObjects.cpp"
|
||||||
CPP_FILENAME = f'{__package__}/translateObjects.cpp'
|
CPP_H_FILENAME = f"{os.path.dirname(os.path.realpath(__file__))}//translateObjects.h"
|
||||||
CPP_H_FILENAME = f'{__package__}/translateObjects.h'
|
CSV_OBJECT_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_objects.csv"
|
||||||
CSV_OBJECT_FILENAME = f"{BSP_SELECT.value}_objects.csv"
|
|
||||||
FILE_SEPARATOR = ";"
|
FILE_SEPARATOR = ";"
|
||||||
|
|
||||||
|
|
||||||
OBJECTS_PATH = f"{FSFW_CONFIG_ROOT}/objects/systemObjectList.h"
|
OBJECTS_PATH = f"{FSFW_CONFIG_ROOT}/objects/systemObjectList.h"
|
||||||
FRAMEWORK_OBJECT_PATH = f'{OBSW_ROOT_DIR}/fsfw/src/fsfw/objectmanager/frameworkObjects.h'
|
FRAMEWORK_OBJECT_PATH = (
|
||||||
COMMON_OBJECTS_PATH = f'{OBSW_ROOT_DIR}/common/config/commonObjects.h'
|
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/objectmanager/frameworkObjects.h"
|
||||||
|
)
|
||||||
|
COMMON_OBJECTS_PATH = f"{OBSW_ROOT_DIR}/common/config/commonObjects.h"
|
||||||
OBJECTS_DEFINITIONS = [OBJECTS_PATH, FRAMEWORK_OBJECT_PATH, COMMON_OBJECTS_PATH]
|
OBJECTS_DEFINITIONS = [OBJECTS_PATH, FRAMEWORK_OBJECT_PATH, COMMON_OBJECTS_PATH]
|
||||||
|
|
||||||
SQL_DELETE_OBJECTS_CMD = """
|
SQL_DELETE_OBJECTS_CMD = """
|
||||||
@ -70,35 +76,41 @@ def parse_objects(print_object_list: bool = True):
|
|||||||
subsystem_definitions = object_parser.parse_files()
|
subsystem_definitions = object_parser.parse_files()
|
||||||
# id_subsystem_definitions.update(framework_subsystem_definitions)
|
# id_subsystem_definitions.update(framework_subsystem_definitions)
|
||||||
list_items = sorted(subsystem_definitions.items())
|
list_items = sorted(subsystem_definitions.items())
|
||||||
LOGGER.info(f'ObjectParser: Number of objects: {len(list_items)}')
|
LOGGER.info(f"ObjectParser: Number of objects: {len(list_items)}")
|
||||||
|
|
||||||
if print_object_list:
|
if print_object_list:
|
||||||
PrettyPrinter.pprint(list_items)
|
PrettyPrinter.pprint(list_items)
|
||||||
|
|
||||||
handle_file_export(list_items)
|
handle_file_export(list_items)
|
||||||
if EXPORT_TO_SQL:
|
if EXPORT_TO_SQL:
|
||||||
LOGGER.info('ObjectParser: Exporting to SQL')
|
LOGGER.info("ObjectParser: Exporting to SQL")
|
||||||
sql_object_exporter(
|
sql_object_exporter(
|
||||||
object_table=list_items, delete_cmd=SQL_DELETE_OBJECTS_CMD,
|
object_table=list_items,
|
||||||
|
delete_cmd=SQL_DELETE_OBJECTS_CMD,
|
||||||
insert_cmd=SQL_INSERT_INTO_OBJECTS_CMD,
|
insert_cmd=SQL_INSERT_INTO_OBJECTS_CMD,
|
||||||
create_cmd=SQL_CREATE_OBJECTS_CMD, db_filename=f"{ROOT_DIR}/{DATABASE_NAME}"
|
create_cmd=SQL_CREATE_OBJECTS_CMD,
|
||||||
|
db_filename=f"{ROOT_DIR}/{DATABASE_NAME}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_file_export(list_items):
|
def handle_file_export(list_items):
|
||||||
if GENERATE_CPP:
|
if GENERATE_CPP:
|
||||||
LOGGER.info('ObjectParser: Generating translation C++ file')
|
LOGGER.info("ObjectParser: Generating C++ translation file")
|
||||||
write_translation_file(
|
write_translation_file(
|
||||||
filename=CPP_FILENAME, list_of_entries=list_items, date_string_full=DATE_STRING_FULL
|
filename=CPP_FILENAME,
|
||||||
|
list_of_entries=list_items,
|
||||||
|
date_string_full=DATE_STRING_FULL,
|
||||||
)
|
)
|
||||||
if COPY_CPP:
|
if COPY_CPP:
|
||||||
print("ObjectParser: Copying object file to " + CPP_COPY_DESTINATION)
|
LOGGER.info("ObjectParser: Copying object file to " + CPP_COPY_DESTINATION)
|
||||||
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
|
copy_file(CPP_FILENAME, CPP_COPY_DESTINATION)
|
||||||
if GENERATE_HEADER:
|
if GENERATE_HEADER:
|
||||||
write_translation_header_file(filename=CPP_H_FILENAME)
|
write_translation_header_file(filename=CPP_H_FILENAME)
|
||||||
copy_file(filename=CPP_H_FILENAME, destination=CPP_COPY_DESTINATION)
|
copy_file(filename=CPP_H_FILENAME, destination=CPP_COPY_DESTINATION)
|
||||||
if GENERATE_CSV:
|
if GENERATE_CSV:
|
||||||
print("ObjectParser: Generating text export.")
|
LOGGER.info("ObjectParser: Generating text export")
|
||||||
export_object_file(
|
export_object_file(
|
||||||
filename=CSV_OBJECT_FILENAME, object_list=list_items, file_separator=FILE_SEPARATOR
|
filename=CSV_OBJECT_FILENAME,
|
||||||
|
object_list=list_items,
|
||||||
|
file_separator=FILE_SEPARATOR,
|
||||||
)
|
)
|
||||||
|
@ -24,33 +24,34 @@ EXPORT_TO_SQL = True
|
|||||||
PRINT_TABLES = True
|
PRINT_TABLES = True
|
||||||
|
|
||||||
|
|
||||||
FILE_SEPARATOR = ';'
|
FILE_SEPARATOR = ";"
|
||||||
MAX_STRING_LENGTH = 32
|
MAX_STRING_LENGTH = 32
|
||||||
|
|
||||||
BSP_SELECT = BspType.BSP_Q7S
|
BSP_SELECT = BspType.BSP_Q7S
|
||||||
BSP_DIR_NAME = BSP_SELECT.value
|
BSP_DIR_NAME = BSP_SELECT.value
|
||||||
CSV_RETVAL_FILENAME = f'{BSP_SELECT.value}_returnvalues.csv'
|
CSV_RETVAL_FILENAME = f"{ROOT_DIR}/{BSP_SELECT.value}_returnvalues.csv"
|
||||||
CSV_MOVE_DESTINATION = f'{ROOT_DIR}'
|
|
||||||
ADD_LINUX_FOLDER = False
|
ADD_LINUX_FOLDER = False
|
||||||
|
|
||||||
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
|
if BSP_SELECT == BspType.BSP_Q7S or BSP_SELECT == BspType.BSP_LINUX_BOARD:
|
||||||
FSFW_CONFIG_ROOT = f'{OBSW_ROOT_DIR}/linux/fsfwconfig'
|
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/linux/fsfwconfig"
|
||||||
ADD_LINUX_FOLDER = True
|
ADD_LINUX_FOLDER = True
|
||||||
else:
|
else:
|
||||||
FSFW_CONFIG_ROOT = f'{OBSW_ROOT_DIR}/{BSP_DIR_NAME}/fsfwconfig'
|
FSFW_CONFIG_ROOT = f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}/fsfwconfig"
|
||||||
BSP_PATH = f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}"
|
BSP_PATH = f"{OBSW_ROOT_DIR}/{BSP_DIR_NAME}"
|
||||||
|
|
||||||
INTERFACE_DEFINITION_FILES = [
|
INTERFACE_DEFINITION_FILES = [
|
||||||
f'{OBSW_ROOT_DIR}/fsfw/src/fsfw/returnvalues/FwClassIds.h',
|
f"{OBSW_ROOT_DIR}/fsfw/src/fsfw/returnvalues/FwClassIds.h",
|
||||||
f'{OBSW_ROOT_DIR}/common/config/commonClassIds.h',
|
f"{OBSW_ROOT_DIR}/common/config/commonClassIds.h",
|
||||||
f'{FSFW_CONFIG_ROOT}/returnvalues/classIds.h'
|
f"{FSFW_CONFIG_ROOT}/returnvalues/classIds.h",
|
||||||
]
|
]
|
||||||
RETURNVALUE_SOURCES = [
|
RETURNVALUE_SOURCES = [
|
||||||
f'{OBSW_ROOT_DIR}/mission/', f'{OBSW_ROOT_DIR}/fsfw/', f'{BSP_PATH}'
|
f"{OBSW_ROOT_DIR}/mission/",
|
||||||
|
f"{OBSW_ROOT_DIR}/fsfw/",
|
||||||
|
f"{BSP_PATH}",
|
||||||
]
|
]
|
||||||
|
|
||||||
if ADD_LINUX_FOLDER:
|
if ADD_LINUX_FOLDER:
|
||||||
RETURNVALUE_SOURCES.append(f'{OBSW_ROOT_DIR}/linux')
|
RETURNVALUE_SOURCES.append(f"{OBSW_ROOT_DIR}/linux")
|
||||||
|
|
||||||
SQL_DELETE_RETURNVALUES_CMD = """
|
SQL_DELETE_RETURNVALUES_CMD = """
|
||||||
DROP TABLE IF EXISTS Returnvalues
|
DROP TABLE IF EXISTS Returnvalues
|
||||||
@ -76,12 +77,16 @@ VALUES(?,?,?,?,?)
|
|||||||
def parse_returnvalues():
|
def parse_returnvalues():
|
||||||
returnvalue_table = generate_returnvalue_table()
|
returnvalue_table = generate_returnvalue_table()
|
||||||
if EXPORT_TO_FILE:
|
if EXPORT_TO_FILE:
|
||||||
ReturnValueParser.export_to_file(CSV_RETVAL_FILENAME, returnvalue_table, FILE_SEPARATOR)
|
ReturnValueParser.export_to_file(
|
||||||
|
CSV_RETVAL_FILENAME, returnvalue_table, FILE_SEPARATOR
|
||||||
|
)
|
||||||
# if MOVE_CSV_FILE:
|
# if MOVE_CSV_FILE:
|
||||||
# move_file(file_name=CSV_RETVAL_FILENAME, destination=CSV_MOVE_DESTINATION)
|
# move_file(file_name=CSV_RETVAL_FILENAME, destination=CSV_MOVE_DESTINATION)
|
||||||
if EXPORT_TO_SQL:
|
if EXPORT_TO_SQL:
|
||||||
LOGGER.info('ReturnvalueParser: Exporting to SQL')
|
LOGGER.info("ReturnvalueParser: Exporting to SQL")
|
||||||
sql_retval_exporter(returnvalue_table, db_filename=f"{ROOT_DIR}/{DATABASE_NAME}")
|
sql_retval_exporter(
|
||||||
|
returnvalue_table, db_filename=f"{ROOT_DIR}/{DATABASE_NAME}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def generate_returnvalue_table():
|
def generate_returnvalue_table():
|
||||||
@ -104,10 +109,8 @@ def sql_retval_exporter(returnvalue_table, db_filename: str):
|
|||||||
sql_writer.open(SQL_CREATE_RETURNVALUES_CMD)
|
sql_writer.open(SQL_CREATE_RETURNVALUES_CMD)
|
||||||
for entry in returnvalue_table.items():
|
for entry in returnvalue_table.items():
|
||||||
sql_writer.write_entries(
|
sql_writer.write_entries(
|
||||||
SQL_INSERT_RETURNVALUES_CMD, (entry[0],
|
SQL_INSERT_RETURNVALUES_CMD,
|
||||||
entry[1][2],
|
(entry[0], entry[1][2], entry[1][4], entry[1][3], entry[1][1]),
|
||||||
entry[1][4],
|
)
|
||||||
entry[1][3],
|
|
||||||
entry[1][1]))
|
|
||||||
sql_writer.commit()
|
sql_writer.commit()
|
||||||
sql_writer.close()
|
sql_writer.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user