Move backend option check into OptionStore.

uniquefilenames
Jussi Pakkanen 5 months ago
parent 0c36ace4b7
commit 472d8852e9
  1. 2
      mesonbuild/ast/introspection.py
  2. 2
      mesonbuild/interpreter/interpreter.py
  3. 2
      mesonbuild/mconf.py
  4. 2
      mesonbuild/mintro.py
  5. 4
      mesonbuild/options.py
  6. 4
      mesonbuild/utils/universal.py

@ -130,7 +130,7 @@ class IntrospectionInterpreter(AstInterpreter):
self.do_subproject(SubProject(i))
self.coredata.init_backend_options(self.backend)
options = {k: v for k, v in self.environment.options.items() if k.is_backend()}
options = {k: v for k, v in self.environment.options.items() if self.environment.coredata.optstore.is_backend_option(k)}
self.coredata.set_options(options)
self._add_languages(proj_langs, True, MachineChoice.HOST)

@ -1148,7 +1148,7 @@ class Interpreter(InterpreterBase, HoldableObject):
if self.environment.first_invocation:
self.coredata.init_backend_options(backend_name)
options = {k: v for k, v in self.environment.options.items() if k.is_backend()}
options = {k: v for k, v in self.environment.options.items() if self.environment.coredata.optstore.is_backend_option(k)}
self.coredata.set_options(options)
@typed_pos_args('project', str, varargs=str)

@ -291,7 +291,7 @@ class Conf:
self.print_options('Core options', host_core_options[''])
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('Backend options', {k: v for k, v in self.coredata.optstore.items() if self.coredata.optstore.is_backend_option(k)})
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:

@ -328,7 +328,7 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s
optlist.append(optdict)
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 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()},

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

@ -2387,10 +2387,6 @@ class OptionKey:
"""Convenience method for key.evolve(machine=MachineChoice.HOST)."""
return self.evolve(machine=MachineChoice.HOST)
def is_backend(self) -> bool:
"""Convenience method to check if this is a backend option."""
return self.type is OptionType.BACKEND
def is_builtin(self) -> bool:
"""Convenience method to check if this is a builtin option."""
return self.type is OptionType.BUILTIN

Loading…
Cancel
Save