summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-05-03 15:04:06 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-05-03 16:24:20 -0400
commitdb074141d3776e461d72940bb14c81f5041f4cfe (patch)
tree28c71062fec5e9f84463c3717fc2511cc79319ed
parent5a9b2cb8f8c8154e62b392ef3f1dbc94e8e1b319 (diff)
downloadmeson-db074141d3776e461d72940bb14c81f5041f4cfe.tar.gz
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.
-rw-r--r--mesonbuild/modules/cmake.py10
1 files 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])