Skip to content

Commit 92590bb

Browse files
bonzinijpakkane
authored andcommitted
options: do not raise exception for unknown options in -U command
Fixes: #14956 Signed-off-by: Paolo Bonzini <[email protected]>
1 parent dba1008 commit 92590bb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

mesonbuild/options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,9 @@ def set_from_configure_command(self, D_args: T.Dict[OptionKey, T.Optional[str]])
11171117
del self.augments[key]
11181118
dirty = True
11191119
else:
1120+
if key not in self.options:
1121+
raise MesonException(f"Unknown option: {key}")
1122+
11201123
# TODO: For project options, "dropping an augment" means going
11211124
# back to the superproject's value. However, it's confusing
11221125
# that -U does not simply remove the option from the stored

unittests/optiontests.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,11 @@ def test_reconfigure_b_nonexistent(self):
331331
optstore = OptionStore(False)
332332
optstore.set_from_configure_command({OptionKey('b_ndebug'): True})
333333

334+
def test_unconfigure_nonexistent(self):
335+
optstore = OptionStore(False)
336+
with self.assertRaises(MesonException):
337+
optstore.set_from_configure_command({OptionKey('nonexistent'): None})
338+
334339
def test_subproject_proj_opt_with_same_name(self):
335340
name = 'tests'
336341
subp = 'subp'

0 commit comments

Comments
 (0)