def add_languages_for(self, args, required, for_machine: MachineChoice):
    langs = set(self.coredata.compilers[for_machine].keys())
    langs.update(args)
    if ('vala' in langs):
        if ('c' not in langs):
            raise InterpreterException('Compiling Vala requires C. Add C to your project languages and rerun Meson.')
    success = True
    for lang in sorted(args, key=compilers.sort_clink):
        lang = lang.lower()
        clist = self.coredata.compilers[for_machine]
        machine_name = for_machine.get_lower_case_name()
        if (lang in clist):
            comp = clist[lang]
        else:
            try:
                comp = self.environment.detect_compiler_for(lang, for_machine)
                if (comp is None):
                    raise InvalidArguments(('Tried to use unknown language "%s".' % lang))
                if self.should_skip_sanity_check(for_machine):
                    mlog.log_once('Cross compiler sanity tests disabled via the cross file.')
                else:
                    comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
            except Exception:
                if (not required):
                    mlog.log('Compiler for language', mlog.bold(lang), 'for the', machine_name, 'machine not found.')
                    success = False
                    continue
                else:
                    raise
        if ((for_machine == MachineChoice.HOST) or self.environment.is_cross_build()):
            logger_fun = mlog.log
        else:
            logger_fun = mlog.debug
        logger_fun(comp.get_display_language(), 'compiler for the', machine_name, 'machine:', mlog.bold(' '.join(comp.get_exelist())), comp.get_version_string())
        if (comp.linker is not None):
            logger_fun(comp.get_display_language(), 'linker for the', machine_name, 'machine:', mlog.bold(' '.join(comp.linker.get_exelist())), comp.linker.id, comp.linker.version)
        self.build.ensure_static_linker(comp)
    return success
def add_languages_for(self, args, required, for_machine: MachineChoice):
    langs = set(self.coredata.compilers[for_machine].keys())
    langs.update(args)
    if ('vala' in langs):
        if ('c' not in langs):
            raise InterpreterException('Compiling Vala requires C. Add C to your project languages and rerun Meson.')
    success = True
    for lang in sorted(args, key=compilers.sort_clink):
        lang = lang.lower()
        clist = self.coredata.compilers[for_machine]
        machine_name = for_machine.get_lower_case_name()
        if (lang in clist):
            comp = clist[lang]
        else:
            try:
                comp = self.environment.detect_compiler_for(lang, for_machine)
                if (comp is None):
                    raise InvalidArguments(('Tried to use unknown language "%s".' % lang))
                if self.should_skip_sanity_check(for_machine):
                    mlog.log_once('Cross compiler sanity tests disabled via the cross file.')
                else:
                    comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
            except Exception:
                if (not required):
                    mlog.log('Compiler for language', mlog.bold(lang), 'for the', machine_name, 'machine not found.')
                    success = False
                    continue
                else:
                    raise
        if ((for_machine == MachineChoice.HOST) or self.environment.is_cross_build()):
            logger_fun = mlog.log
        else:
            logger_fun = mlog.debug
        logger_fun(comp.get_display_language(), 'compiler for the', machine_name, 'machine:', mlog.bold(' '.join(comp.get_exelist())), comp.get_version_string())
        if (comp.linker is not None):
            logger_fun(comp.get_display_language(), 'linker for the', machine_name, 'machine:', mlog.bold(' '.join(comp.linker.get_exelist())), comp.linker.id, comp.linker.version)
        self.build.ensure_static_linker(comp)
    return success