summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/coredata.py7
-rw-r--r--mesonbuild/environment.py2
-rw-r--r--mesonbuild/mintro.py2
-rw-r--r--mesonbuild/options.py5
4 files changed, 7 insertions, 9 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 6e270a4a9..03d80d940 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -489,13 +489,6 @@ class CoreData:
return dirty
- def is_per_machine_option(self, optname: OptionKey) -> bool:
- if isinstance(optname, str):
- optname = OptionKey.from_string(optname)
- if optname.as_host() in options.BUILTIN_OPTIONS_PER_MACHINE:
- return True
- return self.optstore.is_compiler_option(optname)
-
def get_external_args(self, for_machine: MachineChoice, lang: str) -> T.List[str]:
# mypy cannot analyze type of OptionKey
key = OptionKey(f'{lang}_args', machine=for_machine)
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 9d0677446..12f94bbd4 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -663,7 +663,7 @@ class Environment:
# Keep only per machine options from the native file. The cross
# file takes precedence over all other options.
for key, value in list(self.options.items()):
- if self.coredata.is_per_machine_option(key):
+ if self.coredata.optstore.is_per_machine_option(key):
self.options[key.as_build()] = value
self._load_machine_file_options(config, properties.host, MachineChoice.HOST)
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 87ed66ec8..9b2a01f4c 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -307,7 +307,7 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s
def add_keys(opts: T.Union[cdata.MutableKeyedOptionDictType, options.OptionStore], section: str) -> None:
for key, opt in sorted(opts.items()):
optdict = {'name': str(key), 'value': opt.value, 'section': section,
- 'machine': key.machine.get_lower_case_name() if coredata.is_per_machine_option(key) else 'any'}
+ 'machine': key.machine.get_lower_case_name() if coredata.optstore.is_per_machine_option(key) else 'any'}
if isinstance(opt, options.UserStringOption):
typestr = 'string'
elif isinstance(opt, options.UserBooleanOption):
diff --git a/mesonbuild/options.py b/mesonbuild/options.py
index 8f71bc517..e854f1119 100644
--- a/mesonbuild/options.py
+++ b/mesonbuild/options.py
@@ -1132,6 +1132,11 @@ class OptionStore:
"""Convenience method to check if this is a project option."""
return key in self.project_options
+ def is_per_machine_option(self, optname: OptionKey) -> bool:
+ if optname.evolve(subproject=None, machine=MachineChoice.HOST) in BUILTIN_OPTIONS_PER_MACHINE:
+ return True
+ return self.is_compiler_option(optname)
+
def is_reserved_name(self, key: OptionKey) -> bool:
if key.name in _BUILTIN_NAMES:
return True