Skip to content

Commit c0dade7

Browse files
bonzinieli-schwartz
authored andcommitted
interpreter: allow retrieving build options with get_option()
Fixes: mesonbuild#14788 Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit bdabc2e)
1 parent d9b9885 commit c0dade7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/yaml/functions/get_option.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ description: |
2020
See [`feature` options](Build-options.md#features)
2121
documentation for more details.
2222
23+
For options that are [specified
24+
per-machine](Builtin-options.md#specifying-options-per-machine)
25+
`get_option()` retrieves the value of the option for the
26+
build machine if the argument starts with `build.`.
27+
2328
posargs:
2429
option_name:
2530
type: str

mesonbuild/interpreter/interpreter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ def func_get_option(self, node: mparser.BaseNode, args: T.Tuple[str],
10771077
value_object: T.Optional[options.AnyOptionType]
10781078

10791079
try:
1080-
optkey = options.OptionKey(optname, self.subproject)
1080+
optkey = options.OptionKey.from_string(optname).evolve(subproject=self.subproject)
10811081
value_object, value = self.coredata.optstore.get_value_object_and_value_for(optkey)
10821082
except KeyError:
10831083
if self.coredata.optstore.is_base_option(optkey):

0 commit comments

Comments
 (0)