|
2 | 2 | import os |
3 | 3 | from subprocess import check_call |
4 | 4 |
|
5 | | -from distutils.core import setup |
6 | | -from distutils.extension import Extension |
7 | 5 | from Cython.Distutils import build_ext |
8 | 6 | from Cython.Build import cythonize |
9 | | -from numpy.distutils.system_info import default_include_dirs, default_lib_dirs |
10 | 7 |
|
11 | | -from distutils.sysconfig import get_config_vars |
| 8 | + |
| 9 | +if sys.version_info < (3, 12): |
| 10 | + from distutils.core import setup |
| 11 | + from distutils.extension import Extension |
| 12 | + from numpy.distutils.system_info import default_include_dirs, default_lib_dirs |
| 13 | + from distutils.sysconfig import get_config_vars |
| 14 | +else: |
| 15 | + from setuptools import setup |
| 16 | + from setuptools.extension import Extension |
| 17 | + from sysconfig import get_config_vars |
| 18 | + default_include_dirs = [] |
| 19 | + default_lib_dirs = [] |
| 20 | + |
| 21 | + |
| 22 | +libraries = ["flint"] |
12 | 23 |
|
13 | 24 |
|
14 | 25 | if sys.platform == 'win32': |
15 | 26 | # |
16 | 27 | # This is used in CI to build wheels with mingw64 |
17 | 28 | # |
18 | 29 | if os.getenv('PYTHON_FLINT_MINGW64'): |
19 | | - libraries = ["flint", "mpfr", "gmp"] |
20 | 30 | includedir = os.path.join(os.path.dirname(__file__), '.local', 'include') |
21 | 31 | librarydir1 = os.path.join(os.path.dirname(__file__), '.local', 'bin') |
22 | 32 | librarydir2 = os.path.join(os.path.dirname(__file__), '.local', 'lib') |
|
26 | 36 | # Add gcc to the PATH in GitHub Actions when this setup.py is called by |
27 | 37 | # cibuildwheel. |
28 | 38 | os.environ['PATH'] += r';C:\msys64\mingw64\bin' |
| 39 | + libraries += ["mpfr", "gmp"] |
29 | 40 | elif os.getenv('PYTHON_FLINT_MINGW64_TMP'): |
30 | 41 | # This would be used to build under Windows against these libraries if |
31 | 42 | # they have been installed somewhere other than .local |
32 | | - libraries = ["flint", "mpfr", "gmp"] |
| 43 | + libraries += ["mpfr", "gmp"] |
33 | 44 | else: |
34 | 45 | # For the MSVC toolchain link with mpir instead of gmp |
35 | | - libraries = ["flint", "mpir", "mpfr", "pthreads"] |
| 46 | + libraries += ["mpir", "mpfr", "pthreads"] |
36 | 47 | else: |
37 | 48 | libraries = ["flint"] |
38 | 49 | (opt,) = get_config_vars('OPT') |
39 | 50 | os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes') |
40 | 51 |
|
41 | 52 |
|
42 | | -default_include_dirs += [ |
43 | | - os.path.join(d, "flint") for d in default_include_dirs |
44 | | -] |
45 | | - |
46 | | - |
47 | 53 | define_macros = [] |
48 | 54 | compiler_directives = { |
49 | 55 | 'language_level': 3, |
|
69 | 75 |
|
70 | 76 |
|
71 | 77 | ext_files = [ |
72 | | - # ("flint._flint", ["src/flint/_flint.pxd"]), # Main Module |
73 | | - ("flint.pyflint", ["src/flint/pyflint.pyx"]), # Main Module |
74 | | - # Submodules |
| 78 | + ("flint.pyflint", ["src/flint/pyflint.pyx"]), |
75 | 79 | ("flint.types.fmpz", ["src/flint/types/fmpz.pyx"]), |
76 | 80 | ("flint.types.fmpz_poly", ["src/flint/types/fmpz_poly.pyx"]), |
77 | 81 | ("flint.types.fmpz_mat", ["src/flint/types/fmpz_mat.pyx"]), |
|
119 | 123 | for e in ext_modules: |
120 | 124 | e.cython_directives = {"embedsignature": True} |
121 | 125 |
|
| 126 | + |
122 | 127 | setup( |
123 | 128 | name='python-flint', |
124 | 129 | cmdclass={'build_ext': build_ext}, |
125 | 130 | ext_modules=cythonize(ext_modules, compiler_directives=compiler_directives), |
126 | | - #ext_modules=cythonize(ext_modules, compiler_directives=compiler_directives, annotate=True), |
127 | 131 | packages=packages, |
128 | 132 | package_dir={'': 'src'}, |
129 | 133 | description='Bindings for FLINT and Arb', |
|
0 commit comments