From b2654b2d43089c933e66ab1d3dfb547caecfea71 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 5 Sep 2023 07:49:18 -0400 Subject: Fix crash when installing a vala library and python sources Installing python sources causes the python module to call create_install_data() before Ninja backends adds extra outputs to Vala targets. Target objects are supposed to be immutable, adding outputs that late is totally wrong. Add extra vala outputs immediately, but be careful because the main output is only added later in post_init(). Luckily the base class already puts a placeholder item in self.outputs for the main filename so we can just replace self.outputs[0] instead of replacing the whole list which would contain vala outputs at that stage. This is surprisingly what SharedLibrary was already doing. --- run_project_tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'run_project_tests.py') diff --git a/run_project_tests.py b/run_project_tests.py index 446dc12b8..8e0af2659 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -40,6 +40,7 @@ import time import typing as T import xml.etree.ElementTree as ET import collections +import importlib.util from mesonbuild import build from mesonbuild import environment @@ -169,7 +170,7 @@ class InstalledFile: return None # Handle the different types - if self.typ in {'py_implib', 'py_limited_implib', 'python_lib', 'python_limited_lib', 'python_file'}: + if self.typ in {'py_implib', 'py_limited_implib', 'python_lib', 'python_limited_lib', 'python_file', 'python_bytecode'}: val = p.as_posix() val = val.replace('@PYTHON_PLATLIB@', python.platlib) val = val.replace('@PYTHON_PURELIB@', python.purelib) @@ -196,6 +197,8 @@ class InstalledFile: return p.with_suffix('.dll.a') else: return None + if self.typ == 'python_bytecode': + return p.parent / importlib.util.cache_from_source(p.name) elif self.typ in {'file', 'dir'}: return p elif self.typ == 'shared_lib': -- cgit v1.2.3