diff --git a/numpy-1.6.2-unicode-python3.3.patch b/numpy-1.6.2-unicode-python3.3.patch new file mode 100644 index 0000000..c7038a5 --- /dev/null +++ b/numpy-1.6.2-unicode-python3.3.patch @@ -0,0 +1,54 @@ +--- numpy/core/src/multiarray/scalarapi.c.orig 2012-05-19 15:51:54.000000000 +0200 ++++ numpy/core/src/multiarray/scalarapi.c 2012-08-05 14:57:02.068276634 +0200 +@@ -652,6 +652,35 @@ + itemsize = (((itemsize - 1) >> 2) + 1) << 2; + } + } ++#if PY_VERSION_HEX >= 0x03030000 ++ if (type_num == NPY_UNICODE) { ++ PyObject *u, *args; ++ int byteorder; ++ ++#if NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN ++ byteorder = -1; ++#elif NPY_BYTE_ORDER == NPY_BIG_ENDIAN ++ byteorder = +1; ++#else ++ #error Endianness undefined ? ++#endif ++ if (swap) byteorder *= -1; ++ ++ u = PyUnicode_DecodeUTF32(data, itemsize, NULL, &byteorder); ++ 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); +@@ -688,6 +717,7 @@ + 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; +@@ -759,6 +789,7 @@ + #endif + return obj; + } ++#endif /* PY_VERSION_HEX < 0x03030000 */ + else { + PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj; + vobj->base = NULL; diff --git a/numpy.spec b/numpy.spec index 3a9ef44..081d539 100644 --- a/numpy.spec +++ b/numpy.spec @@ -17,6 +17,13 @@ Group: Development/Languages License: BSD URL: http://numeric.scipy.org/ Source0: http://downloads.sourceforge.net/numpy/%{name}-%{version}%{?relc}.tar.gz +# backport unicode fixes from upstream git repo +# based on: +# commit 4676f33f9c77b04e9c599e642de7ab465f48ea8f +# Merge: fd15162 f2ac38f +# Author: Travis E. Oliphant +# Date: Fri Aug 3 22:46:21 2012 -0700 +Patch0: numpy-1.6.2-unicode-python3.3.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: python2-devel lapack-devel python-setuptools gcc-gfortran atlas-devel python-nose @@ -24,7 +31,7 @@ Requires: python-nose %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools -#BuildRequires: python3-nose +BuildRequires: python3-nose %endif %description @@ -82,6 +89,7 @@ This package includes a version of f2py that works properly with NumPy. %prep %setup -q -n %{name}-%{version}%{?relc} +%patch0 -p0 %if 0%{?with_python3} rm -rf %{py3dir} @@ -173,9 +181,9 @@ popd &> /dev/null %if 0%{?with_python3} pushd doc &> /dev/null # there is no python3-nose yet -#PYTHONPATH="%{buildroot}%{python3_sitearch}" %{__python3} -c "import pkg_resources, numpy ; numpy.test()" \ +PYTHONPATH="%{buildroot}%{python3_sitearch}" %{__python3} -c "import pkg_resources, numpy ; numpy.test()" \ %ifarch s390 s390x -#|| : +|| : %endif # don't remove this comment popd &> /dev/null @@ -249,6 +257,8 @@ rm -rf %{buildroot} %changelog * Sun Aug 5 2012 Thomas Spura - 1:1.6.2-4 - rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 +- needs unicode patch +- also run tests on python3 * Fri Aug 3 2012 David Malcolm - 1:1.6.2-3 - remove rhel logic from with_python3 conditional