modules: Add a method to the state object for include_dirs

The Interpreter has a method for this, and the module state just wraps
it.
pull/11024/head
Dylan Baker 2 years ago committed by Eli Schwartz
parent ff3083c956
commit 3a0d6f65b0
  1. 16
      mesonbuild/modules/__init__.py

@ -19,8 +19,9 @@ import dataclasses
import typing as T
from .. import mesonlib
from ..mesonlib import relpath, HoldableObject, MachineChoice
from ..build import IncludeDirs
from ..interpreterbase.decorators import noKwargs, noPosargs
from ..mesonlib import relpath, HoldableObject, MachineChoice
from ..programs import ExternalProgram
if T.TYPE_CHECKING:
@ -151,6 +152,19 @@ class ModuleState:
key = mesonlib.OptionKey(name, subproject, machine, lang, module)
return key in self._interpreter.user_defined_options.cmd_line_options
def process_include_dirs(self, dirs: T.Iterable[T.Union[str, IncludeDirs]]) -> T.Iterable[IncludeDirs]:
"""Convert raw include directory arguments to only IncludeDirs
:param dirs: An iterable of strings and IncludeDirs
:return: None
:yield: IncludeDirs objects
"""
for d in dirs:
if isinstance(d, IncludeDirs):
yield d
else:
yield self._interpreter.build_incdir_object([d])
class ModuleObject(HoldableObject):
"""Base class for all objects returned by modules

Loading…
Cancel
Save