diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index e05379ac1..71ae728b1 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -50,6 +50,7 @@ from .interpreterobjects import ( NullSubprojectInterpreter, ) from .type_checking import ( + DEPFILE_KW, ENV_KW, INSTALL_MODE_KW, LANGUAGE_KW, @@ -1717,7 +1718,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self 'generator', KwargInfo('arguments', ContainerTypeInfo(list, str, allow_empty=False), required=True, listify=True), KwargInfo('output', ContainerTypeInfo(list, str, allow_empty=False), required=True, listify=True), - KwargInfo('depfile', (str, NoneType), validator=lambda x: 'Depfile must be a plain filename with a subdirectory' if has_path_sep(x) else None), + DEPFILE_KW, KwargInfo('capture', bool, default=False, since='0.43.0'), KwargInfo('depends', ContainerTypeInfo(list, (build.BuildTarget, build.CustomTarget)), default=[], listify=True), ) diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index 4eed965dc..3c4c3f0f4 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -10,7 +10,7 @@ from ..build import EnvironmentVariables from ..coredata import UserFeatureOption from ..interpreterbase import TYPE_var from ..interpreterbase.decorators import KwargInfo, ContainerTypeInfo -from ..mesonlib import FileMode, MachineChoice, listify +from ..mesonlib import FileMode, MachineChoice, listify, has_path_sep # Helper definition for type checks that are `Optional[T]` NoneType: T.Type[None] = type(None) @@ -177,3 +177,9 @@ ENV_KW: KwargInfo[T.Union[EnvironmentVariables, T.List, T.Dict, str, None]] = Kw validator=_env_validator, convertor=_env_convertor, ) + +DEPFILE_KW = KwargInfo( + 'depfile', + str, + validator=lambda x: 'Depfile must be a plain filename with a subdirectory' if has_path_sep(x) else None +)