diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2020-02-18 14:28:34 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-02-19 09:31:50 -0500 |
commit | 76ae8658645c3e697bdf95777bbd36df7c1dd622 (patch) | |
tree | 5f3a89e287341249b3e5c95f64f5ffa205755341 | |
parent | 73ddc014774102b378bb89bf9d4801d7b231b745 (diff) | |
download | meson-76ae8658645c3e697bdf95777bbd36df7c1dd622.zip meson-76ae8658645c3e697bdf95777bbd36df7c1dd622.tar.gz meson-76ae8658645c3e697bdf95777bbd36df7c1dd622.tar.bz2 |
coredata: Fix crash when cmd_line_options contains booleans
`meson setup --debug` puts a bool object in cmd_line_options dictionary
that we have to convert to string.
Fixes: #6646
-rw-r--r-- | mesonbuild/coredata.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 720d064..11b8deb 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -850,6 +850,9 @@ def read_cmd_line_file(build_dir, options): # literal_eval to get it into the list of strings. options.native_file = ast.literal_eval(properties.get('native_file', '[]')) +def cmd_line_options_to_string(options): + return {k: str(v) for k, v in options.cmd_line_options.items()} + def write_cmd_line_file(build_dir, options): filename = get_cmd_line_file(build_dir) config = CmdLineFileParser() @@ -860,7 +863,7 @@ def write_cmd_line_file(build_dir, options): if options.native_file: properties['native_file'] = options.native_file - config['options'] = options.cmd_line_options + config['options'] = cmd_line_options_to_string(options) config['properties'] = properties with open(filename, 'w') as f: config.write(f) @@ -869,7 +872,7 @@ def update_cmd_line_file(build_dir, options): filename = get_cmd_line_file(build_dir) config = CmdLineFileParser() config.read(filename) - config['options'].update(options.cmd_line_options) + config['options'].update(cmd_line_options_to_string(options)) with open(filename, 'w') as f: config.write(f) |