Created
November 23, 2017 20:06
-
-
Save david-batranu/6f96e059e8b225c91a753bbd4aa138ca to your computer and use it in GitHub Desktop.
basic cython compile everything
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # to test: | |
| # pip install Cython | |
| # run with CYTHON_BUILD=true setup.py bdist_wheel | |
| def ext_modules(): | |
| from setuptools import Extension | |
| from setuptools.extension import _have_cython | |
| cython_build = os.environ.get('CYTHON_BUILD') | |
| if not _have_cython() or not cython_build: | |
| return [] | |
| def _pystar_from_name(name): | |
| return os.path.join(*name.split('.') + ['*.py']) | |
| def _extension(name): | |
| return Extension('{}.*'.format(name), [_pystar_from_name(name)]) | |
| from Cython.Build import cythonize | |
| packages = find_packages(exclude=['ez_setup']) | |
| return cythonize([_extension(name) for name in packages]) | |
| setup(ext_modules=ext_modules()) |
Author
Author
Need zope.interface>=4.0.0, due to Cython being „meant to be "translate once, build anywhere"”: cython/cython#1936 (comment) and https://www.python.org/dev/peps/pep-3155/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or
cythonize -i file.py