interpreter: move command kwarg to type_checking

pull/9329/head
Dylan Baker 3 years ago committed by Daniel Mensinger
parent 3374b7c323
commit 3bb6d56dcd
  1. 10
      mesonbuild/interpreter/interpreter.py
  2. 10
      mesonbuild/interpreter/type_checking.py

@ -50,6 +50,7 @@ from .interpreterobjects import (
NullSubprojectInterpreter,
)
from .type_checking import (
COMMAND_KW,
DEPENDS_KW,
DEPFILE_KW,
ENV_KW,
@ -1669,14 +1670,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
@typed_pos_args('run_target', str)
@typed_kwargs(
'run_target',
KwargInfo(
'command',
# TODO: should accept CustomTargetIndex as well?
ContainerTypeInfo(list, (str, build.BuildTarget, build.CustomTarget, ExternalProgram, mesonlib.File), allow_empty=False),
required=True,
listify=True,
default=[],
),
COMMAND_KW,
DEPENDS_KW,
ENV_KW.evolve(since='0.57.0'),
)

@ -11,6 +11,7 @@ from ..coredata import UserFeatureOption
from ..interpreterbase import TYPE_var
from ..interpreterbase.decorators import KwargInfo, ContainerTypeInfo
from ..mesonlib import File, FileMode, MachineChoice, listify, has_path_sep
from ..programs import ExternalProgram
# Helper definition for type checks that are `Optional[T]`
NoneType: T.Type[None] = type(None)
@ -197,3 +198,12 @@ DEPEND_FILES_KW: KwargInfo[T.List[T.Union[str, File]]] = KwargInfo(
listify=True,
default=[],
)
COMMAND_KW: KwargInfo[T.List[T.Union[BuildTarget, CustomTarget, ExternalProgram, File]]] = KwargInfo(
'command',
# TODO: should accept CustomTargetIndex as well?
ContainerTypeInfo(list, (str, BuildTarget, CustomTarget, ExternalProgram, File), allow_empty=False),
required=True,
listify=True,
default=[],
)

Loading…
Cancel
Save