utils: codegen: gen-controls.py: Convert to jinja2 templates

Jinja2 templates help separate the logic related to the template from
the generation of the data. The python code becomes much clearer as a
result.

As an added bonus, we can use a single template file for both controls
and properties.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2024-08-08 03:41:32 +03:00
parent 48f9660acd
commit dc067c4bce
7 changed files with 175 additions and 340 deletions
+3 -2
View File
@@ -143,9 +143,10 @@ foreach mode, inout_files : controls_mode_files
input_files = inout_files[0]
output_file = inout_files[1]
template_file = files(output_file + '.in')
template_file = files('control_ids.cpp.in')
ranges_file = files('control_ranges.yaml')
control_sources += custom_target(mode + '_cpp',
control_sources += custom_target(mode + '_ids_cpp',
input : input_files,
output : output_file,
command : [gen_controls, '-o', '@OUTPUT@',