|
5 | 5 | from distutils.core import setup
|
6 | 6 | from distutils.extension import Extension
|
7 | 7 | from Cython.Distutils import build_ext
|
| 8 | +from Cython.Build import cythonize |
8 | 9 | from numpy.distutils.system_info import default_include_dirs, default_lib_dirs
|
9 | 10 |
|
10 | 11 | from distutils.sysconfig import get_config_vars
|
11 | 12 |
|
| 13 | + |
12 | 14 | if sys.platform == 'win32':
|
13 | 15 | #
|
14 | 16 | # This is used in CI to build wheels with mingw64
|
|
36 | 38 | (opt,) = get_config_vars('OPT')
|
37 | 39 | os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes')
|
38 | 40 |
|
| 41 | + |
39 | 42 | default_include_dirs += [
|
40 | 43 | os.path.join(d, "flint") for d in default_include_dirs
|
41 | 44 | ]
|
42 | 45 |
|
| 46 | + |
| 47 | +define_macros = [] |
| 48 | +compiler_directives = {'language_level':2} |
| 49 | + |
| 50 | + |
| 51 | +# Enable coverage tracing |
| 52 | +if os.getenv('PYTHON_FLINT_COVERAGE'): |
| 53 | + define_macros.append(('CYTHON_TRACE', 1)) |
| 54 | + compiler_directives['linetrace'] = True |
| 55 | + |
| 56 | + |
43 | 57 | ext_modules = [
|
44 | 58 | Extension(
|
45 | 59 | "flint._flint", ["src/flint/pyflint.pyx"],
|
46 | 60 | libraries=libraries,
|
47 | 61 | library_dirs=default_lib_dirs,
|
48 |
| - include_dirs=default_include_dirs) |
| 62 | + include_dirs=default_include_dirs, |
| 63 | + define_macros=define_macros, |
| 64 | + ) |
49 | 65 | ]
|
50 | 66 |
|
51 | 67 | for e in ext_modules:
|
|
54 | 70 | setup(
|
55 | 71 | name='python-flint',
|
56 | 72 | cmdclass={'build_ext': build_ext},
|
57 |
| - ext_modules=ext_modules, |
| 73 | + ext_modules=cythonize(ext_modules, compiler_directives=compiler_directives), |
58 | 74 | packages=['flint'],
|
59 | 75 | package_dir={'': 'src'},
|
60 | 76 | description='Bindings for FLINT and Arb',
|
|
0 commit comments