def process_pyx(fromfile, tofile):
    try:
        from Cython.Compiler.Version import version as cython_version
        from distutils.version import LooseVersion
        if LooseVersion(cython_version) < LooseVersion('0.22'):
            raise Exception('Building PyFunt requires Cython >= 0.22')

    except ImportError:
        pass

    flags = ['--fast-fail']
    if tofile.endswith('.cxx'):
        flags += ['--cplus']

    try:
        try:
            # if fromfile == 'im2col_cython.pyx':
            #     print('compiling im2col_cython')
            #     r = subprocess.call(
            #         ['python', 'pyfunt/layers/setup.py', 'build_ext', '--inplace'])
            # else:
            r = subprocess.call(
                    ['cython'] + flags + ["-o", tofile, fromfile])
            if r != 0:
                raise Exception('Cython failed')

        except __HOLE__:
            # There are ways of installing Cython that don't result in a cython
            # executable on the path, see gh-2397.
            r = subprocess.call([sys.executable, '-c',
                                 'import sys; from Cython.Compiler.Main import '
                                 'setuptools_main as main; sys.exit(main())'] + flags +
                                ["-o", tofile, fromfile])
            if r != 0:
                raise Exception("Cython either isn't installed or it failed.")
    except OSError:
        raise OSError('Cython needs to be installed')
dataset/ETHPy150Open dnlcrl/PyFunt/tools/cythonize.py/process_pyx