Move compiler option check into OptionStore.

uniquefilenames
Jussi Pakkanen 5 months ago
parent 5c6e9d2d8f
commit c2552527fb
  1. 4
      mesonbuild/mconf.py
  2. 2
      mesonbuild/mintro.py
  3. 4
      mesonbuild/options.py
  4. 4
      mesonbuild/utils/universal.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}) 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}) 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}) 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 k.is_compiler() and k.machine is MachineChoice.BUILD}) 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)}) 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() show_build_options = self.default_values_only or self.build.environment.is_cross_build()

@ -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_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 coredata.optstore.items() if coredata.optstore.is_base_option(k)}, 'base')
add_keys( 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', 'compiler',
) )
add_keys(dir_options, 'directory') add_keys(dir_options, 'directory')

@ -556,3 +556,7 @@ class OptionStore:
def is_backend_option(self, key: OptionKey) -> bool: def is_backend_option(self, key: OptionKey) -> bool:
"""Convenience method to check if this is a backend option.""" """Convenience method to check if this is a backend option."""
return key.type is OptionType.BACKEND 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

@ -2387,10 +2387,6 @@ class OptionKey:
"""Convenience method for key.evolve(machine=MachineChoice.HOST).""" """Convenience method for key.evolve(machine=MachineChoice.HOST)."""
return self.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: def is_project_hack_for_optionsview(self) -> bool:
"""This method will be removed once we can delete OptionsView.""" """This method will be removed once we can delete OptionsView."""
return self.type is OptionType.PROJECT return self.type is OptionType.PROJECT

Loading…
Cancel
Save