aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2024-06-29 18:50:31 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2024-07-11 11:53:39 +0300
commitc2552527fb2f607052c7aed633b67dbb19f06e38 (patch)
treec05f89ce2465f6f01de61617e535919fe6e656de
parent5c6e9d2d8fa25d62f1d249d265611a6dbbc03a4b (diff)
downloadmeson-c2552527fb2f607052c7aed633b67dbb19f06e38.zip
meson-c2552527fb2f607052c7aed633b67dbb19f06e38.tar.gz
meson-c2552527fb2f607052c7aed633b67dbb19f06e38.tar.bz2
Move compiler option check into OptionStore.
-rw-r--r--mesonbuild/mconf.py4
-rw-r--r--mesonbuild/mintro.py2
-rw-r--r--mesonbuild/options.py4
-rw-r--r--mesonbuild/utils/universal.py4
4 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 0d73b5b..0a88e57 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -282,8 +282,8 @@ class Conf:
host_core_options = self.split_options_per_subproject({k: v for k, v in core_options.items() if k.machine is MachineChoice.HOST})
build_core_options = self.split_options_per_subproject({k: v for k, v in core_options.items() if k.machine is MachineChoice.BUILD})
- host_compiler_options = self.split_options_per_subproject({k: v for k, v in self.coredata.optstore.items() if k.is_compiler() and k.machine is MachineChoice.HOST})
- build_compiler_options = self.split_options_per_subproject({k: v for k, v in self.coredata.optstore.items() if k.is_compiler() and k.machine is MachineChoice.BUILD})
+ host_compiler_options = self.split_options_per_subproject({k: v for k, v in self.coredata.optstore.items() if self.coredata.optstore.is_compiler_option(k) and k.machine is MachineChoice.HOST})
+ build_compiler_options = self.split_options_per_subproject({k: v for k, v in self.coredata.optstore.items() if self.coredata.optstore.is_compiler_option(k) and k.machine is MachineChoice.BUILD})
project_options = self.split_options_per_subproject({k: v for k, v in self.coredata.optstore.items() if self.coredata.optstore.is_project_option(k)})
show_build_options = self.default_values_only or self.build.environment.is_cross_build()
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 7fecfd0..718bfb0 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -331,7 +331,7 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s
add_keys({k: v for k, v in coredata.optstore.items() if coredata.optstore.is_backend_option(k)}, 'backend')
add_keys({k: v for k, v in coredata.optstore.items() if coredata.optstore.is_base_option(k)}, 'base')
add_keys(
- {k: v for k, v in sorted(coredata.optstore.items(), key=lambda i: i[0].machine) if k.is_compiler()},
+ {k: v for k, v in sorted(coredata.optstore.items(), key=lambda i: i[0].machine) if coredata.optstore.is_compiler_option(k)},
'compiler',
)
add_keys(dir_options, 'directory')
diff --git a/mesonbuild/options.py b/mesonbuild/options.py
index 4b9e61f..6318686 100644
--- a/mesonbuild/options.py
+++ b/mesonbuild/options.py
@@ -556,3 +556,7 @@ class OptionStore:
def is_backend_option(self, key: OptionKey) -> bool:
"""Convenience method to check if this is a backend option."""
return key.type is OptionType.BACKEND
+
+ def is_compiler_option(self, key: OptionKey) -> bool:
+ """Convenience method to check if this is a compiler option."""
+ return key.type is OptionType.COMPILER
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 5f533f2..4db209a 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_compiler(self) -> bool:
- """Convenience method to check if this is a builtin option."""
- return self.type is OptionType.COMPILER
-
def is_project_hack_for_optionsview(self) -> bool:
"""This method will be removed once we can delete OptionsView."""
return self.type is OptionType.PROJECT