[DEV] cahnge config file

This commit is contained in:
Edouard DUPIN 2022-02-06 23:20:50 +01:00
parent 88834cc4d0
commit c31aad7e01
2 changed files with 67 additions and 43 deletions

View File

@ -12,6 +12,7 @@
import sys import sys
import os import os
import copy import copy
import json
from realog import debug as debug from realog import debug as debug
import lutin import lutin
import death.Arguments as arguments import death.Arguments as arguments
@ -175,7 +176,7 @@ def usage(full=False):
print(" ex complex arguments : " + sys.argv[0] + " -cclang -mdebug zeus-package-base?build?run%zeus-launcher:--srv=user:--elog-level=5") print(" ex complex arguments : " + sys.argv[0] + " -cclang -mdebug zeus-package-base?build?run%zeus-launcher:--srv=user:--elog-level=5")
print(" ex gcov: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov") print(" ex gcov: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov")
print(" ex gcov with output: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov:output") print(" ex gcov with output: " + sys.argv[0] + " -cgcc --gcov -mdebug etk-test?build?run etk?gcov:output")
print(" ex multiple test execution with end resume: " + sys.argv[0] + " --async-fail -cgcc -mdebug *-test?build?run") print(" ex multiple test execution with end resume: " + sys.argv[0] + " -cgcc -mdebug *-test?build?run")
exit(0) exit(0)
@ -314,58 +315,74 @@ def parseGenericArg(argument, active):
return True return True
return False return False
"""
simple configuration in file ".lutin/config.json"
{
"exclude-path":[
"archive",
"sdk"
],
"parsing-depth": 3,
"jobs": 12,
"color: true,
"debug-level": 3,
"print-pretty": true,
"isolate-system": false,
"force-optimization": false
}
"""
# open configuration of lutin: # open configuration of lutin:
config_file_name = "lutinConfig.py" config_file_name = ".lutin/config.json"
config_file = os.path.join(tools.get_run_path(), config_file_name) config_file = os.path.join(tools.get_run_path(), config_file_name)
if os.path.isfile(config_file) == True: if os.path.isfile(config_file) == True:
sys.path.append(os.path.dirname(config_file)) sys.path.append(os.path.dirname(config_file));
debug.debug("Find basic configuration file: '" + config_file + "'") debug.debug("Find basic configuration file: '" + config_file + "'");
config_data_file = tools.file_read_data(config_file);
# the file exist, we can open it and get the initial configuration: # the file exist, we can open it and get the initial configuration:
configuration_file = __import__(config_file_name[:-3]) config_data = json.loads(config_data_file);
if "get_exclude_path" in dir(configuration_file): if "exclude-path" in config_data.keys():
data = configuration_file.get_exclude_path() data = config_data["exclude-path"];
debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'") debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
env.set_exclude_search_path(data) env.set_exclude_search_path(data)
if "get_parsing_depth" in dir(configuration_file): if "parsing-depth" in config_data.keys():
data = configuration_file.get_parsing_depth() data = config_data["parsing-depth"];
debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'") debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("depth", str(data)), True) parseGenericArg(arg_element.ArgElement("depth", str(data)), True)
if "get_ccache" in dir(configuration_file): if "ccache" in config_data.keys():
data = configuration_file.get_ccache() data = config_data["ccache"];
debug.debug(" get default config 'get_ccache' val='" + str(data) + "'") debug.debug(" get default config 'get_ccache' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("ccache", str(data)), True) parseGenericArg(arg_element.ArgElement("ccache", str(data)), True)
if "get_default_jobs" in dir(configuration_file): if "jobs" in config_data.keys():
data = configuration_file.get_default_jobs() data = config_data["jobs"];
debug.debug(" get default config 'get_default_jobs' val='" + str(data) + "'") debug.debug(" get default config 'get_default_jobs' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("jobs", str(data)), True) parseGenericArg(arg_element.ArgElement("jobs", str(data)), True)
if "get_default_color" in dir(configuration_file): if "color" in config_data.keys():
data = configuration_file.get_default_color() data = config_data["color"];
debug.debug(" get default config 'get_default_color' val='" + str(data) + "'") debug.debug(" get default config 'get_default_color' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("color", str(data)), True) parseGenericArg(arg_element.ArgElement("color", str(data)), True)
if "get_default_debug_level" in dir(configuration_file): if "debug-level" in config_data.keys():
data = configuration_file.get_default_debug_level() data = config_data["debug-level"];
debug.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'") debug.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("verbose", str(data)), True) parseGenericArg(arg_element.ArgElement("verbose", str(data)), True)
if "get_default_print_pretty" in dir(configuration_file): if "print-pretty" in config_data.keys():
data = configuration_file.get_default_print_pretty() data = config_data["print-pretty"];
debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'") debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("pretty", str(data)), True) parseGenericArg(arg_element.ArgElement("pretty", str(data)), True)
if "get_default_force_optimisation" in dir(configuration_file): if "force-optimization" in config_data.keys():
data = configuration_file.get_default_force_optimisation() data = config_data["force-optimization"];
debug.debug(" get default config 'get_default_force_optimisation' val='" + str(data) + "'") debug.debug(" get default config 'get_default_force_optimisation' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("force-optimisation", str(data)), True) parseGenericArg(arg_element.ArgElement("force-optimisation", str(data)), True)
if "get_default_isolate_system" in dir(configuration_file): if "isolate-system" in config_data.keys():
data = configuration_file.get_default_isolate_system() data = config_data["isolate-system"];
debug.debug(" get default config 'get_default_isolate_system' val='" + str(data) + "'") debug.debug(" get default config 'get_default_isolate_system' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("isolate-system", str(data)), True) parseGenericArg(arg_element.ArgElement("isolate-system", str(data)), True)

View File

@ -769,23 +769,31 @@ class Target:
else: else:
option_list = [] option_list = []
ret = self.run(module_name, option_list, bin_name); ret_value = self.run(module_name, option_list, bin_name);
else: else:
option_list = [] option_list = []
#try: #try:
ret = self.run(module_name, option_list, bin_name) ret_value = self.run(module_name, option_list, bin_name)
if env.get_async_fail(): if not env.get_async_fail():
if ret != 0: if ret_value != 0:
debug.error("FAIL in execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret)); debug.error("FAIL in execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret));
else: else:
debug.warning("FAIL in execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret)); if ret_value != 0:
debug.warning("FAIL execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret));
global_run_error.append({
"module": module_name,
"bin": bin_name,
"options": option_list,
"return": ret_value,
"type": "Execution Fail ..."
})
else: else:
global_run_error.append({ global_run_error.append({
"module": module_name, "module": module_name,
"bin": bin_name, "bin": bin_name,
"options": option_list, "options": option_list,
"return": ret, "return": ret_value,
"type": "Execution Fail ..." "type": "Execution OK ..."
}) })
#except AttributeError: #except AttributeError:
# debug.error("target have no 'run' instruction") # debug.error("target have no 'run' instruction")
@ -798,7 +806,7 @@ class Target:
present = self.load_if_needed(module_name, optionnal=optionnal) present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \ if present == False \
and optionnal == True: and optionnal == True:
ret = [heritage.HeritageList(), False, None] ret = [heritage.HeritageList(), False, []]
else: else:
for mod in self.module_list: for mod in self.module_list:
debug.verbose("compare " + mod.get_name() + " == " + module_name) debug.verbose("compare " + mod.get_name() + " == " + module_name)
@ -832,12 +840,12 @@ class Target:
if len(action_name) > 5: if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'") debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'") debug.debug("build module '" + module_name + "'")
ret = [mod.build(self, package_name), True, None] ret = [mod.build(self, package_name), True, []]
break break
# at the end of the build selected... # at the end of the build selected...
if optionnal == True \ if optionnal == True \
and ret == None: and ret == None:
ret = [heritage.HeritageList(), False, None] ret = [heritage.HeritageList(), False, []]
break break
if ret == None: if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it") debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
@ -847,9 +855,8 @@ class Target:
pass; pass;
else: else:
if len(action_list) == 1 and len(list_of_all_element) == 1: if len(action_list) == 1 and len(list_of_all_element) == 1:
return ret return [None, False, global_run_error];
# end of all element processing... # end of all element processing...
if len(global_run_error) != 0:
return [None, False, global_run_error]; return [None, False, global_run_error];
## ##
## @brief Add action to do for package specific part when build upper element ## @brief Add action to do for package specific part when build upper element