Skip to content

Commit

Permalink
setup.py: cleaner condition for Cython<3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Oct 25, 2023
1 parent b2f51e9 commit 7ebc054
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from distutils.core import setup

import numpy
from Cython import __version__ as __cython_version__
from Cython.Compiler import Main
from setuptools import Distribution, Extension

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

MACROS_CPP = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
Expand Down

0 comments on commit 7ebc054

Please sign in to comment.