def process_kwargs(self, kwargs):
    super().process_kwargs(kwargs)
    self.sources = extract_as_list(kwargs, 'input', unholder=True)
    if ('output' not in kwargs):
        raise InvalidArguments('Missing keyword argument "output".')
    self.outputs = listify(kwargs['output'])
    inputs = get_sources_string_names(self.sources)
    values = get_filenames_templates_dict(inputs, [])
    for i in self.outputs:
        if (not isinstance(i, str)):
            raise InvalidArguments('Output argument not a string.')
        if (i == ''):
            raise InvalidArguments('Output must not be empty.')
        if (i.strip() == ''):
            raise InvalidArguments('Output must not consist only of whitespace.')
        if has_path_sep(i):
            raise InvalidArguments('Output {!r} must not contain a path segment.'.format(i))
        if (('@INPUT@' in i) or ('@INPUT0@' in i)):
            m = 'Output cannot contain @INPUT@ or @INPUT0@, did you mean @PLAINNAME@ or @BASENAME@?'
            raise InvalidArguments(m)
        if ((len(inputs) != 1) and (('@PLAINNAME@' in i) or ('@BASENAME@' in i))):
            m = "Output cannot contain @PLAINNAME@ or @BASENAME@ when there is more than one input (we can't know which to use)"
            raise InvalidArguments(m)
    self.outputs = substitute_values(self.outputs, values)
    self.capture = kwargs.get('capture', False)
    if (self.capture and (len(self.outputs) != 1)):
        raise InvalidArguments('Capturing can only output to a single file.')
    self.console = kwargs.get('console', False)
    if (not isinstance(self.console, bool)):
        raise InvalidArguments('"console" kwarg only accepts booleans')
    if (self.capture and self.console):
        raise InvalidArguments("Can't both capture output and output to console")
    if ('command' not in kwargs):
        raise InvalidArguments('Missing keyword argument "command".')
    if ('depfile' in kwargs):
        depfile = kwargs['depfile']
        if (not isinstance(depfile, str)):
            raise InvalidArguments('Depfile must be a string.')
        if (os.path.basename(depfile) != depfile):
            raise InvalidArguments('Depfile must be a plain filename without a subdirectory.')
        self.depfile = depfile
    self.command = self.flatten_command(kwargs['command'])
    if self.capture:
        for c in self.command:
            if (isinstance(c, str) and ('@OUTPUT@' in c)):
                raise InvalidArguments('@OUTPUT@ is not allowed when capturing output.')
    if ('install' in kwargs):
        self.install = kwargs['install']
        if (not isinstance(self.install, bool)):
            raise InvalidArguments('"install" must be boolean.')
        if self.install:
            if ('install_dir' not in kwargs):
                raise InvalidArguments('"install_dir" must be specified when installing a target')
            if isinstance(kwargs['install_dir'], list):
                FeatureNew('multiple install_dir for custom_target', '0.40.0').use(self.subproject)
            self.install_dir = typeslistify(kwargs['install_dir'], (str, bool))
            self.install_mode = kwargs.get('install_mode', None)
    else:
        self.install = False
        self.install_dir = [None]
        self.install_mode = None
    if (('build_always' in kwargs) and ('build_always_stale' in kwargs)):
        raise InvalidArguments('build_always and build_always_stale are mutually exclusive. Combine build_by_default and build_always_stale.')
    elif ('build_always' in kwargs):
        mlog.deprecation('build_always is deprecated. Combine build_by_default and build_always_stale instead.')
        if ('build_by_default' not in kwargs):
            self.build_by_default = kwargs['build_always']
        self.build_always_stale = kwargs['build_always']
    elif ('build_always_stale' in kwargs):
        self.build_always_stale = kwargs['build_always_stale']
    if (not isinstance(self.build_always_stale, bool)):
        raise InvalidArguments('Argument build_always_stale must be a boolean.')
    (extra_deps, depend_files) = extract_as_list(kwargs, 'depends', 'depend_files', pop=False)
    for ed in extra_deps:
        while hasattr(ed, 'held_object'):
            ed = ed.held_object
        if (not isinstance(ed, (CustomTarget, BuildTarget))):
            raise InvalidArguments(('Can only depend on toplevel targets: custom_target or build_target (executable or a library) got: %s(%s)' % (type(ed), ed)))
        self.extra_depends.append(ed)
    for i in depend_files:
        if isinstance(i, (File, str)):
            self.depend_files.append(i)
        else:
            mlog.debug(i)
            raise InvalidArguments('Unknown type {!r} in depend_files.'.format(type(i).__name__))
def process_kwargs(self, kwargs):
    super().process_kwargs(kwargs)
    self.sources = extract_as_list(kwargs, 'input', unholder=True)
    if ('output' not in kwargs):
        raise InvalidArguments('Missing keyword argument "output".')
    self.outputs = listify(kwargs['output'])
    inputs = get_sources_string_names(self.sources)
    values = get_filenames_templates_dict(inputs, [])
    for i in self.outputs:
        if (not isinstance(i, str)):
            raise InvalidArguments('Output argument not a string.')
        if (i == ):
            raise InvalidArguments('Output must not be empty.')
        if (i.strip() == ):
            raise InvalidArguments('Output must not consist only of whitespace.')
        if has_path_sep(i):
            raise InvalidArguments('Output {!r} must not contain a path segment.'.format(i))
        if (('@INPUT@' in i) or ('@INPUT0@' in i)):
            m = 'Output cannot contain @INPUT@ or @INPUT0@, did you mean @PLAINNAME@ or @BASENAME@?'
            raise InvalidArguments(m)
        if ((len(inputs) != 1) and (('@PLAINNAME@' in i) or ('@BASENAME@' in i))):
            m = "Output cannot contain @PLAINNAME@ or @BASENAME@ when there is more than one input (we can't know which to use)"
            raise InvalidArguments(m)
    self.outputs = substitute_values(self.outputs, values)
    self.capture = kwargs.get('capture', False)
    if (self.capture and (len(self.outputs) != 1)):
        raise InvalidArguments('Capturing can only output to a single file.')
    self.console = kwargs.get('console', False)
    if (not isinstance(self.console, bool)):
        raise InvalidArguments('"console" kwarg only accepts booleans')
    if (self.capture and self.console):
        raise InvalidArguments("Can't both capture output and output to console")
    if ('command' not in kwargs):
        raise InvalidArguments('Missing keyword argument "command".')
    if ('depfile' in kwargs):
        depfile = kwargs['depfile']
        if (not isinstance(depfile, str)):
            raise InvalidArguments('Depfile must be a string.')
        if (os.path.basename(depfile) != depfile):
            raise InvalidArguments('Depfile must be a plain filename without a subdirectory.')
        self.depfile = depfile
    self.command = self.flatten_command(kwargs['command'])
    if self.capture:
        for c in self.command:
            if (isinstance(c, str) and ('@OUTPUT@' in c)):
                raise InvalidArguments('@OUTPUT@ is not allowed when capturing output.')
    if ('install' in kwargs):
        self.install = kwargs['install']
        if (not isinstance(self.install, bool)):
            raise InvalidArguments('"install" must be boolean.')
        if self.install:
            if ('install_dir' not in kwargs):
                raise InvalidArguments('"install_dir" must be specified when installing a target')
            if isinstance(kwargs['install_dir'], list):
                FeatureNew('multiple install_dir for custom_target', '0.40.0').use(self.subproject)
            self.install_dir = typeslistify(kwargs['install_dir'], (str, bool))
            self.install_mode = kwargs.get('install_mode', None)
    else:
        self.install = False
        self.install_dir = [None]
        self.install_mode = None
    if (('build_always' in kwargs) and ('build_always_stale' in kwargs)):
        raise InvalidArguments('build_always and build_always_stale are mutually exclusive. Combine build_by_default and build_always_stale.')
    elif ('build_always' in kwargs):
        mlog.deprecation('build_always is deprecated. Combine build_by_default and build_always_stale instead.')
        if ('build_by_default' not in kwargs):
            self.build_by_default = kwargs['build_always']
        self.build_always_stale = kwargs['build_always']
    elif ('build_always_stale' in kwargs):
        self.build_always_stale = kwargs['build_always_stale']
    if (not isinstance(self.build_always_stale, bool)):
        raise InvalidArguments('Argument build_always_stale must be a boolean.')
    (extra_deps, depend_files) = extract_as_list(kwargs, 'depends', 'depend_files', pop=False)
    for ed in extra_deps:
        while hasattr(ed, 'held_object'):
            ed = ed.held_object
        if (not isinstance(ed, (CustomTarget, BuildTarget))):
            raise InvalidArguments(('Can only depend on toplevel targets: custom_target or build_target (executable or a library) got: %s(%s)' % (type(ed), ed)))
        self.extra_depends.append(ed)
    for i in depend_files:
        if isinstance(i, (File, str)):
            self.depend_files.append(i)
        else:
            mlog.debug(i)
            raise InvalidArguments('Unknown type {!r} in depend_files.'.format(type(i).__name__))