Skip to content

Commit

Permalink
fixup! options: merge set_value and set_option
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Mar 5, 2025
1 parent 1c233de commit d591e6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions mesonbuild/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,9 +950,12 @@ def set_option(self, key: OptionKey, new_value: ElementaryOptionValues, first_in
assert isinstance(prefix, str), 'for mypy'
new_value = self.sanitize_dir_option_value(prefix, key, new_value)

opt = self.get_value_object_for(key)
try:
opt = self.get_value_object_for(key)
except KeyError:
opt = None
if opt is None:
raise MesonException(f'Unknown options: {key!s} not found.')
raise MesonException(f'Unknown options: "{key!s}" not found.')

if opt.deprecated is True:
mlog.deprecation(f'Option {key.name!r} is deprecated')
Expand Down
2 changes: 1 addition & 1 deletion unittests/platformagnostictests.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def test_configure_removed_option(self) -> None:
f.write(line)
with self.assertRaises(subprocess.CalledProcessError) as e:
self.setconf('-Dneg_int_opt=0')
self.assertIn('Unknown options: "neg_int_opt"', e.exception.stdout)
self.assertIn('Unknown options: ":neg_int_opt"', e.exception.stdout)

def test_configure_option_changed_constraints(self) -> None:
"""Changing the constraints of an option without reconfiguring should work."""
Expand Down

0 comments on commit d591e6c

Please sign in to comment.