Commit e0fc38f2 authored by Stefan Behnel's avatar Stefan Behnel

Enable the NumPy 1.7 API macro in all NumPy integration tests that do not rely...

Enable the NumPy 1.7 API macro in all NumPy integration tests that do not rely on deprecated C-API internaly.
parent 7d5c3ce2
# tag: numpy # tag: numpy_old
# You can ignore the previous line. # You can ignore the previous line.
# It's for internal testing of the cython documentation. # It's for internal testing of the cython documentation.
......
...@@ -254,12 +254,19 @@ def update_linetrace_extension(ext): ...@@ -254,12 +254,19 @@ def update_linetrace_extension(ext):
return ext return ext
def update_numpy_extension(ext): def update_old_numpy_extension(ext):
update_numpy_extension(ext, set_api17_macro=False)
def update_numpy_extension(ext, set_api17_macro=True):
import numpy import numpy
from numpy.distutils.misc_util import get_info from numpy.distutils.misc_util import get_info
ext.include_dirs.append(numpy.get_include()) ext.include_dirs.append(numpy.get_include())
if set_api17_macro:
ext.define_macros.append(('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION'))
# We need the npymath library for numpy.math. # We need the npymath library for numpy.math.
# This is typically a static-only library. # This is typically a static-only library.
for attr, value in get_info('npymath').items(): for attr, value in get_info('npymath').items():
...@@ -391,6 +398,7 @@ EXCLUDE_EXT = object() ...@@ -391,6 +398,7 @@ EXCLUDE_EXT = object()
EXT_EXTRAS = { EXT_EXTRAS = {
'tag:numpy' : update_numpy_extension, 'tag:numpy' : update_numpy_extension,
'tag:numpy_old' : update_old_numpy_extension,
'tag:openmp': update_openmp_extension, 'tag:openmp': update_openmp_extension,
'tag:cpp11': update_cpp11_extension, 'tag:cpp11': update_cpp11_extension,
'tag:trace' : update_linetrace_extension, 'tag:trace' : update_linetrace_extension,
......
# ticket: 155 # ticket: 155
# tag: numpy # tag: numpy_old
""" """
>>> myfunc() >>> myfunc()
......
# tag: numpy # tag: numpy_old
# tag: openmp # tag: openmp
cimport cython cimport cython
......
# tag: numpy # tag: numpy_old
cimport numpy as np cimport numpy as np
cimport cython cimport cython
......
# tag: numpy # tag: numpy_old
# cannot be named "numpy" in order to not clash with the numpy module! # cannot be named "numpy" in order to not clash with the numpy module!
cimport numpy as np cimport numpy as np
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment