[{"id":30751,"web_url":"https://patchwork.libcamera.org/comment/30751/","msgid":"<9b8f8c70-a19e-464e-94c4-ec51a59aa1d3@ideasonboard.com>","date":"2024-08-12T14:33:39","subject":"Re: [PATCH 05/10] meson: utils: Provide environment for Python\n\tscripts","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 09/08/2024 03:59, Laurent Pinchart wrote:\n> Python scripts run as part of the build process need to take a few\n> actions specific to the environment in which they operate. One of those\n> is disabling the Python bytecode cache, to avoid writing file to the\n> source tree. This is done manually in the IPC generate.py and parser.py\n> scripts.\n> \n> The current implementation is not ideal because it hardcodes in the\n> scripts information related to the environment in which they operate. As\n> those scripts are part of libcamera this is more of a theoretical issue\n> than a practical one. A second issue is that future Python scripts will\n> need to duplicate similar mechanisms, resulting in a higher maintenance\n> burden.\n> \n> Address the issue with a different approach, by creating a meson\n> environment for the Python scripts, and passing it to the\n> custom_target() functions. The environment only disables the bytecode\n> cache for now.\n> \n> The diffstat shows an increase in code size. This is expected to be\n> offset by usage of the environment for more Python scripts, as well as\n> support of more variables in the environment.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>   include/libcamera/ipa/meson.build             | 21 ++++++++++++-------\n>   src/libcamera/proxy/meson.build               |  3 ++-\n>   src/libcamera/proxy/worker/meson.build        |  3 ++-\n>   .../include/libcamera/ipa/meson.build         |  9 +++++---\n>   utils/codegen/ipc/generate.py                 |  3 ---\n>   utils/codegen/ipc/meson.build                 |  3 ++-\n>   utils/codegen/ipc/parser.py                   |  3 ---\n>   utils/codegen/meson.build                     |  4 ++++\n>   8 files changed, 30 insertions(+), 19 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\n> index 96fca42cc0b8..bf55e124e97e 100644\n> --- a/include/libcamera/ipa/meson.build\n> +++ b/include/libcamera/ipa/meson.build\n> @@ -26,7 +26,8 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',\n>                                      '--output-root', meson.project_build_root(),\n>                                      '--input-root', meson.project_source_root(),\n>                                      '--mojoms', '@INPUT@'\n> -                               ])\n> +                               ],\n> +                               env : py_build_env)\n>   \n>   # core_ipa_interface.h\n>   libcamera_ipa_headers += custom_target('core_ipa_interface_h',\n> @@ -42,7 +43,8 @@ libcamera_ipa_headers += custom_target('core_ipa_interface_h',\n>                         '--libcamera_generate_core_header',\n>                         '--libcamera_output_path=@OUTPUT@',\n>                         './' +'@INPUT@'\n> -                  ])\n> +                  ],\n> +                  env : py_build_env)\n>   \n>   # core_ipa_serializer.h\n>   libcamera_ipa_headers += custom_target('core_ipa_serializer_h',\n> @@ -56,7 +58,8 @@ libcamera_ipa_headers += custom_target('core_ipa_serializer_h',\n>                         '--libcamera_generate_core_serializer',\n>                         '--libcamera_output_path=@OUTPUT@',\n>                         './' +'@INPUT@'\n> -                  ])\n> +                  ],\n> +                  env : py_build_env)\n>   \n>   # Mapping from pipeline handler name to mojom file\n>   pipeline_ipa_mojom_mapping = {\n> @@ -99,7 +102,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                 '--output-root', meson.project_build_root(),\n>                                 '--input-root', meson.project_source_root(),\n>                                 '--mojoms', '@INPUT@'\n> -                          ])\n> +                          ],\n> +                          env : py_build_env)\n>   \n>       # {interface}_ipa_interface.h\n>       header = custom_target(name + '_ipa_interface_h',\n> @@ -115,7 +119,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                  '--libcamera_generate_header',\n>                                  '--libcamera_output_path=@OUTPUT@',\n>                                  './' +'@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n>   \n>       # {interface}_ipa_serializer.h\n>       serializer = custom_target(name + '_ipa_serializer_h',\n> @@ -129,7 +134,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                      '--libcamera_generate_serializer',\n>                                      '--libcamera_output_path=@OUTPUT@',\n>                                      './' +'@INPUT@'\n> -                               ])\n> +                               ],\n> +                               env : py_build_env)\n>   \n>       # {interface}_ipa_proxy.h\n>       proxy_header = custom_target(name + '_proxy_h',\n> @@ -143,7 +149,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                        '--libcamera_generate_proxy_h',\n>                                        '--libcamera_output_path=@OUTPUT@',\n>                                        './' +'@INPUT@'\n> -                                 ])\n> +                                 ],\n> +                                 env : py_build_env)\n>   \n>       ipa_mojoms += {\n>           'name': name,\n> diff --git a/src/libcamera/proxy/meson.build b/src/libcamera/proxy/meson.build\n> index d7de518a0549..8bd1b135d0f5 100644\n> --- a/src/libcamera/proxy/meson.build\n> +++ b/src/libcamera/proxy/meson.build\n> @@ -13,7 +13,8 @@ foreach mojom : ipa_mojoms\n>                                 '--libcamera_generate_proxy_cpp',\n>                                 '--libcamera_output_path=@OUTPUT@',\n>                                 './' + '@INPUT@'\n> -                          ])\n> +                          ],\n> +                          env : py_build_env)\n>   \n>       libcamera_internal_sources += proxy\n>   endforeach\n> diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build\n> index b5ab9794c622..8c54a2e206a5 100644\n> --- a/src/libcamera/proxy/worker/meson.build\n> +++ b/src/libcamera/proxy/worker/meson.build\n> @@ -15,7 +15,8 @@ foreach mojom : ipa_mojoms\n>                                  '--libcamera_generate_proxy_worker',\n>                                  '--libcamera_output_path=@OUTPUT@',\n>                                  './' + '@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n>   \n>       proxy = executable(mojom['name'] + '_ipa_proxy', worker,\n>                          install : true,\n> diff --git a/test/serialization/generated_serializer/include/libcamera/ipa/meson.build b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> index 6f8794c188a3..ae08e9bee6b9 100644\n> --- a/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> +++ b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> @@ -9,7 +9,8 @@ mojom = custom_target('test_mojom_module',\n>                             '--output-root', meson.project_build_root(),\n>                             '--input-root', meson.project_source_root(),\n>                             '--mojoms', '@INPUT@'\n> -                      ])\n> +                      ],\n> +                      env : py_build_env)\n>   \n>   # test_ipa_interface.h\n>   generated_test_header = custom_target('test_ipa_interface_h',\n> @@ -23,7 +24,8 @@ generated_test_header = custom_target('test_ipa_interface_h',\n>                              '--libcamera_generate_header',\n>                              '--libcamera_output_path=@OUTPUT@',\n>                              './' +'@INPUT@'\n> -                       ])\n> +                       ],\n> +                       env : py_build_env)\n>   \n>   # test_ipa_serializer.h\n>   generated_test_serializer = custom_target('test_ipa_serializer_h',\n> @@ -37,4 +39,5 @@ generated_test_serializer = custom_target('test_ipa_serializer_h',\n>                                  '--libcamera_generate_serializer',\n>                                  '--libcamera_output_path=@OUTPUT@',\n>                                  './' +'@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n> diff --git a/utils/codegen/ipc/generate.py b/utils/codegen/ipc/generate.py\n> index c2b3fcb72e1f..dfbe659bc0ca 100755\n> --- a/utils/codegen/ipc/generate.py\n> +++ b/utils/codegen/ipc/generate.py\n> @@ -9,9 +9,6 @@\n>   import os\n>   import sys\n>   \n> -# TODO set sys.pycache_prefix for >= python3.8\n> -sys.dont_write_bytecode = True\n> -\n>   sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/bindings')\n>   \n>   import mojo.public.tools.bindings.mojom_bindings_generator as generator\n> diff --git a/utils/codegen/ipc/meson.build b/utils/codegen/ipc/meson.build\n> index 973a5417dc99..f77bf32497ba 100644\n> --- a/utils/codegen/ipc/meson.build\n> +++ b/utils/codegen/ipc/meson.build\n> @@ -13,6 +13,7 @@ mojom_docs_extractor = find_program('./extract-docs.py')\n>   mojom_templates = custom_target('mojom_templates',\n>                                   input : mojom_template_files,\n>                                   output : 'libcamera_templates.zip',\n> -                                command : [mojom_generator, '-o', '@OUTDIR@', 'precompile'])\n> +                                command : [mojom_generator, '-o', '@OUTDIR@', 'precompile'],\n> +                                env : py_build_env)\n>   \n>   mojom_templates_dir = meson.current_build_dir()\n> diff --git a/utils/codegen/ipc/parser.py b/utils/codegen/ipc/parser.py\n> index cb5608b7c165..8e70322d1bdb 100755\n> --- a/utils/codegen/ipc/parser.py\n> +++ b/utils/codegen/ipc/parser.py\n> @@ -9,9 +9,6 @@\n>   import os\n>   import sys\n>   \n> -# TODO set sys.pycache_prefix for >= python3.8\n> -sys.dont_write_bytecode = True\n> -\n>   # Make sure that mojom_parser.py can import mojom\n>   sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')\n>   \n> diff --git a/utils/codegen/meson.build b/utils/codegen/meson.build\n> index 7dd312e16559..fb2196ee0d20 100644\n> --- a/utils/codegen/meson.build\n> +++ b/utils/codegen/meson.build\n> @@ -2,6 +2,10 @@\n>   \n>   ## Code generation\n>   \n> +py_build_env = environment()\n> +# \\todo Investigate usage of PYTHONPYCACHEPREFIX for Python >= 3.8\n> +py_build_env.set('PYTHONDONTWRITEBYTECODE', '1')\n> +\n>   py_modules += ['jinja2', 'yaml']\n>   \n>   gen_controls = files('gen-controls.py')\n\nReviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n\n  Tomi","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 70598C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Aug 2024 14:33:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6074D63369;\n\tMon, 12 Aug 2024 16:33:45 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C92363369\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2024 16:33:43 +0200 (CEST)","from [192.168.88.20] (91-156-87-48.elisa-laajakaista.fi\n\t[91.156.87.48])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8064B6B5;\n\tMon, 12 Aug 2024 16:32:46 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Xxp1YWkF\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723473166;\n\tbh=tBivk6PNIENO6d0+Wprr0TnjkoQOmik335u+42hVpx0=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=Xxp1YWkFJG1u21RZ4Zujgx7ExIN1ZG/7ElA5hbZAdFYXkzzUKyUVBdKHi5gTFlblr\n\tsWsMlOVzC78u5Ct8xSwN+4yHP0kSGG5SG5nZor22Nt6iL6IU8IbtiPraG+TKt01Nrd\n\t0nTUsJxUPqZwXBP3TrJ2E8dlrtj7Kkw7DTxo0iX4=","Message-ID":"<9b8f8c70-a19e-464e-94c4-ec51a59aa1d3@ideasonboard.com>","Date":"Mon, 12 Aug 2024 17:33:39 +0300","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 05/10] meson: utils: Provide environment for Python\n\tscripts","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20240809005914.20662-1-laurent.pinchart@ideasonboard.com>\n\t<20240809005914.20662-6-laurent.pinchart@ideasonboard.com>","Content-Language":"en-US","From":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Autocrypt":"addr=tomi.valkeinen@ideasonboard.com; keydata=\n\txsFNBE6ms0cBEACyizowecZqXfMZ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a5+CjyFs8ua01c\n\t9HmyfkuhXG2OLjfQuK+Ygd56mV3lq0aFdwbaX16DG22c6flkkBSjyWXYepFtHz9KsBS0DaZb\n\t4IkLmZwEXpZcIOQjQ71fqlpiXkXSIaQ6YMEs8WjBbpP81h7QxWIfWtp+VnwNGc6nq5IQDESH\n\tmvQcsFS7d3eGVI6eyjCFdcAO8eMAEQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe\n\t9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S\n\tsuYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq\n\txKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII\n\tm9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU\n\tCH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B\n\tCFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof\n\t92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a\n\tueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F\n\tyjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw\n\t3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw==","In-Reply-To":"<20240809005914.20662-6-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":30812,"web_url":"https://patchwork.libcamera.org/comment/30812/","msgid":"<c879566f-cbee-4b83-8b58-213298917065@ideasonboard.com>","date":"2024-08-14T22:09:37","subject":"Re: [PATCH 05/10] meson: utils: Provide environment for Python\n\tscripts","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Laurent\n\nOn 09/08/2024 01:59, Laurent Pinchart wrote:\n> Python scripts run as part of the build process need to take a few\n> actions specific to the environment in which they operate. One of those\n> is disabling the Python bytecode cache, to avoid writing file to the\ns/file/.pyc files, perhaps?\n> source tree. This is done manually in the IPC generate.py and parser.py\n> scripts.\n>\n> The current implementation is not ideal because it hardcodes in the\n> scripts information related to the environment in which they operate. As\n> those scripts are part of libcamera this is more of a theoretical issue\n> than a practical one. A second issue is that future Python scripts will\n> need to duplicate similar mechanisms, resulting in a higher maintenance\n> burden.\n>\n> Address the issue with a different approach, by creating a meson\n> environment for the Python scripts, and passing it to the\n> custom_target() functions. The environment only disables the bytecode\n> cache for now.\n>\n> The diffstat shows an increase in code size. This is expected to be\n> offset by usage of the environment for more Python scripts, as well as\n> support of more variables in the environment.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n>   include/libcamera/ipa/meson.build             | 21 ++++++++++++-------\n>   src/libcamera/proxy/meson.build               |  3 ++-\n>   src/libcamera/proxy/worker/meson.build        |  3 ++-\n>   .../include/libcamera/ipa/meson.build         |  9 +++++---\n>   utils/codegen/ipc/generate.py                 |  3 ---\n>   utils/codegen/ipc/meson.build                 |  3 ++-\n>   utils/codegen/ipc/parser.py                   |  3 ---\n>   utils/codegen/meson.build                     |  4 ++++\n>   8 files changed, 30 insertions(+), 19 deletions(-)\n>\n> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\n> index 96fca42cc0b8..bf55e124e97e 100644\n> --- a/include/libcamera/ipa/meson.build\n> +++ b/include/libcamera/ipa/meson.build\n> @@ -26,7 +26,8 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',\n>                                      '--output-root', meson.project_build_root(),\n>                                      '--input-root', meson.project_source_root(),\n>                                      '--mojoms', '@INPUT@'\n> -                               ])\n> +                               ],\n> +                               env : py_build_env)\n>   \n>   # core_ipa_interface.h\n>   libcamera_ipa_headers += custom_target('core_ipa_interface_h',\n> @@ -42,7 +43,8 @@ libcamera_ipa_headers += custom_target('core_ipa_interface_h',\n>                         '--libcamera_generate_core_header',\n>                         '--libcamera_output_path=@OUTPUT@',\n>                         './' +'@INPUT@'\n> -                  ])\n> +                  ],\n> +                  env : py_build_env)\n>   \n>   # core_ipa_serializer.h\n>   libcamera_ipa_headers += custom_target('core_ipa_serializer_h',\n> @@ -56,7 +58,8 @@ libcamera_ipa_headers += custom_target('core_ipa_serializer_h',\n>                         '--libcamera_generate_core_serializer',\n>                         '--libcamera_output_path=@OUTPUT@',\n>                         './' +'@INPUT@'\n> -                  ])\n> +                  ],\n> +                  env : py_build_env)\n>   \n>   # Mapping from pipeline handler name to mojom file\n>   pipeline_ipa_mojom_mapping = {\n> @@ -99,7 +102,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                 '--output-root', meson.project_build_root(),\n>                                 '--input-root', meson.project_source_root(),\n>                                 '--mojoms', '@INPUT@'\n> -                          ])\n> +                          ],\n> +                          env : py_build_env)\n>   \n>       # {interface}_ipa_interface.h\n>       header = custom_target(name + '_ipa_interface_h',\n> @@ -115,7 +119,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                  '--libcamera_generate_header',\n>                                  '--libcamera_output_path=@OUTPUT@',\n>                                  './' +'@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n>   \n>       # {interface}_ipa_serializer.h\n>       serializer = custom_target(name + '_ipa_serializer_h',\n> @@ -129,7 +134,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                      '--libcamera_generate_serializer',\n>                                      '--libcamera_output_path=@OUTPUT@',\n>                                      './' +'@INPUT@'\n> -                               ])\n> +                               ],\n> +                               env : py_build_env)\n>   \n>       # {interface}_ipa_proxy.h\n>       proxy_header = custom_target(name + '_proxy_h',\n> @@ -143,7 +149,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                        '--libcamera_generate_proxy_h',\n>                                        '--libcamera_output_path=@OUTPUT@',\n>                                        './' +'@INPUT@'\n> -                                 ])\n> +                                 ],\n> +                                 env : py_build_env)\n>   \n>       ipa_mojoms += {\n>           'name': name,\n> diff --git a/src/libcamera/proxy/meson.build b/src/libcamera/proxy/meson.build\n> index d7de518a0549..8bd1b135d0f5 100644\n> --- a/src/libcamera/proxy/meson.build\n> +++ b/src/libcamera/proxy/meson.build\n> @@ -13,7 +13,8 @@ foreach mojom : ipa_mojoms\n>                                 '--libcamera_generate_proxy_cpp',\n>                                 '--libcamera_output_path=@OUTPUT@',\n>                                 './' + '@INPUT@'\n> -                          ])\n> +                          ],\n> +                          env : py_build_env)\n>   \n>       libcamera_internal_sources += proxy\n>   endforeach\n> diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build\n> index b5ab9794c622..8c54a2e206a5 100644\n> --- a/src/libcamera/proxy/worker/meson.build\n> +++ b/src/libcamera/proxy/worker/meson.build\n> @@ -15,7 +15,8 @@ foreach mojom : ipa_mojoms\n>                                  '--libcamera_generate_proxy_worker',\n>                                  '--libcamera_output_path=@OUTPUT@',\n>                                  './' + '@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n>   \n>       proxy = executable(mojom['name'] + '_ipa_proxy', worker,\n>                          install : true,\n> diff --git a/test/serialization/generated_serializer/include/libcamera/ipa/meson.build b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> index 6f8794c188a3..ae08e9bee6b9 100644\n> --- a/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> +++ b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> @@ -9,7 +9,8 @@ mojom = custom_target('test_mojom_module',\n>                             '--output-root', meson.project_build_root(),\n>                             '--input-root', meson.project_source_root(),\n>                             '--mojoms', '@INPUT@'\n> -                      ])\n> +                      ],\n> +                      env : py_build_env)\n>   \n>   # test_ipa_interface.h\n>   generated_test_header = custom_target('test_ipa_interface_h',\n> @@ -23,7 +24,8 @@ generated_test_header = custom_target('test_ipa_interface_h',\n>                              '--libcamera_generate_header',\n>                              '--libcamera_output_path=@OUTPUT@',\n>                              './' +'@INPUT@'\n> -                       ])\n> +                       ],\n> +                       env : py_build_env)\n>   \n>   # test_ipa_serializer.h\n>   generated_test_serializer = custom_target('test_ipa_serializer_h',\n> @@ -37,4 +39,5 @@ generated_test_serializer = custom_target('test_ipa_serializer_h',\n>                                  '--libcamera_generate_serializer',\n>                                  '--libcamera_output_path=@OUTPUT@',\n>                                  './' +'@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n> diff --git a/utils/codegen/ipc/generate.py b/utils/codegen/ipc/generate.py\n> index c2b3fcb72e1f..dfbe659bc0ca 100755\n> --- a/utils/codegen/ipc/generate.py\n> +++ b/utils/codegen/ipc/generate.py\n> @@ -9,9 +9,6 @@\n>   import os\n>   import sys\n>   \n> -# TODO set sys.pycache_prefix for >= python3.8\n> -sys.dont_write_bytecode = True\n> -\n>   sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/bindings')\n>   \n>   import mojo.public.tools.bindings.mojom_bindings_generator as generator\n> diff --git a/utils/codegen/ipc/meson.build b/utils/codegen/ipc/meson.build\n> index 973a5417dc99..f77bf32497ba 100644\n> --- a/utils/codegen/ipc/meson.build\n> +++ b/utils/codegen/ipc/meson.build\n> @@ -13,6 +13,7 @@ mojom_docs_extractor = find_program('./extract-docs.py')\n>   mojom_templates = custom_target('mojom_templates',\n>                                   input : mojom_template_files,\n>                                   output : 'libcamera_templates.zip',\n> -                                command : [mojom_generator, '-o', '@OUTDIR@', 'precompile'])\n> +                                command : [mojom_generator, '-o', '@OUTDIR@', 'precompile'],\n> +                                env : py_build_env)\n>   \n>   mojom_templates_dir = meson.current_build_dir()\n> diff --git a/utils/codegen/ipc/parser.py b/utils/codegen/ipc/parser.py\n> index cb5608b7c165..8e70322d1bdb 100755\n> --- a/utils/codegen/ipc/parser.py\n> +++ b/utils/codegen/ipc/parser.py\n> @@ -9,9 +9,6 @@\n>   import os\n>   import sys\n>   \n> -# TODO set sys.pycache_prefix for >= python3.8\n> -sys.dont_write_bytecode = True\n> -\n>   # Make sure that mojom_parser.py can import mojom\n>   sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')\n>   \n> diff --git a/utils/codegen/meson.build b/utils/codegen/meson.build\n> index 7dd312e16559..fb2196ee0d20 100644\n> --- a/utils/codegen/meson.build\n> +++ b/utils/codegen/meson.build\n> @@ -2,6 +2,10 @@\n>   \n>   ## Code generation\n>   \n> +py_build_env = environment()\n> +# \\todo Investigate usage of PYTHONPYCACHEPREFIX for Python >= 3.8\n> +py_build_env.set('PYTHONDONTWRITEBYTECODE', '1')\n> +\n>   py_modules += ['jinja2', 'yaml']\n>   \n>   gen_controls = files('gen-controls.py')","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 81FE1BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 14 Aug 2024 22:09:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8BA3F633BD;\n\tThu, 15 Aug 2024 00:09:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0946663382\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Aug 2024 00:09:41 +0200 (CEST)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F1A8F3A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Aug 2024 00:08:42 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DXQnnEDB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723673323;\n\tbh=V1Eqlvr11kIbyiq7I/xeokUQxj/rjNGlTP+H07G19Bk=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=DXQnnEDB8kdSyQj7MAmSGBvv141Z5S2Mn71LNY9zl8OgZlNpCiSKQCBKU9s+Rv9ss\n\ttKIldHXQ/rAIj5im9duN2IeY0hUnf36ehglIRmISIgEMlYbNseQDcJHLh9faKEuesl\n\tZy4jSRet/jQV72hTNOCeRCHeEgo50gWI5SvMII3A=","Message-ID":"<c879566f-cbee-4b83-8b58-213298917065@ideasonboard.com>","Date":"Wed, 14 Aug 2024 23:09:37 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 05/10] meson: utils: Provide environment for Python\n\tscripts","To":"libcamera-devel@lists.libcamera.org","References":"<20240809005914.20662-1-laurent.pinchart@ideasonboard.com>\n\t<20240809005914.20662-6-laurent.pinchart@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\txsFNBGLydlEBEADa5O2s0AbUguprfvXOQun/0a8y2Vk6BqkQALgeD6KnXSWwaoCULp18etYW\n\tB31bfgrdphXQ5kUQibB0ADK8DERB4wrzrUb5CMxLBFE7mQty+v5NsP0OFNK9XTaAOcmD+Ove\n\teIjYvqurAaro91jrRVrS1gBRxIFqyPgNvwwL+alMZhn3/2jU2uvBmuRrgnc/e9cHKiuT3Dtq\n\tMHGPKL2m+plk+7tjMoQFfexoQ1JKugHAjxAhJfrkXh6uS6rc01bYCyo7ybzg53m1HLFJdNGX\n\tsUKR+dQpBs3SY4s66tc1sREJqdYyTsSZf80HjIeJjU/hRunRo4NjRIJwhvnK1GyjOvvuCKVU\n\tRWpY8dNjNu5OeAfdrlvFJOxIE9M8JuYCQTMULqd1NuzbpFMjc9524U3Cngs589T7qUMPb1H1\n\tNTA81LmtJ6Y+IV5/kiTUANflpzBwhu18Ok7kGyCq2a2jsOcVmk8gZNs04gyjuj8JziYwwLbf\n\tvzABwpFVcS8aR+nHIZV1HtOzyw8CsL8OySc3K9y+Y0NRpziMRvutrppzgyMb9V+N31mK9Mxl\n\t1YkgaTl4ciNWpdfUe0yxH03OCuHi3922qhPLF4XX5LN+NaVw5Xz2o3eeWklXdouxwV7QlN33\n\tu4+u2FWzKxDqO6WLQGjxPE0mVB4Gh5Pa1Vb0ct9Ctg0qElvtGQARAQABzSh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jIwrbVhhSyUXYnSUb8F+9g2RDY42Sk7GcYxIeON4VzKqWM7hpkXZ47pkK0YodO+dRKM\n\tyMcoUWrTK0Uz6UzUGKoJVbxmSW/EJLEGoI5p3NWxWtScEVv8mO49gqQdrRIOheZycDmHnItt\n\t9Qjv00uFhEwv2YfiyGk6iGF2W40s2pH2t6oeuGgmiZ7g6d0MEK8Ql/4zPItvr1c1rpwpXUC1\n\tu1kQWgtnNjFHX3KiYdqjcZeRBiry1X0zY+4Y24wUU0KsEewJwjhmCKAsju1RpdlPg2kC","In-Reply-To":"<20240809005914.20662-6-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":30829,"web_url":"https://patchwork.libcamera.org/comment/30829/","msgid":"<Zr1qJ3iijYtG7LtH@pyrite.rasen.tech>","date":"2024-08-15T02:38:31","subject":"Re: [PATCH 05/10] meson: utils: Provide environment for Python\n\tscripts","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Fri, Aug 09, 2024 at 03:59:09AM +0300, Laurent Pinchart wrote:\n> Python scripts run as part of the build process need to take a few\n> actions specific to the environment in which they operate. One of those\n> is disabling the Python bytecode cache, to avoid writing file to the\n> source tree. This is done manually in the IPC generate.py and parser.py\n> scripts.\n> \n> The current implementation is not ideal because it hardcodes in the\n> scripts information related to the environment in which they operate. As\n> those scripts are part of libcamera this is more of a theoretical issue\n> than a practical one. A second issue is that future Python scripts will\n> need to duplicate similar mechanisms, resulting in a higher maintenance\n> burden.\n> \n> Address the issue with a different approach, by creating a meson\n> environment for the Python scripts, and passing it to the\n> custom_target() functions. The environment only disables the bytecode\n> cache for now.\n> \n> The diffstat shows an increase in code size. This is expected to be\n> offset by usage of the environment for more Python scripts, as well as\n> support of more variables in the environment.\n\nIn either case I think duplication in the build files is better than\nboilerplate duplication. I think.\n\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  include/libcamera/ipa/meson.build             | 21 ++++++++++++-------\n>  src/libcamera/proxy/meson.build               |  3 ++-\n>  src/libcamera/proxy/worker/meson.build        |  3 ++-\n>  .../include/libcamera/ipa/meson.build         |  9 +++++---\n>  utils/codegen/ipc/generate.py                 |  3 ---\n>  utils/codegen/ipc/meson.build                 |  3 ++-\n>  utils/codegen/ipc/parser.py                   |  3 ---\n>  utils/codegen/meson.build                     |  4 ++++\n>  8 files changed, 30 insertions(+), 19 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\n> index 96fca42cc0b8..bf55e124e97e 100644\n> --- a/include/libcamera/ipa/meson.build\n> +++ b/include/libcamera/ipa/meson.build\n> @@ -26,7 +26,8 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',\n>                                     '--output-root', meson.project_build_root(),\n>                                     '--input-root', meson.project_source_root(),\n>                                     '--mojoms', '@INPUT@'\n> -                               ])\n> +                               ],\n> +                               env : py_build_env)\n>  \n>  # core_ipa_interface.h\n>  libcamera_ipa_headers += custom_target('core_ipa_interface_h',\n> @@ -42,7 +43,8 @@ libcamera_ipa_headers += custom_target('core_ipa_interface_h',\n>                        '--libcamera_generate_core_header',\n>                        '--libcamera_output_path=@OUTPUT@',\n>                        './' +'@INPUT@'\n> -                  ])\n> +                  ],\n> +                  env : py_build_env)\n>  \n>  # core_ipa_serializer.h\n>  libcamera_ipa_headers += custom_target('core_ipa_serializer_h',\n> @@ -56,7 +58,8 @@ libcamera_ipa_headers += custom_target('core_ipa_serializer_h',\n>                        '--libcamera_generate_core_serializer',\n>                        '--libcamera_output_path=@OUTPUT@',\n>                        './' +'@INPUT@'\n> -                  ])\n> +                  ],\n> +                  env : py_build_env)\n>  \n>  # Mapping from pipeline handler name to mojom file\n>  pipeline_ipa_mojom_mapping = {\n> @@ -99,7 +102,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                '--output-root', meson.project_build_root(),\n>                                '--input-root', meson.project_source_root(),\n>                                '--mojoms', '@INPUT@'\n> -                          ])\n> +                          ],\n> +                          env : py_build_env)\n>  \n>      # {interface}_ipa_interface.h\n>      header = custom_target(name + '_ipa_interface_h',\n> @@ -115,7 +119,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                 '--libcamera_generate_header',\n>                                 '--libcamera_output_path=@OUTPUT@',\n>                                 './' +'@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n>  \n>      # {interface}_ipa_serializer.h\n>      serializer = custom_target(name + '_ipa_serializer_h',\n> @@ -129,7 +134,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                     '--libcamera_generate_serializer',\n>                                     '--libcamera_output_path=@OUTPUT@',\n>                                     './' +'@INPUT@'\n> -                               ])\n> +                               ],\n> +                               env : py_build_env)\n>  \n>      # {interface}_ipa_proxy.h\n>      proxy_header = custom_target(name + '_proxy_h',\n> @@ -143,7 +149,8 @@ foreach pipeline, file : pipeline_ipa_mojom_mapping\n>                                       '--libcamera_generate_proxy_h',\n>                                       '--libcamera_output_path=@OUTPUT@',\n>                                       './' +'@INPUT@'\n> -                                 ])\n> +                                 ],\n> +                                 env : py_build_env)\n>  \n>      ipa_mojoms += {\n>          'name': name,\n> diff --git a/src/libcamera/proxy/meson.build b/src/libcamera/proxy/meson.build\n> index d7de518a0549..8bd1b135d0f5 100644\n> --- a/src/libcamera/proxy/meson.build\n> +++ b/src/libcamera/proxy/meson.build\n> @@ -13,7 +13,8 @@ foreach mojom : ipa_mojoms\n>                                '--libcamera_generate_proxy_cpp',\n>                                '--libcamera_output_path=@OUTPUT@',\n>                                './' + '@INPUT@'\n> -                          ])\n> +                          ],\n> +                          env : py_build_env)\n>  \n>      libcamera_internal_sources += proxy\n>  endforeach\n> diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build\n> index b5ab9794c622..8c54a2e206a5 100644\n> --- a/src/libcamera/proxy/worker/meson.build\n> +++ b/src/libcamera/proxy/worker/meson.build\n> @@ -15,7 +15,8 @@ foreach mojom : ipa_mojoms\n>                                 '--libcamera_generate_proxy_worker',\n>                                 '--libcamera_output_path=@OUTPUT@',\n>                                 './' + '@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n>  \n>      proxy = executable(mojom['name'] + '_ipa_proxy', worker,\n>                         install : true,\n> diff --git a/test/serialization/generated_serializer/include/libcamera/ipa/meson.build b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> index 6f8794c188a3..ae08e9bee6b9 100644\n> --- a/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> +++ b/test/serialization/generated_serializer/include/libcamera/ipa/meson.build\n> @@ -9,7 +9,8 @@ mojom = custom_target('test_mojom_module',\n>                            '--output-root', meson.project_build_root(),\n>                            '--input-root', meson.project_source_root(),\n>                            '--mojoms', '@INPUT@'\n> -                      ])\n> +                      ],\n> +                      env : py_build_env)\n>  \n>  # test_ipa_interface.h\n>  generated_test_header = custom_target('test_ipa_interface_h',\n> @@ -23,7 +24,8 @@ generated_test_header = custom_target('test_ipa_interface_h',\n>                             '--libcamera_generate_header',\n>                             '--libcamera_output_path=@OUTPUT@',\n>                             './' +'@INPUT@'\n> -                       ])\n> +                       ],\n> +                       env : py_build_env)\n>  \n>  # test_ipa_serializer.h\n>  generated_test_serializer = custom_target('test_ipa_serializer_h',\n> @@ -37,4 +39,5 @@ generated_test_serializer = custom_target('test_ipa_serializer_h',\n>                                 '--libcamera_generate_serializer',\n>                                 '--libcamera_output_path=@OUTPUT@',\n>                                 './' +'@INPUT@'\n> -                           ])\n> +                           ],\n> +                           env : py_build_env)\n> diff --git a/utils/codegen/ipc/generate.py b/utils/codegen/ipc/generate.py\n> index c2b3fcb72e1f..dfbe659bc0ca 100755\n> --- a/utils/codegen/ipc/generate.py\n> +++ b/utils/codegen/ipc/generate.py\n> @@ -9,9 +9,6 @@\n>  import os\n>  import sys\n>  \n> -# TODO set sys.pycache_prefix for >= python3.8\n> -sys.dont_write_bytecode = True\n> -\n>  sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/bindings')\n>  \n>  import mojo.public.tools.bindings.mojom_bindings_generator as generator\n> diff --git a/utils/codegen/ipc/meson.build b/utils/codegen/ipc/meson.build\n> index 973a5417dc99..f77bf32497ba 100644\n> --- a/utils/codegen/ipc/meson.build\n> +++ b/utils/codegen/ipc/meson.build\n> @@ -13,6 +13,7 @@ mojom_docs_extractor = find_program('./extract-docs.py')\n>  mojom_templates = custom_target('mojom_templates',\n>                                  input : mojom_template_files,\n>                                  output : 'libcamera_templates.zip',\n> -                                command : [mojom_generator, '-o', '@OUTDIR@', 'precompile'])\n> +                                command : [mojom_generator, '-o', '@OUTDIR@', 'precompile'],\n> +                                env : py_build_env)\n>  \n>  mojom_templates_dir = meson.current_build_dir()\n> diff --git a/utils/codegen/ipc/parser.py b/utils/codegen/ipc/parser.py\n> index cb5608b7c165..8e70322d1bdb 100755\n> --- a/utils/codegen/ipc/parser.py\n> +++ b/utils/codegen/ipc/parser.py\n> @@ -9,9 +9,6 @@\n>  import os\n>  import sys\n>  \n> -# TODO set sys.pycache_prefix for >= python3.8\n> -sys.dont_write_bytecode = True\n> -\n>  # Make sure that mojom_parser.py can import mojom\n>  sys.path.insert(0, f'{os.path.dirname(__file__)}/mojo/public/tools/mojom')\n>  \n> diff --git a/utils/codegen/meson.build b/utils/codegen/meson.build\n> index 7dd312e16559..fb2196ee0d20 100644\n> --- a/utils/codegen/meson.build\n> +++ b/utils/codegen/meson.build\n> @@ -2,6 +2,10 @@\n>  \n>  ## Code generation\n>  \n> +py_build_env = environment()\n> +# \\todo Investigate usage of PYTHONPYCACHEPREFIX for Python >= 3.8\n> +py_build_env.set('PYTHONDONTWRITEBYTECODE', '1')\n> +\n>  py_modules += ['jinja2', 'yaml']\n>  \n>  gen_controls = files('gen-controls.py')","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 39A0AC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Aug 2024 02:38:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2E9DD63382;\n\tThu, 15 Aug 2024 04:38:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B902663382\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Aug 2024 04:38:37 +0200 (CEST)","from pyrite.rasen.tech (h175-177-049-024.catv02.itscom.jp\n\t[175.177.49.24])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A1100AD8;\n\tThu, 15 Aug 2024 04:37:38 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"MCcuJ2ug\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723689459;\n\tbh=utr3g00wNdI5Og2uDB8mkeSf/+s08J5qrAbPuVCqxlg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=MCcuJ2ug/P1E9PbzLUemKOaKR5EO/VYkjKmJ7b/cDnonHFBGjJ4jqEJeCo6FZJ1gH\n\t1YrPrMVcOxxAUCt8lQnRoa3R0gjTNtkn3Maf/f9mH5SO0Pgg84mgYgXa+OMAU2KB2i\n\tOS1q402Hpkq1Z9f6MauUJE2HSp+OF53TE2p2OIXk=","Date":"Thu, 15 Aug 2024 11:38:31 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 05/10] meson: utils: Provide environment for Python\n\tscripts","Message-ID":"<Zr1qJ3iijYtG7LtH@pyrite.rasen.tech>","References":"<20240809005914.20662-1-laurent.pinchart@ideasonboard.com>\n\t<20240809005914.20662-6-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240809005914.20662-6-laurent.pinchart@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]