(env: 'Environment', for_machine: MachineChoice)
Search for a cython compiler.
Search for a cython compiler.
Search for a cython compiler .
def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
    """Search for a cython compiler."""
    compilers, _, _ = _get_compilers(env, 'cython', for_machine)
    is_cross = env.is_cross_build(for_machine)
    info = env.machines[for_machine]

    popen_exceptions: T.Dict[str, Exception] = {}
    for comp in compilers:
        try:
            err = Popen_safe(comp + ['-V'])[2]
        except OSError as e:
            popen_exceptions[' '.join(comp + ['-V'])] = e
            continue

        version = search_version(err)
        if 'Cython' in err:
            comp_class = CythonCompiler
            env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env)
            return comp_class(comp, version, for_machine, info, is_cross=is_cross)
    _handle_exceptions(popen_exceptions, compilers)
    raise EnvironmentException('Unreachable code (exception to make mypy happy)')
def detect_cython_compiler ( env : 'Environment' , for_machine : MachineChoice ) -> Compiler : compilers , _ , _ = _get_compilers ( env , 'cython' , for_machine ) is_cross = env . is_cross_build ( for_machine ) info = env . machines [ for_machine ] popen_exceptions : T . Dict [ str , Exception ] = { } for comp in compilers : try : err = Popen_safe ( comp + [ '-V' ] ) [ 2 ] except OSError as e : popen_exceptions [ ' ' . join ( comp + [ '-V' ] ) ] = e continue version = search_version ( err ) if 'Cython' in err : comp_class = CythonCompiler env . coredata . add_lang_args ( comp_class . language , comp_class , for_machine , env ) return comp_class ( comp , version , for_machine , info , is_cross = is_cross ) _handle_exceptions ( popen_exceptions , compilers ) raise EnvironmentException ( 'Unreachable code (exception to make mypy happy)' )