aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-08-26 09:47:36 +0200
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-08-27 14:02:43 +0300
commit92590bb03487eac2624e29c8b040f76773b35c66 (patch)
treee5addb2a6b3d8c11a4dd23fcc83b8eac859fa559
parentdba1008ffee2392129f205c00d526073ff5b24c3 (diff)
downloadmeson-92590bb03487eac2624e29c8b040f76773b35c66.zip
meson-92590bb03487eac2624e29c8b040f76773b35c66.tar.gz
meson-92590bb03487eac2624e29c8b040f76773b35c66.tar.bz2
options: do not raise exception for unknown options in -U command
Fixes: #14956 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/options.py3
-rw-r--r--unittests/optiontests.py5
2 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/options.py b/mesonbuild/options.py
index b9f17cf..346abcc 100644
--- a/mesonbuild/options.py
+++ b/mesonbuild/options.py
@@ -1117,6 +1117,9 @@ class OptionStore:
del self.augments[key]
dirty = True
else:
+ if key not in self.options:
+ raise MesonException(f"Unknown option: {key}")
+
# TODO: For project options, "dropping an augment" means going
# back to the superproject's value. However, it's confusing
# that -U does not simply remove the option from the stored
diff --git a/unittests/optiontests.py b/unittests/optiontests.py
index 19ff8b4..8f49a80 100644
--- a/unittests/optiontests.py
+++ b/unittests/optiontests.py
@@ -331,6 +331,11 @@ class OptionTests(unittest.TestCase):
optstore = OptionStore(False)
optstore.set_from_configure_command({OptionKey('b_ndebug'): True})
+ def test_unconfigure_nonexistent(self):
+ optstore = OptionStore(False)
+ with self.assertRaises(MesonException):
+ optstore.set_from_configure_command({OptionKey('nonexistent'): None})
+
def test_subproject_proj_opt_with_same_name(self):
name = 'tests'
subp = 'subp'