diff --git a/commit1080.patch b/commit1080.patch new file mode 100644 index 0000000..b0dddd5 --- /dev/null +++ b/commit1080.patch @@ -0,0 +1,25 @@ +=== modified file 'accelerate/src/numpy_formathandler.pyx' +--- accelerate/src/numpy_formathandler.pyx 2018-08-12 01:47:52 +0000 ++++ accelerate/src/numpy_formathandler.pyx 2018-11-05 06:18:00 +0000 +@@ -52,16 +52,18 @@ + np.float16, + np.float32, + np.float64, +- np.float128, + np.complex64, + np.complex128, +- np.complex256, + np.bytes_, + np.str_, + np.void, + np.datetime64, + np.timedelta64, + ) ++ if hasattr(np,'float128'): ++ HANDLED_TYPES += (np.float128,) ++ if hasattr(np,'complex256'): ++ HANDLED_TYPES += (np.complex256,) + + def __init__( self, ERROR_ON_COPY=None, a_to_gl=None, gl_to_a=None ): + if ERROR_ON_COPY is None: + diff --git a/formathandler.pxd b/formathandler.pxd new file mode 100644 index 0000000..442a839 --- /dev/null +++ b/formathandler.pxd @@ -0,0 +1,13 @@ +"""Cython import description for formathandler types""" + +cdef class FormatHandler: + cdef public int ERROR_ON_COPY + cdef object c_from_param( self, object instance, object typeCode) + cdef object c_dataPointer( self, object instance ) + cdef c_zeros( self, object dims, object typeCode ) + cdef c_arraySize( self, object instance, object typeCode ) + cdef c_arrayByteCount( self, object instance ) + cdef c_arrayToGLType( self, object value ) + cdef c_asArray( self, object instance, object typeCode) + cdef c_unitSize( self, object instance, typeCode ) + cdef c_dimensions( self, object instance) diff --git a/python-opengl-accelerate.changes b/python-opengl-accelerate.changes index 8618cce..4119db6 100644 --- a/python-opengl-accelerate.changes +++ b/python-opengl-accelerate.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Aug 19 05:37:59 UTC 2019 - John Vandenberg + +- Add commit1080.patch to make source compatible with opengl 3.1.3b2 + needed for Python 3.7 compatibility +- Add wrapper.pxd and formathandler.pxd needed to rebuild from source + ------------------------------------------------------------------- Thu Oct 25 12:41:21 UTC 2018 - Tomáš Chvátal diff --git a/python-opengl-accelerate.spec b/python-opengl-accelerate.spec index 17dc856..34e8b89 100644 --- a/python-opengl-accelerate.spec +++ b/python-opengl-accelerate.spec @@ -1,7 +1,7 @@ # # spec file for package python-opengl-accelerate # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,22 +18,30 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define tarname PyOpenGL-accelerate +%define _version 3.1.3b1 Name: python-opengl-accelerate -Version: 3.1.3b1 +Version: %{_version}.post1 Release: 0 Summary: Acceleration for python-opengl License: BSD-3-Clause Group: Development/Libraries/Python URL: http://pyopengl.sourceforge.net -Source0: https://files.pythonhosted.org/packages/source/P/%{tarname}/%{tarname}-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/P/%{tarname}/%{tarname}-%{_version}.tar.gz +# Missing pxd only needed to rebuild .c https://github.com/mcfletch/pyopengl/issues/12 +Source2: https://raw.githubusercontent.com/mcfletch/pyopengl/master/accelerate/OpenGL_accelerate/formathandler.pxd +Source3: https://raw.githubusercontent.com/mcfletch/pyopengl/master/accelerate/OpenGL_accelerate/wrapper.pxd +# Newer numpy_formathandler.pyx needed to match opengl 3.1.3b2 +# https://github.com/mcfletch/pyopengl/issues/28 +# Patch is subset of https://bazaar.launchpad.net/~mcfletch/pyopengl/trunk/diff/1099 +Patch0: commit1080.patch BuildRequires: %{python_module Cython} BuildRequires: %{python_module devel} BuildRequires: %{python_module numpy-devel} -BuildRequires: %{python_module opengl == %{version}} +BuildRequires: %{python_module opengl >= %{version}} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-numpy -Requires: python-opengl = %{version} +Requires: python-opengl >= %{version} %python_subpackages %description @@ -43,7 +51,14 @@ arrays extensively speed-up is around 10% compared to unaccelerated code. %prep -%setup -q -n %{tarname}-%{version} +%setup -q -n %{tarname}-%{_version} +%patch0 -p1 +sed -i 's/\t/ /g' src/numpy_formathandler.pyx + +cp %{SOURCE2} %{SOURCE3} OpenGL_accelerate/ + +# Force Cython to rebuild .c files +rm src/*.c %build export CFLAGS="%{optflags} -DGLX_GLXEXT_LEGACY" @@ -57,6 +72,6 @@ export CFLAGS="%{optflags} -DGLX_GLXEXT_LEGACY" %license license.txt %doc README.txt %{python_sitearch}/OpenGL_accelerate/ -%{python_sitearch}/PyOpenGL_accelerate-%{version}-py%{python_version}.egg-info +%{python_sitearch}/PyOpenGL_accelerate-*-py%{python_version}.egg-info %changelog diff --git a/wrapper.pxd b/wrapper.pxd new file mode 100644 index 0000000..47ed1c2 --- /dev/null +++ b/wrapper.pxd @@ -0,0 +1,9 @@ +"""Importable Cython declarations for wrapper module""" +cdef class cArgConverter: + cdef object c_call( self, tuple pyArgs, int index, object baseOperation ) +cdef class pyArgConverter: + cdef object c_call( self, object incoming, object function, tuple arguments ) +cdef class cArgumentConverter: + cdef object c_call( self, object incoming ) +cdef class returnConverter: + cdef object c_call( self, object result, object baseOperation, tuple pyArgs, tuple cArgs )