mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-08-24 22:21:43 +02:00
Merge pull request #61 from TREX-CoE/fix-numpy-dependency
Pin minimal required numpy versions
This commit is contained in:
commit
0cba81fc38
@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([trexio], [0.3.0], [https://github.com/TREX-CoE/trexio/issues])
|
||||
AC_INIT([trexio], [1.0.0], [https://github.com/TREX-CoE/trexio/issues])
|
||||
AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11])
|
||||
AM_MAINTAINER_MODE()
|
||||
LT_PREREQ([2.2])
|
||||
|
@ -58,7 +58,14 @@ function build_wheel_for_py()
|
||||
# upgrade pip, otherwise it complains that manylinux wheel is "...not supported wheel on this platform"
|
||||
pip install --upgrade pip
|
||||
# install dependencies needed to build manylinux wheel
|
||||
pip install --upgrade setuptools wheel auditwheel numpy
|
||||
pip install --upgrade setuptools wheel auditwheel
|
||||
if [ ${PYVERSION} -eq 36 ] || [ ${PYVERSION} -eq 37 ]; then
|
||||
pip install numpy==1.17.3
|
||||
elif [ ${PYVERSION} -eq 38 ]; then
|
||||
pip install numpy==1.18.3
|
||||
else
|
||||
pip install numpy==1.19.3
|
||||
fi
|
||||
|
||||
# set an environment variable needed to locate numpy header files
|
||||
source tools/set_NUMPY_INCLUDEDIR.sh
|
||||
|
@ -2,6 +2,19 @@
|
||||
requires = [
|
||||
"setuptools>=42",
|
||||
"wheel",
|
||||
"pkgconfig"
|
||||
"pkgconfig",
|
||||
# Numpy requirements for different OS/architectures
|
||||
# Copied from https://github.com/scipy/scipy/blob/master/pyproject.toml (which is also licensed under BSD)
|
||||
"numpy==1.17.3; python_version=='3.6' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_machine!='aarch64'",
|
||||
"numpy==1.17.3; python_version=='3.7' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_machine!='aarch64'",
|
||||
"numpy==1.18.3; python_version=='3.8' and (platform_machine!='arm64' or platform_system!='Darwin') and platform_machine!='aarch64'",
|
||||
"numpy==1.19.3; python_version>='3.9' and (platform_machine!='arm64' or platform_system!='Darwin')",
|
||||
# Aarch64(Python 3.9 requirements are the same as AMD64)
|
||||
"numpy==1.19.2; python_version=='3.6' and platform_machine=='aarch64'",
|
||||
"numpy==1.19.2; python_version=='3.7' and platform_machine=='aarch64'",
|
||||
"numpy==1.19.2; python_version=='3.8' and platform_machine=='aarch64'",
|
||||
# Darwin Arm64
|
||||
"numpy>=1.20.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin'",
|
||||
"numpy>=1.20.0; python_version=='3.9' and platform_machine=='arm64' and platform_system=='Darwin'"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
@ -1,3 +1,3 @@
|
||||
setuptools>=42
|
||||
pkgconfig
|
||||
numpy
|
||||
numpy>=1.17.3
|
||||
|
@ -113,7 +113,6 @@ setup(name = 'trexio',
|
||||
"Operating System :: MacOS"
|
||||
],
|
||||
python_requires = ">=3.6",
|
||||
setup_requires = ['numpy', 'pkgconfig'],
|
||||
install_requires = ['numpy']
|
||||
install_requires = ['numpy>=1.17.3']
|
||||
)
|
||||
|
||||
|
201
src/numpy.i
201
src/numpy.i
@ -114,12 +114,17 @@
|
||||
if (py_obj == NULL ) return "C NULL value";
|
||||
if (py_obj == Py_None ) return "Python None" ;
|
||||
if (PyCallable_Check(py_obj)) return "callable" ;
|
||||
if (PyBytes_Check( py_obj)) return "string" ;
|
||||
if (PyLong_Check( py_obj)) return "int" ;
|
||||
if (PyString_Check( py_obj)) return "string" ;
|
||||
if (PyInt_Check( py_obj)) return "int" ;
|
||||
if (PyFloat_Check( py_obj)) return "float" ;
|
||||
if (PyDict_Check( py_obj)) return "dict" ;
|
||||
if (PyList_Check( py_obj)) return "list" ;
|
||||
if (PyTuple_Check( py_obj)) return "tuple" ;
|
||||
%#if PY_MAJOR_VERSION < 3
|
||||
if (PyFile_Check( py_obj)) return "file" ;
|
||||
if (PyModule_Check( py_obj)) return "module" ;
|
||||
if (PyInstance_Check(py_obj)) return "instance" ;
|
||||
%#endif
|
||||
|
||||
return "unknown type";
|
||||
}
|
||||
@ -540,7 +545,7 @@
|
||||
const npy_intp *dims = array_dimensions(ary);
|
||||
for (i=0; i < nd; ++i)
|
||||
n_non_one += (dims[i] != 1) ? 1 : 0;
|
||||
if (n_non_one > 1)
|
||||
if (n_non_one > 1)
|
||||
array_clearflags(ary,NPY_ARRAY_CARRAY);
|
||||
array_enableflags(ary,NPY_ARRAY_FARRAY);
|
||||
/* Recompute the strides */
|
||||
@ -2002,7 +2007,7 @@
|
||||
(PyObject* array = NULL)
|
||||
{
|
||||
npy_intp dims[1];
|
||||
if (!PyLong_Check($input))
|
||||
if (!PyInt_Check($input))
|
||||
{
|
||||
const char* typestring = pytype_string($input);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@ -2010,8 +2015,7 @@
|
||||
typestring);
|
||||
SWIG_fail;
|
||||
}
|
||||
$2 = (DIM_TYPE) PyLong_AsSsize_t($input);
|
||||
if ($2 == -1 && PyErr_Occurred()) SWIG_fail;
|
||||
$2 = (DIM_TYPE) PyInt_AsLong($input);
|
||||
dims[0] = (npy_intp) $2;
|
||||
array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
|
||||
if (!array) SWIG_fail;
|
||||
@ -2031,7 +2035,7 @@
|
||||
(PyObject* array = NULL)
|
||||
{
|
||||
npy_intp dims[1];
|
||||
if (!PyLong_Check($input))
|
||||
if (!PyInt_Check($input))
|
||||
{
|
||||
const char* typestring = pytype_string($input);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@ -2039,8 +2043,7 @@
|
||||
typestring);
|
||||
SWIG_fail;
|
||||
}
|
||||
$1 = (DIM_TYPE) PyLong_AsSsize_t($input);
|
||||
if ($1 == -1 && PyErr_Occurred()) SWIG_fail;
|
||||
$1 = (DIM_TYPE) PyInt_AsLong($input);
|
||||
dims[0] = (npy_intp) $1;
|
||||
array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
|
||||
if (!array) SWIG_fail;
|
||||
@ -2494,9 +2497,9 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$2), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$2), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2564,9 +2567,9 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$3), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2634,9 +2637,9 @@
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$3), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2708,9 +2711,9 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$4), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2782,9 +2785,9 @@
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$4), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2858,9 +2861,161 @@
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$5), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
|
||||
DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
|
||||
(DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
|
||||
{
|
||||
$1 = &data_temp;
|
||||
$2 = &dim1_temp;
|
||||
$3 = &dim2_temp;
|
||||
$4 = &dim3_temp;
|
||||
$5 = &dim4_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
|
||||
(DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
|
||||
{
|
||||
npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
|
||||
DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
(DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
|
||||
{
|
||||
$1 = &dim1_temp;
|
||||
$2 = &dim2_temp;
|
||||
$3 = &dim3_temp;
|
||||
$4 = &dim4_temp;
|
||||
$5 = &data_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
|
||||
(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
{
|
||||
npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
|
||||
DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
|
||||
(DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
|
||||
{
|
||||
$1 = &data_temp;
|
||||
$2 = &dim1_temp;
|
||||
$3 = &dim2_temp;
|
||||
$4 = &dim3_temp;
|
||||
$5 = &dim4_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
|
||||
(DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
{
|
||||
npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
|
||||
DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
(DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
|
||||
{
|
||||
$1 = &dim1_temp;
|
||||
$2 = &dim2_temp;
|
||||
$3 = &dim3_temp;
|
||||
$4 = &dim4_temp;
|
||||
$5 = &data_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
|
||||
(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
{
|
||||
npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
@ -2934,9 +3089,9 @@
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$5), free);
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
|
Loading…
Reference in New Issue
Block a user