Skip to content

Commit e38545b

Browse files
bonzinijpakkane
authored andcommitted
coredata: do not write None to cmd_line.txt
Fixes: #14955 Fixes: 37f7572 Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 92590bb commit e38545b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mesonbuild/coredata.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,13 @@ def update_cmd_line_file(build_dir: str, options: SharedCMDOptions) -> None:
654654
filename = get_cmd_line_file(build_dir)
655655
config = CmdLineFileParser()
656656
config.read(filename)
657-
config['options'].update({str(k): str(v) for k, v in options.cmd_line_options.items()})
657+
for k, v in options.cmd_line_options.items():
658+
keystr = str(k)
659+
if v is not None:
660+
config['options'][keystr] = str(v)
661+
elif keystr in config['options']:
662+
del config['options'][keystr]
663+
658664
with open(filename, 'w', encoding='utf-8') as f:
659665
config.write(f)
660666

0 commit comments

Comments
 (0)