Move base option check into OptionStore.

pull/13406/head
Jussi Pakkanen 5 months ago
parent 8e3f609e73
commit 0c36ace4b7
  1. 2
      mesonbuild/mconf.py
  2. 2
      mesonbuild/mintro.py
  3. 4
      mesonbuild/options.py
  4. 4
      mesonbuild/utils/universal.py

@ -292,7 +292,7 @@ class Conf:
if show_build_options:
self.print_options('', build_core_options[''])
self.print_options('Backend options', {k: v for k, v in self.coredata.optstore.items() if k.is_backend()})
self.print_options('Base options', {k: v for k, v in self.coredata.optstore.items() if k.is_base()})
self.print_options('Base options', {k: v for k, v in self.coredata.optstore.items() if self.coredata.optstore.is_base_option(k)})
self.print_options('Compiler options', host_compiler_options.get('', {}))
if show_build_options:
self.print_options('', build_compiler_options.get('', {}))

@ -329,7 +329,7 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s
add_keys(core_options, 'core')
add_keys({k: v for k, v in coredata.optstore.items() if k.is_backend()}, 'backend')
add_keys({k: v for k, v in coredata.optstore.items() if k.is_base()}, 'base')
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()},
'compiler',

@ -544,3 +544,7 @@ class OptionStore:
def is_reserved_name(self, key: OptionKey) -> bool:
return not self.is_project_option(key)
def is_base_option(self, key: OptionKey) -> bool:
"""Convenience method to check if this is a base option."""
return key.type is OptionType.BASE

@ -2403,10 +2403,6 @@ class OptionKey:
"""This method will be removed once we can delete OptionsView."""
return self.type is OptionType.PROJECT
def is_base(self) -> bool:
"""Convenience method to check if this is a base option."""
return self.type is OptionType.BASE
def pickle_load(filename: str, object_name: str, object_type: T.Type[_PL], suggest_reconfigure: bool = True) -> _PL:
load_fail_msg = f'{object_name} file {filename!r} is corrupted.'

Loading…
Cancel
Save