Skip to content

Commit 7ebc054

Browse files
committed
setup.py: cleaner condition for Cython<3.0
1 parent b2f51e9 commit 7ebc054

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from distutils.core import setup
77

88
import numpy
9+
from Cython import __version__ as __cython_version__
910
from Cython.Compiler import Main
1011
from setuptools import Distribution, Extension
1112

@@ -41,9 +42,11 @@ def compile_cython_extensions():
4142
# -------------------------------------------------------------------------------------
4243
# TODO: When dropping support for Cython < 3.0, we can remove the following lines.
4344
# In the meantime, we hide the deprecation warnings when building the package.
44-
if not is_msvc():
45+
if tuple(map(int, __cython_version__.split(".")[:2])) < (3, 0):
46+
# hide deprecation warnings
4547
MACROS_CYTHON = []
46-
CFLAGS_CYTHON = ["-Wno-cpp"]
48+
if not is_msvc():
49+
CFLAGS_CYTHON = ["-Wno-cpp"]
4750
# -------------------------------------------------------------------------------------
4851

4952
MACROS_CPP = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]

0 commit comments

Comments
 (0)