Skip to content

Commit c343f39

Browse files
committed
Use version checks for setuptools in setup.py
1 parent 1e77473 commit c343f39

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

setup.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@
22
import os
33
from subprocess import check_call
44

5-
from setuptools import setup
6-
from setuptools.extension import Extension
75
from Cython.Distutils import build_ext
86
from Cython.Build import cythonize
97

108

11-
default_include_dirs = []
12-
default_lib_dirs = []
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+
1321

1422
libraries = ["flint"]
1523

@@ -36,6 +44,10 @@
3644
else:
3745
# For the MSVC toolchain link with mpir instead of gmp
3846
libraries += ["mpir", "mpfr", "pthreads"]
47+
else:
48+
libraries = ["flint"]
49+
(opt,) = get_config_vars('OPT')
50+
os.environ['OPT'] = " ".join(flag for flag in opt.split() if flag != '-Wstrict-prototypes')
3951

4052

4153
define_macros = []

0 commit comments

Comments
 (0)