[arch-commits] Commit in python-numpy/trunk (2 files)
Allan McRae
allan at archlinux.org
Tue Oct 16 04:25:03 UTC 2012
Date: Tuesday, October 16, 2012 @ 00:25:02
Author: allan
Revision: 168803
upgpkg: python-numpy 1.6.2-2
python-3.3 rebuild
Added:
python-numpy/trunk/numpy-1.6.2-python-3.3-build-fix.patch
Modified:
python-numpy/trunk/PKGBUILD
----------------------------------------+
PKGBUILD | 9 ++-
numpy-1.6.2-python-3.3-build-fix.patch | 80 +++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2012-10-16 03:14:27 UTC (rev 168802)
+++ PKGBUILD 2012-10-16 04:25:02 UTC (rev 168803)
@@ -6,14 +6,16 @@
pkgbase=python-numpy
pkgname=('python2-numpy' 'python-numpy')
pkgver=1.6.2
-pkgrel=1
+pkgrel=2
pkgdesc="Scientific tools for Python"
arch=('i686' 'x86_64')
license=('custom')
url="http://numpy.scipy.org/"
makedepends=('lapack' 'python' 'python2' 'python-distribute' 'python2-distribute' 'gcc-fortran' 'python-nose')
-source=(http://downloads.sourceforge.net/numpy/numpy-${pkgver}.tar.gz)
-md5sums=('95ed6c9dcc94af1fc1642ea2a33c1bba')
+source=(http://downloads.sourceforge.net/numpy/numpy-${pkgver}.tar.gz
+ numpy-1.6.2-python-3.3-build-fix.patch)
+md5sums=('95ed6c9dcc94af1fc1642ea2a33c1bba'
+ 'e0fdbcfc9f6193b6762383b4693e749e')
build() {
cd "${srcdir}"
@@ -28,6 +30,7 @@
echo "Building Python3"
cd "${srcdir}/numpy-${pkgver}"
+ patch -Np1 -i $srcdir/numpy-1.6.2-python-3.3-build-fix.patch
python setup.py config_fc --fcompiler=gnu95 build
}
Added: numpy-1.6.2-python-3.3-build-fix.patch
===================================================================
--- numpy-1.6.2-python-3.3-build-fix.patch (rev 0)
+++ numpy-1.6.2-python-3.3-build-fix.patch 2012-10-16 04:25:02 UTC (rev 168803)
@@ -0,0 +1,80 @@
+diff --git a/numpy/core/src/multiarray/scalarapi.c b/numpy/core/src/multiarray/scalarapi.c
+index 00c71f9..0afdc17 100644
+--- a/numpy/core/src/multiarray/scalarapi.c
++++ b/numpy/core/src/multiarray/scalarapi.c
+@@ -641,6 +641,40 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
+ itemsize = (((itemsize - 1) >> 2) + 1) << 2;
+ }
+ }
++#if PY_VERSION_HEX >= 0x03030000
++ if (type_num == NPY_UNICODE) {
++ PyObject *u, *args;
++ char *buffer;
++ if (swap) {
++ buffer = malloc(itemsize);
++ if (buffer == NULL) {
++ PyErr_NoMemory();
++ return NULL;
++ }
++ memcpy(buffer, data, itemsize);
++ byte_swap_vector(buffer, itemsize >> 2, 4);
++ } else {
++ buffer = data;
++ }
++ u = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, buffer,
++ itemsize >> 2);
++ if (swap) {
++ free(buffer);
++ }
++ if (u == NULL) {
++ return NULL;
++ }
++ args = Py_BuildValue("(O)", u);
++ if (args == NULL) {
++ Py_DECREF(u);
++ return NULL;
++ }
++ obj = type->tp_new(type, args, NULL);
++ Py_DECREF(u);
++ Py_DECREF(args);
++ return obj;
++ }
++#endif
+ if (type->tp_itemsize != 0) {
+ /* String type */
+ obj = type->tp_alloc(type, itemsize);
+@@ -672,6 +706,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
+ memcpy(destptr, data, itemsize);
+ return obj;
+ }
++#if PY_VERSION_HEX < 0x03030000
+ else if (type_num == PyArray_UNICODE) {
+ /* tp_alloc inherited from Python PyBaseObject_Type */
+ PyUnicodeObject *uni = (PyUnicodeObject*)obj;
+@@ -743,6 +778,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
+ #endif
+ return obj;
+ }
++#endif // PY_VERSION_HEX < 0x03030000
+ else {
+ PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj;
+ vobj->base = NULL;
+diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src
+index e547071..12745d7 100644
+--- a/numpy/core/src/multiarray/scalartypes.c.src
++++ b/numpy/core/src/multiarray/scalartypes.c.src
+@@ -2592,7 +2592,11 @@ finish:
+ *((npy_ at name@ *)dest) = *((npy_ at name@ *)src);
+ #elif @default@ == 1 /* unicode and strings */
+ if (itemsize == 0) { /* unicode */
++#if PY_VERSION_HEX >= 0x03030000
++ itemsize = PyUnicode_GetLength(robj) * PyUnicode_KIND(robj);
++#else
+ itemsize = ((PyUnicodeObject *)robj)->length * sizeof(Py_UNICODE);
++#endif
+ }
+ memcpy(dest, src, itemsize);
+ /* @default@ == 2 won't get here */
+--
+1.7.12.3
+
More information about the arch-commits
mailing list