list comprehension

This commit is contained in:
gwen 2024-10-01 18:16:00 +02:00
parent 263ceae6a1
commit 9f31448134

View file

@ -98,7 +98,12 @@ def populate(dest_dir, rougailconfig):
root_config = config.unrestraint root_config = config.unrestraint
else: else:
root_config = config.unrestraint.value.mandatory() root_config = config.unrestraint.value.mandatory()
values = ['ROUGAIL_' + variable.path().upper() + '="' + "" if get_value(variable) is None else get_value(variable) + '"' for variable in get_variables(root_config)] values = []
for variable in get_variables(root_config):
var = get_value(variable)
if var is None:
var = ""
values.append('ROUGAIL_' + variable.path().upper() + '="' + var + '"')
if not environment_file.is_file(): if not environment_file.is_file():
with environment_file.open('w') as envfh: with environment_file.open('w') as envfh:
envfh.write('\n'.join(values) + '\n') envfh.write('\n'.join(values) + '\n')