aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2024-06-29 18:42:40 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2024-07-11 11:53:39 +0300
commit5c6e9d2d8fa25d62f1d249d265611a6dbbc03a4b (patch)
tree31469e3054d8407abef285806daa030e66918e32
parent472d8852e9d9b21d0a20f52d37915127e556e8d9 (diff)
downloadmeson-5c6e9d2d8fa25d62f1d249d265611a6dbbc03a4b.zip
meson-5c6e9d2d8fa25d62f1d249d265611a6dbbc03a4b.tar.gz
meson-5c6e9d2d8fa25d62f1d249d265611a6dbbc03a4b.tar.bz2
Move builtin option check into OptionStore.
-rw-r--r--mesonbuild/coredata.py4
-rw-r--r--mesonbuild/mconf.py2
-rw-r--r--mesonbuild/mintro.py2
-rw-r--r--mesonbuild/options.py4
-rw-r--r--mesonbuild/utils/universal.py4
5 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 30048b1..ded2304 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -453,7 +453,7 @@ class CoreData:
def set_option(self, key: OptionKey, value, first_invocation: bool = False) -> bool:
dirty = False
- if key.is_builtin():
+ if self.optstore.is_builtin_option(key):
if key.name == 'prefix':
value = self.sanitize_prefix(value)
else:
@@ -694,7 +694,7 @@ class CoreData:
# Always test this using the HOST machine, as many builtin options
# are not valid for the BUILD machine, but the yielding value does
# not differ between them even when they are valid for both.
- if subproject and k.is_builtin() and self.optstore.get_value_object(k.evolve(subproject='', machine=MachineChoice.HOST)).yielding:
+ if subproject and self.optstore.is_builtin_option(k) and self.optstore.get_value_object(k.evolve(subproject='', machine=MachineChoice.HOST)).yielding:
continue
# Skip base, compiler, and backend options, they are handled when
# adding languages and setting backend.
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 0f345d9..0d73b5b 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -277,7 +277,7 @@ class Conf:
if self.build and k.module not in self.build.modules:
continue
module_options[k.module][k] = v
- elif k.is_builtin():
+ elif self.coredata.optstore.is_builtin_option(k):
core_options[k] = v
host_core_options = self.split_options_per_subproject({k: v for k, v in core_options.items() if k.machine is MachineChoice.HOST})
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index da1afdb..7fecfd0 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -298,7 +298,7 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s
dir_options[k] = v
elif k in test_option_names:
test_options[k] = v
- elif k.is_builtin():
+ elif coredata.optstore.is_builtin_option(k):
core_options[k] = v
if not v.yielding:
for s in subprojects:
diff --git a/mesonbuild/options.py b/mesonbuild/options.py
index 4af9c97..4b9e61f 100644
--- a/mesonbuild/options.py
+++ b/mesonbuild/options.py
@@ -545,6 +545,10 @@ class OptionStore:
def is_reserved_name(self, key: OptionKey) -> bool:
return not self.is_project_option(key)
+ def is_builtin_option(self, key: OptionKey) -> bool:
+ """Convenience method to check if this is a builtin option."""
+ return key.type is OptionType.BUILTIN
+
def is_base_option(self, key: OptionKey) -> bool:
"""Convenience method to check if this is a base option."""
return key.type is OptionType.BASE
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 97cc0dc..5f533f2 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -2387,10 +2387,6 @@ class OptionKey:
"""Convenience method for key.evolve(machine=MachineChoice.HOST)."""
return self.evolve(machine=MachineChoice.HOST)
- def is_builtin(self) -> bool:
- """Convenience method to check if this is a builtin option."""
- return self.type is OptionType.BUILTIN
-
def is_compiler(self) -> bool:
"""Convenience method to check if this is a builtin option."""
return self.type is OptionType.COMPILER