|
|
|
@ -62,8 +62,8 @@ def _main(arguments, do_not_print):
|
|
|
|
for version in versions:
|
|
|
|
for version in versions:
|
|
|
|
print(version)
|
|
|
|
print(version)
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|
layer_datas, metaconfig, config, err_warn = load_user_datas(rougailconfig)
|
|
|
|
metaconfig, config, err_warn = load_user_datas(rougailconfig)
|
|
|
|
output = get_output(rougailconfig, metaconfig, config, err_warn, layer_datas)
|
|
|
|
output = get_output(rougailconfig, metaconfig, config, err_warn)
|
|
|
|
if do_not_print:
|
|
|
|
if do_not_print:
|
|
|
|
return output.run()
|
|
|
|
return output.run()
|
|
|
|
ret = output.print()
|
|
|
|
ret = output.print()
|
|
|
|
@ -158,7 +158,6 @@ def manage_warnings(warnings):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_user_datas(rougailconfig):
|
|
|
|
def load_user_datas(rougailconfig):
|
|
|
|
layer_datas = {}
|
|
|
|
|
|
|
|
if not rougailconfig["cli.load_config"]:
|
|
|
|
if not rougailconfig["cli.load_config"]:
|
|
|
|
return None, {"errors": [], "warnings": []}
|
|
|
|
return None, {"errors": [], "warnings": []}
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
@ -189,13 +188,9 @@ def load_user_datas(rougailconfig):
|
|
|
|
for idx, layer in enumerate(layers):
|
|
|
|
for idx, layer in enumerate(layers):
|
|
|
|
if idx:
|
|
|
|
if idx:
|
|
|
|
subconfig = subconfig.config("_".join(layer))
|
|
|
|
subconfig = subconfig.config("_".join(layer))
|
|
|
|
layer_name = subconfig.path()
|
|
|
|
|
|
|
|
subconfig.owner.set(subconfig.path())
|
|
|
|
subconfig.owner.set(subconfig.path())
|
|
|
|
else:
|
|
|
|
|
|
|
|
layer_name = None
|
|
|
|
|
|
|
|
# data user
|
|
|
|
# data user
|
|
|
|
user_datas = []
|
|
|
|
user_datas = []
|
|
|
|
layer_datas[layer_name] = {}
|
|
|
|
|
|
|
|
for user_data_name in layer:
|
|
|
|
for user_data_name in layer:
|
|
|
|
path = (
|
|
|
|
path = (
|
|
|
|
Path(__file__).parent.parent
|
|
|
|
Path(__file__).parent.parent
|
|
|
|
@ -209,36 +204,34 @@ def load_user_datas(rougailconfig):
|
|
|
|
module = load_modules("rougail.user_data_" + user_data_name, str(path))
|
|
|
|
module = load_modules("rougail.user_data_" + user_data_name, str(path))
|
|
|
|
rougail_user_datas = module.RougailUserData
|
|
|
|
rougail_user_datas = module.RougailUserData
|
|
|
|
if hasattr(rougail_user_datas, 'interactive_user_datas') and rougail_user_datas.interactive_user_datas:
|
|
|
|
if hasattr(rougail_user_datas, 'interactive_user_datas') and rougail_user_datas.interactive_user_datas:
|
|
|
|
interactive_user_datas.setdefault(layer_name, {})[user_data_name] = rougail_user_datas
|
|
|
|
interactive_user_datas[user_data_name] = rougail_user_datas
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
elif interactive_user_datas:
|
|
|
|
elif interactive_user_datas:
|
|
|
|
raise Exception(_(f'interactive user datas "{0}" is loader before uninteractive user datas "{1}"').format(list(interactive_user_datas), user_data_name))
|
|
|
|
raise Exception(_(f'interactive user datas "{0}" is loader before uninteractive user datas "{1}"').format(list(interactive_user_datas), user_data_name))
|
|
|
|
for user_data in rougail_user_datas(
|
|
|
|
user_datas.extend(
|
|
|
|
|
|
|
|
rougail_user_datas(
|
|
|
|
subconfig,
|
|
|
|
subconfig,
|
|
|
|
rougailconfig=rougailconfig,
|
|
|
|
rougailconfig=rougailconfig,
|
|
|
|
).run():
|
|
|
|
).run()
|
|
|
|
layer_datas[layer_name].setdefault(user_data_name, []).append(user_data["source"])
|
|
|
|
)
|
|
|
|
user_datas.append(user_data)
|
|
|
|
|
|
|
|
if user_datas:
|
|
|
|
if user_datas:
|
|
|
|
new_err_warn = UserDatas(subconfig).user_datas(user_datas, invalid_user_datas_error=invalid_user_datas_error, unknown_user_datas_error=unknown_user_datas_error)
|
|
|
|
new_err_warn = UserDatas(subconfig).user_datas(user_datas, invalid_user_datas_error=invalid_user_datas_error, unknown_user_datas_error=unknown_user_datas_error)
|
|
|
|
for level, datas in new_err_warn.items():
|
|
|
|
for level, datas in new_err_warn.items():
|
|
|
|
if datas:
|
|
|
|
if datas:
|
|
|
|
err_warn[level].extend(datas)
|
|
|
|
err_warn[level].updates(datas)
|
|
|
|
for layer_name, interactive_user_data in interactive_user_datas.items():
|
|
|
|
for layer, rougail_user_datas in interactive_user_datas.items():
|
|
|
|
for layer, rougail_user_datas in interactive_user_data.items():
|
|
|
|
if has_layers and len(layers) > 1:
|
|
|
|
if has_layers and len(layers) > 1:
|
|
|
|
subconfig = subconfig.config("_".join(layer))
|
|
|
|
subconfig = subconfig.config("_".join(layer))
|
|
|
|
subconfig.owner.set(subconfig.path())
|
|
|
|
subconfig.owner.set(subconfig.path())
|
|
|
|
rougail_user_datas(
|
|
|
|
for user_data in rougail_user_datas(
|
|
|
|
subconfig,
|
|
|
|
subconfig,
|
|
|
|
rougailconfig=rougailconfig,
|
|
|
|
rougailconfig=rougailconfig,
|
|
|
|
).run()
|
|
|
|
).run():
|
|
|
|
|
|
|
|
layer_datas[layer_name].setdefault(user_data_name, []).append(user_data["source"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return layer_datas, metaconfig, subconfig, err_warn
|
|
|
|
return metaconfig, subconfig, err_warn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_output(rougailconfig, metaconfig, config, err_warn, layer_datas):
|
|
|
|
def get_output(rougailconfig, metaconfig, config, err_warn):
|
|
|
|
# output
|
|
|
|
# output
|
|
|
|
if config and (not rougailconfig["cli.load_config"] or not rougailconfig["cli.read_write"]):
|
|
|
|
if config and (not rougailconfig["cli.load_config"] or not rougailconfig["cli.read_write"]):
|
|
|
|
config.property.read_only()
|
|
|
|
config.property.read_only()
|
|
|
|
@ -256,7 +249,6 @@ def get_output(rougailconfig, metaconfig, config, err_warn, layer_datas):
|
|
|
|
user_data_warnings=err_warn["warnings"],
|
|
|
|
user_data_warnings=err_warn["warnings"],
|
|
|
|
config_owner_is_path=True,
|
|
|
|
config_owner_is_path=True,
|
|
|
|
metaconfig=metaconfig,
|
|
|
|
metaconfig=metaconfig,
|
|
|
|
layer_datas=layer_datas,
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return output
|
|
|
|
return output
|
|
|
|
|
|
|
|
|
|
|
|
|