diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-11-17 10:58:53 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-12-05 15:20:09 -0500 |
commit | 3a0d6f65b037ad60fd66e5c459297f7f6fe33c4b (patch) | |
tree | 979cf93911d49b8c41abf4c7ea000daaf5b6eb39 /mesonbuild/modules | |
parent | ff3083c95688b70d33105b2abbf6e62064662e1b (diff) | |
download | meson-3a0d6f65b037ad60fd66e5c459297f7f6fe33c4b.zip meson-3a0d6f65b037ad60fd66e5c459297f7f6fe33c4b.tar.gz meson-3a0d6f65b037ad60fd66e5c459297f7f6fe33c4b.tar.bz2 |
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.
Diffstat (limited to 'mesonbuild/modules')
-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 |