(name: str, env: 'Environment', for_machine: MachineChoice,
                    language: T.Optional[str])
return None
Given a language and environment find the compiler used.
Given a language and environment find the compiler used.
Given a language and environment find the compiler used .
def detect_compiler(name: str, env: 'Environment', for_machine: MachineChoice,
                    language: T.Optional[str]) -> T.Optional['Compiler']:
    """Given a language and environment find the compiler used."""
    compilers = env.coredata.compilers[for_machine]

    # Set the compiler for this dependency if a language is specified,
    # else try to pick something that looks usable.
    if language:
        if language not in compilers:
            m = name.capitalize() + ' requires a {0} compiler, but ' \
                '{0} is not in the list of project languages'
            raise DependencyException(m.format(language.capitalize()))
        return compilers[language]
    else:
        for lang in clib_langs:
            try:
                return compilers[lang]
            except KeyError:
                continue
    return None
def detect_compiler ( name : str , env : 'Environment' , for_machine : MachineChoice , language : T . Optional [ str ] ) -> T . Optional [ 'Compiler' ] : compilers = env . coredata . compilers [ for_machine ] # Set the compiler for this dependency if a language is specified, # else try to pick something that looks usable. if language : if language not in compilers : m = name . capitalize ( ) + ' requires a {0} compiler, but ' '{0} is not in the list of project languages' raise DependencyException ( m . format ( language . capitalize ( ) ) ) return compilers [ language ] else : for lang in clib_langs : try : return compilers [ lang ] except KeyError : continue return None