def process_kwargs(self, kwargs, environment):
    super().process_kwargs(kwargs)
    self.copy_kwargs(kwargs)
    kwargs.get('modules', [])
    self.need_install = kwargs.get('install', self.need_install)
    llist = extract_as_list(kwargs, 'link_with')
    for linktarget in llist:
        if hasattr(linktarget, 'held_object'):
            linktarget = linktarget.held_object
        if isinstance(linktarget, dependencies.ExternalLibrary):
            raise MesonException('An external library was used in link_with keyword argument, which\nis reserved for libraries built as part of this project. External\nlibraries must be passed using the dependencies keyword argument\ninstead, because they are conceptually "external dependencies",\njust like those detected with the dependency() function.')
        self.link(linktarget)
    lwhole = extract_as_list(kwargs, 'link_whole')
    for linktarget in lwhole:
        self.link_whole(linktarget)
    (c_pchlist, cpp_pchlist, clist, cpplist, cslist, valalist, objclist, objcpplist, fortranlist, rustlist) = extract_as_list(kwargs, 'c_pch', 'cpp_pch', 'c_args', 'cpp_args', 'cs_args', 'vala_args', 'objc_args', 'objcpp_args', 'fortran_args', 'rust_args')
    self.add_pch('c', c_pchlist)
    self.add_pch('cpp', cpp_pchlist)
    compiler_args = {'c': clist, 'cpp': cpplist, 'cs': cslist, 'vala': valalist, 'objc': objclist, 'objcpp': objcpplist, 'fortran': fortranlist, 'rust': rustlist}
    for (key, value) in compiler_args.items():
        self.add_compiler_args(key, value)
    if ((not isinstance(self, Executable)) or ('export_dynamic' in kwargs)):
        self.vala_header = kwargs.get('vala_header', (self.name + '.h'))
        self.vala_vapi = kwargs.get('vala_vapi', (self.name + '.vapi'))
        self.vala_gir = kwargs.get('vala_gir', None)
    dlist = stringlistify(kwargs.get('d_args', []))
    self.add_compiler_args('d', dlist)
    dfeatures = dict()
    dfeature_unittest = kwargs.get('d_unittest', False)
    if dfeature_unittest:
        dfeatures['unittest'] = dfeature_unittest
    dfeature_versions = kwargs.get('d_module_versions', [])
    if dfeature_versions:
        dfeatures['versions'] = dfeature_versions
    dfeature_debug = kwargs.get('d_debug', [])
    if dfeature_debug:
        dfeatures['debug'] = dfeature_debug
    if ('d_import_dirs' in kwargs):
        dfeature_import_dirs = extract_as_list(kwargs, 'd_import_dirs', unholder=True)
        for d in dfeature_import_dirs:
            if (not isinstance(d, IncludeDirs)):
                raise InvalidArguments('Arguments to d_import_dirs must be include_directories.')
        dfeatures['import_dirs'] = dfeature_import_dirs
    if dfeatures:
        self.d_features = dfeatures
    self.link_args = extract_as_list(kwargs, 'link_args')
    for i in self.link_args:
        if (not isinstance(i, str)):
            raise InvalidArguments('Link_args arguments must be strings.')
    for l in self.link_args:
        if (('-Wl,-rpath' in l) or l.startswith('-rpath')):
            mlog.warning('Please do not define rpath with a linker argument, use install_rpath or build_rpath properties instead.\nThis will become a hard error in a future Meson release.')
    self.process_link_depends(kwargs.get('link_depends', []), environment)
    inclist = extract_as_list(kwargs, 'include_directories')
    self.add_include_dirs(inclist)
    deplist = extract_as_list(kwargs, 'dependencies')
    self.add_deps(deplist)
    self.install_dir = typeslistify(kwargs.get('install_dir', [None]), (str, bool))
    self.install_mode = kwargs.get('install_mode', None)
    main_class = kwargs.get('main_class', '')
    if (not isinstance(main_class, str)):
        raise InvalidArguments('Main class must be a string')
    self.main_class = main_class
    if isinstance(self, Executable):
        self.gui_app = kwargs.get('gui_app', False)
        if (not isinstance(self.gui_app, bool)):
            raise InvalidArguments('Argument gui_app must be boolean.')
    elif ('gui_app' in kwargs):
        raise InvalidArguments('Argument gui_app can only be used on executables.')
    extra_files = extract_as_list(kwargs, 'extra_files')
    for i in extra_files:
        assert isinstance(i, File)
        trial = os.path.join(environment.get_source_dir(), i.subdir, i.fname)
        if (not os.path.isfile(trial)):
            raise InvalidArguments(('Tried to add non-existing extra file %s.' % i))
    self.extra_files = extra_files
    self.install_rpath = kwargs.get('install_rpath', '')
    if (not isinstance(self.install_rpath, str)):
        raise InvalidArguments('Install_rpath is not a string.')
    self.build_rpath = kwargs.get('build_rpath', '')
    if (not isinstance(self.build_rpath, str)):
        raise InvalidArguments('Build_rpath is not a string.')
    resources = extract_as_list(kwargs, 'resources')
    for r in resources:
        if (not isinstance(r, str)):
            raise InvalidArguments('Resource argument is not a string.')
        trial = os.path.join(environment.get_source_dir(), self.subdir, r)
        if (not os.path.isfile(trial)):
            raise InvalidArguments(('Tried to add non-existing resource %s.' % r))
    self.resources = resources
    if ('name_prefix' in kwargs):
        name_prefix = kwargs['name_prefix']
        if isinstance(name_prefix, list):
            if name_prefix:
                raise InvalidArguments('name_prefix array must be empty to signify null.')
        elif (not isinstance(name_prefix, str)):
            raise InvalidArguments('name_prefix must be a string.')
        self.prefix = name_prefix
        self.name_prefix_set = True
    if ('name_suffix' in kwargs):
        name_suffix = kwargs['name_suffix']
        if isinstance(name_suffix, list):
            if name_suffix:
                raise InvalidArguments('name_suffix array must be empty to signify null.')
        else:
            if (not isinstance(name_suffix, str)):
                raise InvalidArguments('name_suffix must be a string.')
            if (name_suffix == ''):
                raise InvalidArguments('name_suffix should not be an empty string. If you want meson to use the default behaviour for each platform pass `[]` (empty array)')
            self.suffix = name_suffix
            self.name_suffix_set = True
    if isinstance(self, StaticLibrary):
        if (for_darwin(self.is_cross, self.environment) or for_windows(self.is_cross, self.environment)):
            self.pic = True
        else:
            self.pic = self._extract_pic_pie(kwargs, 'pic')
    if isinstance(self, Executable):
        if for_android(self.is_cross, self.environment):
            self.pie = True
        else:
            self.pie = self._extract_pic_pie(kwargs, 'pie')
    self.implicit_include_directories = kwargs.get('implicit_include_directories', True)
    if (not isinstance(self.implicit_include_directories, bool)):
        raise InvalidArguments('Implicit_include_directories must be a boolean.')
    self.gnu_symbol_visibility = kwargs.get('gnu_symbol_visibility', '')
    if (not isinstance(self.gnu_symbol_visibility, str)):
        raise InvalidArguments('GNU symbol visibility must be a string.')
    if (self.gnu_symbol_visibility != ''):
        permitted = ['default', 'internal', 'hidden', 'protected', 'inlineshidden']
        if (self.gnu_symbol_visibility not in permitted):
            raise InvalidArguments('GNU symbol visibility arg %s not one of: %s', self.symbol_visibility, ', '.join(permitted))
def process_kwargs(self, kwargs, environment):
    super().process_kwargs(kwargs)
    self.copy_kwargs(kwargs)
    kwargs.get('modules', [])
    self.need_install = kwargs.get('install', self.need_install)
    llist = extract_as_list(kwargs, 'link_with')
    for linktarget in llist:
        if hasattr(linktarget, 'held_object'):
            linktarget = linktarget.held_object
        if isinstance(linktarget, dependencies.ExternalLibrary):
            raise MesonException('An external library was used in link_with keyword argument, which\nis reserved for libraries built as part of this project. External\nlibraries must be passed using the dependencies keyword argument\ninstead, because they are conceptually "external dependencies",\njust like those detected with the dependency() function.')
        self.link(linktarget)
    lwhole = extract_as_list(kwargs, 'link_whole')
    for linktarget in lwhole:
        self.link_whole(linktarget)
    (c_pchlist, cpp_pchlist, clist, cpplist, cslist, valalist, objclist, objcpplist, fortranlist, rustlist) = extract_as_list(kwargs, 'c_pch', 'cpp_pch', 'c_args', 'cpp_args', 'cs_args', 'vala_args', 'objc_args', 'objcpp_args', 'fortran_args', 'rust_args')
    self.add_pch('c', c_pchlist)
    self.add_pch('cpp', cpp_pchlist)
    compiler_args = {'c': clist, 'cpp': cpplist, 'cs': cslist, 'vala': valalist, 'objc': objclist, 'objcpp': objcpplist, 'fortran': fortranlist, 'rust': rustlist}
    for (key, value) in compiler_args.items():
        self.add_compiler_args(key, value)
    if ((not isinstance(self, Executable)) or ('export_dynamic' in kwargs)):
        self.vala_header = kwargs.get('vala_header', (self.name + '.h'))
        self.vala_vapi = kwargs.get('vala_vapi', (self.name + '.vapi'))
        self.vala_gir = kwargs.get('vala_gir', None)
    dlist = stringlistify(kwargs.get('d_args', []))
    self.add_compiler_args('d', dlist)
    dfeatures = dict()
    dfeature_unittest = kwargs.get('d_unittest', False)
    if dfeature_unittest:
        dfeatures['unittest'] = dfeature_unittest
    dfeature_versions = kwargs.get('d_module_versions', [])
    if dfeature_versions:
        dfeatures['versions'] = dfeature_versions
    dfeature_debug = kwargs.get('d_debug', [])
    if dfeature_debug:
        dfeatures['debug'] = dfeature_debug
    if ('d_import_dirs' in kwargs):
        dfeature_import_dirs = extract_as_list(kwargs, 'd_import_dirs', unholder=True)
        for d in dfeature_import_dirs:
            if (not isinstance(d, IncludeDirs)):
                raise InvalidArguments('Arguments to d_import_dirs must be include_directories.')
        dfeatures['import_dirs'] = dfeature_import_dirs
    if dfeatures:
        self.d_features = dfeatures
    self.link_args = extract_as_list(kwargs, 'link_args')
    for i in self.link_args:
        if (not isinstance(i, str)):
            raise InvalidArguments('Link_args arguments must be strings.')
    for l in self.link_args:
        if (('-Wl,-rpath' in l) or l.startswith('-rpath')):
            mlog.warning('Please do not define rpath with a linker argument, use install_rpath or build_rpath properties instead.\nThis will become a hard error in a future Meson release.')
    self.process_link_depends(kwargs.get('link_depends', []), environment)
    inclist = extract_as_list(kwargs, 'include_directories')
    self.add_include_dirs(inclist)
    deplist = extract_as_list(kwargs, 'dependencies')
    self.add_deps(deplist)
    self.install_dir = typeslistify(kwargs.get('install_dir', [None]), (str, bool))
    self.install_mode = kwargs.get('install_mode', None)
    main_class = kwargs.get('main_class', )
    if (not isinstance(main_class, str)):
        raise InvalidArguments('Main class must be a string')
    self.main_class = main_class
    if isinstance(self, Executable):
        self.gui_app = kwargs.get('gui_app', False)
        if (not isinstance(self.gui_app, bool)):
            raise InvalidArguments('Argument gui_app must be boolean.')
    elif ('gui_app' in kwargs):
        raise InvalidArguments('Argument gui_app can only be used on executables.')
    extra_files = extract_as_list(kwargs, 'extra_files')
    for i in extra_files:
        assert isinstance(i, File)
        trial = os.path.join(environment.get_source_dir(), i.subdir, i.fname)
        if (not os.path.isfile(trial)):
            raise InvalidArguments(('Tried to add non-existing extra file %s.' % i))
    self.extra_files = extra_files
    self.install_rpath = kwargs.get('install_rpath', )
    if (not isinstance(self.install_rpath, str)):
        raise InvalidArguments('Install_rpath is not a string.')
    self.build_rpath = kwargs.get('build_rpath', )
    if (not isinstance(self.build_rpath, str)):
        raise InvalidArguments('Build_rpath is not a string.')
    resources = extract_as_list(kwargs, 'resources')
    for r in resources:
        if (not isinstance(r, str)):
            raise InvalidArguments('Resource argument is not a string.')
        trial = os.path.join(environment.get_source_dir(), self.subdir, r)
        if (not os.path.isfile(trial)):
            raise InvalidArguments(('Tried to add non-existing resource %s.' % r))
    self.resources = resources
    if ('name_prefix' in kwargs):
        name_prefix = kwargs['name_prefix']
        if isinstance(name_prefix, list):
            if name_prefix:
                raise InvalidArguments('name_prefix array must be empty to signify null.')
        elif (not isinstance(name_prefix, str)):
            raise InvalidArguments('name_prefix must be a string.')
        self.prefix = name_prefix
        self.name_prefix_set = True
    if ('name_suffix' in kwargs):
        name_suffix = kwargs['name_suffix']
        if isinstance(name_suffix, list):
            if name_suffix:
                raise InvalidArguments('name_suffix array must be empty to signify null.')
        else:
            if (not isinstance(name_suffix, str)):
                raise InvalidArguments('name_suffix must be a string.')
            if (name_suffix == ):
                raise InvalidArguments('name_suffix should not be an empty string. If you want meson to use the default behaviour for each platform pass `[]` (empty array)')
            self.suffix = name_suffix
            self.name_suffix_set = True
    if isinstance(self, StaticLibrary):
        if (for_darwin(self.is_cross, self.environment) or for_windows(self.is_cross, self.environment)):
            self.pic = True
        else:
            self.pic = self._extract_pic_pie(kwargs, 'pic')
    if isinstance(self, Executable):
        if for_android(self.is_cross, self.environment):
            self.pie = True
        else:
            self.pie = self._extract_pic_pie(kwargs, 'pie')
    self.implicit_include_directories = kwargs.get('implicit_include_directories', True)
    if (not isinstance(self.implicit_include_directories, bool)):
        raise InvalidArguments('Implicit_include_directories must be a boolean.')
    self.gnu_symbol_visibility = kwargs.get('gnu_symbol_visibility', )
    if (not isinstance(self.gnu_symbol_visibility, str)):
        raise InvalidArguments('GNU symbol visibility must be a string.')
    if (self.gnu_symbol_visibility != ):
        permitted = ['default', 'internal', 'hidden', 'protected', 'inlineshidden']
        if (self.gnu_symbol_visibility not in permitted):
            raise InvalidArguments('GNU symbol visibility arg %s not one of: %s', self.symbol_visibility, ', '.join(permitted))