feat: user_data can be loaded after other plugins
This commit is contained in:
parent
dcbe1a99d6
commit
a530ff33d6
1 changed files with 20 additions and 1 deletions
|
@ -62,7 +62,7 @@ def _main():
|
||||||
output_name = rougailconfig["step.output"]
|
output_name = rougailconfig["step.output"]
|
||||||
# structural
|
# structural
|
||||||
rougail = Rougail(rougailconfig)
|
rougail = Rougail(rougailconfig)
|
||||||
config = rougail.get_config()
|
config = rougail.run()
|
||||||
# data user
|
# data user
|
||||||
if not user_data_names:
|
if not user_data_names:
|
||||||
user_datas = None
|
user_datas = None
|
||||||
|
@ -80,6 +80,8 @@ def _main():
|
||||||
_('cannot find "user_data" module "{0}"').format(user_data_name)
|
_('cannot find "user_data" module "{0}"').format(user_data_name)
|
||||||
)
|
)
|
||||||
module = load_modules("rougail.user_data_" + user_data_name, str(path))
|
module = load_modules("rougail.user_data_" + user_data_name, str(path))
|
||||||
|
if hasattr(module.RougailUserData, 'force_apply_user_data') and module.RougailUserData.force_apply_user_data is True:
|
||||||
|
continue
|
||||||
user_datas.extend(
|
user_datas.extend(
|
||||||
module.RougailUserData(
|
module.RougailUserData(
|
||||||
config,
|
config,
|
||||||
|
@ -90,6 +92,23 @@ def _main():
|
||||||
err_warn = rougail.user_datas(user_datas)
|
err_warn = rougail.user_datas(user_datas)
|
||||||
else:
|
else:
|
||||||
err_warn = {"errors": [], "warnings": []}
|
err_warn = {"errors": [], "warnings": []}
|
||||||
|
if user_data_names:
|
||||||
|
config.property.read_write()
|
||||||
|
user_datas = []
|
||||||
|
for user_data_name in user_data_names:
|
||||||
|
path = (
|
||||||
|
Path(__file__).parent.parent
|
||||||
|
/ ("user_data_" + user_data_name)
|
||||||
|
/ "__init__.py"
|
||||||
|
)
|
||||||
|
module = load_modules("rougail.user_data_" + user_data_name, str(path))
|
||||||
|
if hasattr(module.RougailUserData, 'force_apply_user_data') and module.RougailUserData.force_apply_user_data is True:
|
||||||
|
ret = module.RougailUserData(
|
||||||
|
config,
|
||||||
|
rougailconfig=rougailconfig,
|
||||||
|
).run()
|
||||||
|
err_warn["errors"].extend(ret["errors"])
|
||||||
|
err_warn["warnings"].extend(ret["warnings"])
|
||||||
# output
|
# output
|
||||||
config.property.read_only()
|
config.property.read_only()
|
||||||
path = Path(__file__).parent.parent / ("output_" + output_name) / "__init__.py"
|
path = Path(__file__).parent.parent / ("output_" + output_name) / "__init__.py"
|
||||||
|
|
Loading…
Reference in a new issue