Skip to content

Commit

Permalink
[Cython] Suppress deprecated NumPy API warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl authored and speth committed Aug 2, 2022
1 parent a5e4044 commit fe89cee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SConstruct
Expand Up @@ -1604,6 +1604,10 @@ if env['python_package'] != 'none':
f"Cython is an incompatible version: Found {cython_version} but "
f"{cython_min_version} or newer is required.")
warn_no_full_package = True
elif cython_version < parse_version("3.0.0"):
logger.info(
f"Using Cython version {cython_version} (uses legacy NumPy API)")
env["numpy_1_7_API"] = True
else:
logger.info(f"Using Cython version {cython_version}")

Expand Down
3 changes: 3 additions & 0 deletions interfaces/cython/SConscript
Expand Up @@ -78,6 +78,9 @@ elif localenv['OS'] == 'Cygwin':
# extract 'pythonX.Y' from 'libpythonX.Y.dll.a'
localenv.Append(LIBS=pylib[3:-6])

if "numpy_1_7_API" in localenv:
localenv.Append(CPPDEFINES="NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION")

localenv["module_ext"] = module_ext
setup_cfg = localenv.SubstFile("setup.cfg", "setup.cfg.in")
readme = localenv.Command("README.rst", "#README.rst", Copy("$TARGET", "$SOURCE"))
Expand Down

0 comments on commit fe89cee

Please sign in to comment.