diff options
-rw-r--r-- | mesonbuild/modules/__init__.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py index e2ed38c..b63a5da 100644 --- a/mesonbuild/modules/__init__.py +++ b/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 |