mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 14:59:44 +03:00
meson: utils: Provide environment for Python scripts
Python scripts run as part of the build process need to take a few actions specific to the environment in which they operate. One of those is disabling the Python bytecode cache, to avoid writing .pyc files to the source tree. This is done manually in the IPC generate.py and parser.py scripts. The current implementation is not ideal because it hardcodes in the scripts information related to the environment in which they operate. As those scripts are part of libcamera this is more of a theoretical issue than a practical one. A second issue is that future Python scripts will need to duplicate similar mechanisms, resulting in a higher maintenance burden. Address the issue with a different approach, by creating a meson environment for the Python scripts, and passing it to the custom_target() functions. The environment only disables the bytecode cache for now. The diffstat shows an increase in code size. This is expected to be offset by usage of the environment for more Python scripts, as well as support of more variables in the environment. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
50c92cc7e2
commit
a5f12d2eb3
8 changed files with 30 additions and 19 deletions
|
@ -9,7 +9,8 @@ mojom = custom_target('test_mojom_module',
|
|||
'--output-root', meson.project_build_root(),
|
||||
'--input-root', meson.project_source_root(),
|
||||
'--mojoms', '@INPUT@'
|
||||
])
|
||||
],
|
||||
env : py_build_env)
|
||||
|
||||
# test_ipa_interface.h
|
||||
generated_test_header = custom_target('test_ipa_interface_h',
|
||||
|
@ -23,7 +24,8 @@ generated_test_header = custom_target('test_ipa_interface_h',
|
|||
'--libcamera_generate_header',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' +'@INPUT@'
|
||||
])
|
||||
],
|
||||
env : py_build_env)
|
||||
|
||||
# test_ipa_serializer.h
|
||||
generated_test_serializer = custom_target('test_ipa_serializer_h',
|
||||
|
@ -37,4 +39,5 @@ generated_test_serializer = custom_target('test_ipa_serializer_h',
|
|||
'--libcamera_generate_serializer',
|
||||
'--libcamera_output_path=@OUTPUT@',
|
||||
'./' +'@INPUT@'
|
||||
])
|
||||
],
|
||||
env : py_build_env)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue