diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2024-06-29 18:42:40 +0300 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-07-11 11:53:39 +0300 |
| commit | 5c6e9d2d8fa25d62f1d249d265611a6dbbc03a4b (patch) | |
| tree | 31469e3054d8407abef285806daa030e66918e32 | |
| parent | 472d8852e9d9b21d0a20f52d37915127e556e8d9 (diff) | |
| download | meson-5c6e9d2d8fa25d62f1d249d265611a6dbbc03a4b.tar.gz | |
Move builtin option check into OptionStore.
| -rw-r--r-- | mesonbuild/coredata.py | 4 | ||||
| -rw-r--r-- | mesonbuild/mconf.py | 2 | ||||
| -rw-r--r-- | mesonbuild/mintro.py | 2 | ||||
| -rw-r--r-- | mesonbuild/options.py | 4 | ||||
| -rw-r--r-- | mesonbuild/utils/universal.py | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 30048b1c8..ded230418 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 0f345d96a..0d73b5be2 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 da1afdbd5..7fecfd01f 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 4af9c97ac..4b9e61f43 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 97cc0dc3a..5f533f237 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 |
