[pypy-commit] pypy ufuncapi: revise headers so pypy/numpy, mattip/matplotlib can build and install

mattip noreply at buildbot.pypy.org
Sun Dec 28 17:36:25 CET 2014


Author: mattip <matti.picus at gmail.com>
Branch: ufuncapi
Changeset: r75134:7c52ddf58e9d
Date: 2014-12-27 23:45 +0200
http://bitbucket.org/pypy/pypy/changeset/7c52ddf58e9d/

Log:	revise headers so pypy/numpy, mattip/matplotlib can build and
	install

diff --git a/pypy/module/cpyext/include/numpy/__multiarray_api.h b/pypy/module/cpyext/include/numpy/__multiarray_api.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/include/numpy/__multiarray_api.h
@@ -0,0 +1,10 @@
+
+
+typedef struct {
+        PyObject_HEAD
+        npy_bool obval;
+} PyBoolScalarObject;
+
+#define import_array()
+#define PyArray_New _PyArray_New
+
diff --git a/pypy/module/cpyext/include/numpy/arrayobject.h b/pypy/module/cpyext/include/numpy/arrayobject.h
--- a/pypy/module/cpyext/include/numpy/arrayobject.h
+++ b/pypy/module/cpyext/include/numpy/arrayobject.h
@@ -11,6 +11,8 @@
 #endif
 
 #include "old_defines.h"
+#include "npy_common.h"
+#include "__multiarray_api.h"
 
 #define NPY_UNUSED(x) x
 #define PyArray_MAX(a,b) (((a)>(b))?(a):(b))
@@ -22,23 +24,6 @@
 
 PyAPI_DATA(PyTypeObject) PyArray_Type;
 
-#ifndef _NPY_COMMON_H_
-#define _NPY_COMMON_H_
-typedef unsigned char npy_bool;
-typedef unsigned char npy_uint8;
-typedef unsigned short npy_uint16;
-typedef signed short npy_int16;
-typedef signed char npy_int8;
-typedef int npy_int;
-
-typedef long npy_intp;
-#ifndef NPY_INTP_FMT
-#define NPY_INTP_FMT "ld"
-#endif
-#endif
-#ifndef import_array
-#define import_array()
-#endif
 
 #define NPY_MAXDIMS 32
 
diff --git a/pypy/module/cpyext/include/numpy/ndarraytypes.h b/pypy/module/cpyext/include/numpy/ndarraytypes.h
--- a/pypy/module/cpyext/include/numpy/ndarraytypes.h
+++ b/pypy/module/cpyext/include/numpy/ndarraytypes.h
@@ -1,38 +1,12 @@
 #ifndef NDARRAYTYPES_H
 #define NDARRAYTYPES_H
 
-//#include "npy_common.h"
+#include "numpy/npy_common.h"
 //#include "npy_endian.h"
 //#include "npy_cpu.h"
 //#include "utils.h"
 
 //for pypy - numpy has lots of typedefs
-#ifndef _NPY_COMMON_H_
-#define _NPY_COMMON_H_
-typedef Py_intptr_t npy_intp;
-typedef Py_uintptr_t npy_uintp;
-typedef unsigned char npy_bool;
-typedef long npy_int32;
-typedef unsigned long npy_uint32;
-typedef unsigned long npy_ucs4;
-typedef long npy_int64;
-typedef unsigned long npy_uint64;
-#if defined(_MSC_VER)
-        #define NPY_INLINE __inline
-#elif defined(__GNUC__)
-	#if defined(__STRICT_ANSI__)
-		#define NPY_INLINE __inline__
-	#else
-		#define NPY_INLINE inline
-	#endif
-#else
-        #define NPY_INLINE
-#endif
-#ifndef NPY_INTP_FMT
-#define NPY_INTP_FMT "ld"
-#endif
-#endif //_NPY_COMMON_H_
-
 //for pypy - make life easier, less backward support
 #define NPY_1_8_API_VERSION 0x00000008
 #define NPY_NO_DEPRECATED_API NPY_1_8_API_VERSION
diff --git a/pypy/module/cpyext/include/numpy/npy_common.h b/pypy/module/cpyext/include/numpy/npy_common.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/include/numpy/npy_common.h
@@ -0,0 +1,29 @@
+#ifndef _NPY_COMMON_H_
+#define _NPY_COMMON_H_
+
+typedef Py_intptr_t npy_intp;
+typedef Py_uintptr_t npy_uintp;
+typedef unsigned char npy_bool;
+typedef long npy_int32;
+typedef unsigned long npy_uint32;
+typedef unsigned long npy_ucs4;
+typedef long npy_int64;
+typedef unsigned long npy_uint64;
+typedef unsigned char npy_uint8;
+#if defined(_MSC_VER)
+        #define NPY_INLINE __inline
+#elif defined(__GNUC__)
+	#if defined(__STRICT_ANSI__)
+		#define NPY_INLINE __inline__
+	#else
+		#define NPY_INLINE inline
+	#endif
+#else
+        #define NPY_INLINE
+#endif
+#ifndef NPY_INTP_FMT
+#define NPY_INTP_FMT "ld"
+#endif
+#define NPY_API_VERSION 0x8
+#endif //_NPY_COMMON_H_
+


More information about the pypy-commit mailing list