

def cythonize(cython_file, gen_file):
    try:
        from Cython.Compiler.Version import version as cython_version
        from distutils.version import LooseVersion
        if (LooseVersion(cython_version) < LooseVersion('0.21')):
            raise Exception('Building scikit-learn requires Cython >= 0.21')
    except ImportError:
        pass
    flags = ['--fast-fail']
    if gen_file.endswith('.cpp'):
        flags += ['--cplus']
    try:
        try:
            rc = subprocess.call(((['cython'] + flags) + ['-o', gen_file, cython_file]))
            if (rc != 0):
                raise Exception(('Cythonizing %s failed' % cython_file))
        except OSError:
            rc = subprocess.call((([sys.executable, '-c', 'import sys; from Cython.Compiler.Main import setuptools_main as main; sys.exit(main())'] + rc) + ['-o', gen_file, cython_file]))
            if (rc != 0):
                raise Exception(('Cythonizing %s failed' % cython_file))
    except OSError:
        raise OSError('Cython needs to be installed')

dataset/ETHPy150Open jakevdp/cython_template/tools/cythonize.py cythonize/VarMisuse@165/275 `flags`->`rc`