Accepting request 141145 from devel:languages:python

- Add numpy-python33.patch to fix compilation with Python 3.3

OBS-URL: https://build.opensuse.org/request/show/141145
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-numpy?expand=0&rev=24
This commit is contained in:
Stephan Kulow 2012-11-14 08:16:14 +00:00 committed by Git OBS Bridge
parent 2fb0d92668
commit 597be76d88
5 changed files with 95 additions and 13 deletions

71
numpy-python33.patch Normal file
View File

@ -0,0 +1,71 @@
Index: numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c
===================================================================
--- numpy-1.6.2.orig/numpy/core/src/multiarray/scalarapi.c
+++ numpy-1.6.2/numpy/core/src/multiarray/scalarapi.c
@@ -652,6 +652,34 @@ PyArray_Scalar(void *data, PyArray_Descr
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 +716,7 @@ PyArray_Scalar(void *data, PyArray_Descr
memcpy(destptr, data, itemsize);
return obj;
}
+#if PY_VERSION_HEX < 0x0303000
else if (type_num == PyArray_UNICODE) {
/* tp_alloc inherited from Python PyBaseObject_Type */
PyUnicodeObject *uni = (PyUnicodeObject*)obj;
@@ -759,6 +788,7 @@ PyArray_Scalar(void *data, PyArray_Descr
#endif
return obj;
}
+#endif // PY_VERSION_HEX < 0x03030000
else {
PyVoidScalarObject *vobj = (PyVoidScalarObject *)obj;
vobj->base = NULL;
Index: numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src
===================================================================
--- numpy-1.6.2.orig/numpy/core/src/multiarray/scalartypes.c.src
+++ numpy-1.6.2/numpy/core/src/multiarray/scalartypes.c.src
@@ -2323,7 +2323,11 @@ finish:
*((npy_@name@ *)dest) = *((npy_@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 */

View File

@ -15,12 +15,13 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define modname numpy
Name: python-%{modname}-doc
%define docname numpydoc
Version: 1.6.2
%define docvers 0.4
Release: 0
%define docvers 0.4
Url: http://sourceforge.net/projects/numpy
Summary: Documentation for python-numpy
License: BSD-3-Clause
@ -28,19 +29,19 @@ Group: Development/Libraries/Python
Source: %{modname}-%{version}.tar.gz
Patch1: numpy-buildfix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
BuildRequires: python-Sphinx
BuildRequires: python-matplotlib
BuildRequires: python-numpy-devel
BuildRequires: blas-devel
BuildRequires: lapack-devel
BuildRequires: python-Sphinx
BuildRequires: python-devel
BuildRequires: python-matplotlib
BuildRequires: python-numpy-devel
BuildRequires: texlive-latex
BuildRequires: zip
Provides: python-numpydoc = %{version}
Obsoletes: python-numpydoc < %{version}
%if 0%{?suse_version}
BuildRequires: gcc-fortran
BuildRequires: fdupes
BuildRequires: gcc-fortran
%if 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%else

View File

@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define modname numpy
Name: python-%{modname}
Version: 1.6.2
@ -26,14 +27,14 @@ Group: Development/Libraries/Python
Source: %{modname}-%{version}.tar.gz
Patch1: numpy-buildfix.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-devel
BuildRequires: blas-devel
BuildRequires: lapack-devel
BuildRequires: python-devel
Requires: python >= %{py_ver}
Provides: numpy = %{version}
%if 0%{?suse_version}
BuildRequires: gcc-fortran
BuildRequires: fdupes
BuildRequires: gcc-fortran
# FIXME: atlas is horribly broken
# %if 0%{?suse_version} <= 1210
# BuildRequires: libatlas3-devel
@ -67,9 +68,9 @@ basic linear algebra and random number generation.
Summary: Development files for %{modname} applications
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: python-devel
Requires: blas-devel
Requires: lapack-devel
Requires: python-devel
%if 0%{?suse_version}
Requires: gcc-fortran
%py_requires -d

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Nov 13 12:23:18 UTC 2012 - idonmez@suse.com
- Add numpy-python33.patch to fix compilation with Python 3.3
-------------------------------------------------------------------
Fri Aug 17 08:20:36 UTC 2012 - toddrme2178@gmail.com

View File

@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define modname numpy
Name: python3-%{modname}
Version: 1.6.2
@ -25,12 +26,13 @@ License: BSD-3-Clause
Group: Development/Libraries/Python
Source: %{modname}-%{version}.tar.gz
Patch1: numpy-buildfix.patch
Patch2: numpy-python33.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: blas-devel
BuildRequires: lapack-devel
BuildRequires: python3
BuildRequires: python3-2to3
BuildRequires: python3-devel
BuildRequires: blas-devel
BuildRequires: lapack-devel
# FIXME: atlas is horribly broken
# %if 0%{?suse_version} <= 1210
# BuildRequires: libatlas3-devel
@ -40,8 +42,8 @@ BuildRequires: lapack-devel
%{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)}
%endif
%if 0%{?suse_version}
BuildRequires: gcc-fortran
BuildRequires: fdupes
BuildRequires: gcc-fortran
%else
BuildRequires: gcc-gfortran
%endif
@ -84,7 +86,9 @@ This package contains files for developing applications using %{modname}.
%prep
%setup -q -n %{modname}-%{version}
%patch1 -p0
%patch1
%patch2 -p1
sed -i "1d" %{modname}/{compat/setup{,scons},distutils/{conv_template,cpuinfo,exec_command,from_template,setup,setupscons,system_info},f2py/{auxfuncs,capi_maps,cb_rules,cfuncs,common_rules,crackfortran,diagnose,docs/usersguide/setup_example,f2py2e,f90mod_rules,func2subr,__init__,rules,setup,setupscons,use_rules},ma/setup{,scons},matrixlib/setup{,scons},setup,setupscons,testing/print_coercion_tables,testing/setup{,scons}}.py # Fix non-executable scripts
%build