[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 os
import copy
import json
from realog import debug as debug
import lutin
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 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 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)
@ -314,58 +315,74 @@ def parseGenericArg(argument, active):
return True
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:
config_file_name = "lutinConfig.py"
config_file_name = ".lutin/config.json"
config_file = os.path.join(tools.get_run_path(), config_file_name)
if os.path.isfile(config_file) == True:
sys.path.append(os.path.dirname(config_file))
debug.debug("Find basic configuration file: '" + config_file + "'")
sys.path.append(os.path.dirname(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:
configuration_file = __import__(config_file_name[:-3])
config_data = json.loads(config_data_file);
if "get_exclude_path" in dir(configuration_file):
data = configuration_file.get_exclude_path()
if "exclude-path" in config_data.keys():
data = config_data["exclude-path"];
debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
env.set_exclude_search_path(data)
if "get_parsing_depth" in dir(configuration_file):
data = configuration_file.get_parsing_depth()
if "parsing-depth" in config_data.keys():
data = config_data["parsing-depth"];
debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("depth", str(data)), True)
if "get_ccache" in dir(configuration_file):
data = configuration_file.get_ccache()
if "ccache" in config_data.keys():
data = config_data["ccache"];
debug.debug(" get default config 'get_ccache' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("ccache", str(data)), True)
if "get_default_jobs" in dir(configuration_file):
data = configuration_file.get_default_jobs()
if "jobs" in config_data.keys():
data = config_data["jobs"];
debug.debug(" get default config 'get_default_jobs' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("jobs", str(data)), True)
if "get_default_color" in dir(configuration_file):
data = configuration_file.get_default_color()
if "color" in config_data.keys():
data = config_data["color"];
debug.debug(" get default config 'get_default_color' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("color", str(data)), True)
if "get_default_debug_level" in dir(configuration_file):
data = configuration_file.get_default_debug_level()
if "debug-level" in config_data.keys():
data = config_data["debug-level"];
debug.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("verbose", str(data)), True)
if "get_default_print_pretty" in dir(configuration_file):
data = configuration_file.get_default_print_pretty()
if "print-pretty" in config_data.keys():
data = config_data["print-pretty"];
debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("pretty", str(data)), True)
if "get_default_force_optimisation" in dir(configuration_file):
data = configuration_file.get_default_force_optimisation()
if "force-optimization" in config_data.keys():
data = config_data["force-optimization"];
debug.debug(" get default config 'get_default_force_optimisation' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("force-optimisation", str(data)), True)
if "get_default_isolate_system" in dir(configuration_file):
data = configuration_file.get_default_isolate_system()
if "isolate-system" in config_data.keys():
data = config_data["isolate-system"];
debug.debug(" get default config 'get_default_isolate_system' val='" + str(data) + "'")
parseGenericArg(arg_element.ArgElement("isolate-system", str(data)), True)

View File

@ -769,24 +769,32 @@ class Target:
else:
option_list = []
ret = self.run(module_name, option_list, bin_name);
ret_value = self.run(module_name, option_list, bin_name);
else:
option_list = []
#try:
ret = self.run(module_name, option_list, bin_name)
if env.get_async_fail():
if ret != 0:
ret_value = self.run(module_name, option_list, bin_name)
if not env.get_async_fail():
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));
else:
debug.warning("FAIL in execute process : '" + str(module_name) + "' ==> bin name='" + str(bin_name) + "' with option: " + str(option_list) + " RETURN value: " + str(ret));
else:
global_run_error.append({
"module": module_name,
"bin": bin_name,
"options": option_list,
"return": ret,
"type": "Execution Fail ..."
})
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:
global_run_error.append({
"module": module_name,
"bin": bin_name,
"options": option_list,
"return": ret_value,
"type": "Execution OK ..."
})
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log":
@ -798,7 +806,7 @@ class Target:
present = self.load_if_needed(module_name, optionnal=optionnal)
if present == False \
and optionnal == True:
ret = [heritage.HeritageList(), False, None]
ret = [heritage.HeritageList(), False, []]
else:
for mod in self.module_list:
debug.verbose("compare " + mod.get_name() + " == " + module_name)
@ -832,12 +840,12 @@ class Target:
if len(action_name) > 5:
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
debug.debug("build module '" + module_name + "'")
ret = [mod.build(self, package_name), True, None]
ret = [mod.build(self, package_name), True, []]
break
# at the end of the build selected...
if optionnal == True \
and ret == None:
ret = [heritage.HeritageList(), False, None]
ret = [heritage.HeritageList(), False, []]
break
if ret == None:
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
@ -847,10 +855,9 @@ class Target:
pass;
else:
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...
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
## @param[in] name_of_state (string) a state to call action