From bdabc2e5de8764521ded7e2e919a13e9e214757d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 26 May 2025 08:42:53 +0200 Subject: interpreter: allow retrieving build options with get_option() Fixes: #14788 Signed-off-by: Paolo Bonzini --- docs/yaml/functions/get_option.yaml | 5 +++++ mesonbuild/interpreter/interpreter.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/yaml/functions/get_option.yaml b/docs/yaml/functions/get_option.yaml index 0934758bc..b8b1fc4cd 100644 --- a/docs/yaml/functions/get_option.yaml +++ b/docs/yaml/functions/get_option.yaml @@ -20,6 +20,11 @@ description: | See [`feature` options](Build-options.md#features) documentation for more details. + For options that are [specified + per-machine](Builtin-options.md#specifying-options-per-machine) + `get_option()` retrieves the value of the option for the + build machine if the argument starts with `build.`. + posargs: option_name: type: str diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 730f3d36e..8f68646d3 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1085,7 +1085,7 @@ class Interpreter(InterpreterBase, HoldableObject): value_object: T.Optional[options.AnyOptionType] try: - optkey = options.OptionKey(optname, self.subproject) + optkey = options.OptionKey.from_string(optname).evolve(subproject=self.subproject) value_object, value = self.coredata.optstore.get_value_object_and_value_for(optkey) except KeyError: if self.coredata.optstore.is_base_option(optkey): -- cgit v1.2.3