From db074141d3776e461d72940bb14c81f5041f4cfe Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 3 May 2023 15:04:06 -0400 Subject: cmake module: make configured file correctly handle the do_conf_file API This doesn't accept a dict, only an actual ConfigurationData object. Due to the way we poke at it, a dict can sort of work anyway, but might not if the internal layout isn't exactly correct. This is evidenced by the way we make the dict values be hard-to-read tuples containing emptiness, because that's how ConfigurationData objects handle descriptions. Simplify and make the seed dictionary readable, then actually convert it into a real ConfigurationData. Bonus: this now passes type checking. --- mesonbuild/modules/cmake.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py index bbae0333d..a9c5d25b7 100644 --- a/mesonbuild/modules/cmake.py +++ b/mesonbuild/modules/cmake.py @@ -315,12 +315,12 @@ class CmakeModule(ExtensionModule): version_file = os.path.join(state.environment.scratch_dir, f'{name}ConfigVersion.cmake') - conf = { - 'CVF_VERSION': (version, ''), - 'CMAKE_SIZEOF_VOID_P': (str(self.detect_voidp_size(state.environment)), ''), - 'CVF_ARCH_INDEPENDENT': (arch_independent, ''), + conf: T.Dict[str, T.Union[str, bool, int]] = { + 'CVF_VERSION': version, + 'CMAKE_SIZEOF_VOID_P': str(self.detect_voidp_size(state.environment)), + 'CVF_ARCH_INDEPENDENT': arch_independent, } - mesonlib.do_conf_file(template_file, version_file, conf, 'meson') + mesonlib.do_conf_file(template_file, version_file, build.ConfigurationData(conf), 'meson') res = build.Data([mesonlib.File(True, state.environment.get_scratch_dir(), version_file)], pkgroot, pkgroot_name, None, state.subproject) return ModuleReturnValue(res, [res]) -- cgit v1.2.3