Blob Blame Raw
%global srcname PyOpenGL
%global shortname pyopengl

Name:           python-%{shortname}
Version:        3.1.1a1
Release:        18%{?dist}
Summary:        Python bindings for OpenGL
License:        BSD
URL:            https://github.com/mcfletch/pyopengl
Source0:        https://pypi.python.org/packages/source/P/%{srcname}/%{srcname}-%{version}.tar.gz
Source1:        https://pypi.python.org/packages/source/P/%{srcname}-accelerate/%{srcname}-accelerate-%{version}.tar.gz
# These two files are missing from the accelerate module tarball
# https://github.com/mcfletch/pyopengl/issues/12
Source2:        wrapper.pxd
Source3:        formathandler.pxd

%description
PyOpenGL is the cross platform Python binding to OpenGL and related APIs. It
includes support for OpenGL v1.1, GLU, GLUT v3.7, GLE 3 and WGL 4. It also
includes support for dozens of extensions (where supported in the underlying
implementation).

PyOpenGL is inter-operable with a large number of external GUI libraries
for Python including (Tkinter, wxPython, FxPy, PyGame, and Qt). 


%package -n     python2-%{shortname}
Summary:        Python 2 bindings for OpenGL
BuildRequires:  gcc
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-numpy
Requires:       freeglut
Requires:       python2-numpy
%{?python_provide:%python_provide python2-%{shortname}}

%description -n python2-%{shortname}
PyOpenGL is the cross platform Python binding to OpenGL and related APIs. It
includes support for OpenGL v1.1, GLU, GLUT v3.7, GLE 3 and WGL 4. It also
includes support for dozens of extensions (where supported in the underlying
implementation).

PyOpenGL is inter-operable with a large number of external GUI libraries
for Python including (Tkinter, wxPython, FxPy, PyGame, and Qt). 


%package -n     python3-%{shortname}
Summary:        Python 3 bindings for OpenGL
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-numpy
BuildRequires:  python3-Cython
Requires:       freeglut
Requires:       python3-numpy
%{?python_provide:%python_provide python3-%{shortname}}

%description -n python3-%{shortname}
PyOpenGL is the cross platform Python binding to OpenGL and related APIs. It
includes support for OpenGL v1.1, GLU, GLUT v3.7, GLE 3 and WGL 4. It also
includes support for dozens of extensions (where supported in the underlying
implementation).

PyOpenGL is inter-operable with a large number of external GUI libraries
for Python including (Tkinter, wxPython, FxPy, PyGame, and Qt). 


%package -n     python3-%{shortname}-tk
Summary:        %{srcname} Python 3.x Tk widget
BuildArch:      noarch
Requires:       python3-%{shortname} = %{version}-%{release}
Requires:       python3-tkinter
%{?python_provide:%python_provide python3-%{shortname}-tk}

%description -n python3-%{shortname}-tk
%{srcname} Togl (Tk OpenGL widget) 1.6 support for Python 3.x.


%prep
%setup -q -c -n %{srcname}-%{version} -T -a0 -a1

# Add missing .pxd files
# https://github.com/mcfletch/pyopengl/issues/12
mkdir %{srcname}-accelerate-%{version}/OpenGL_accelerate
cp %{SOURCE2} %{SOURCE3} %{srcname}-accelerate-%{version}/OpenGL_accelerate

cat > %{srcname}-accelerate-%{version}/OpenGL_accelerate/__init__.py <<EOF
__version__ = %{version}
EOF

# In Python 3.7 async is a keyword, and so we can't have a module named async
# https://github.com/mcfletch/pyopengl/issues/14
mv %{srcname}-%{version}/OpenGL/GL/SGIX/async.py \
   %{srcname}-%{version}/OpenGL/GL/SGIX/async_.py

mv %{srcname}-%{version}/OpenGL/raw/GL/SGIX/async.py \
   %{srcname}-%{version}/OpenGL/raw/GL/SGIX/async_.py

sed -i -e 's/from OpenGL.raw.GL.SGIX.async/from OpenGL.raw.GL.SGIX.async_/g' \
    %{srcname}-%{version}/OpenGL/GL/SGIX/async_.py

%build
# Delete all Cython generated .c files to force a rebuild in py3_build
# (py2_build then reuses the Cython output)
pushd %{srcname}-accelerate-%{version}/src
for f in *.pyx ; do
    rm -f "${f%.pyx}.c"
done
popd

for dir in %{srcname}-%{version} %{srcname}-accelerate-%{version} ; do
    pushd $dir
    %py3_build
    %py2_build
    popd
done


%install
for dir in %{srcname}-%{version} %{srcname}-accelerate-%{version} ; do
    pushd $dir
    %py2_install
    %py3_install
    popd
done

# Fix up perms on compiled object files
find %{buildroot}%{python2_sitearch}/OpenGL_accelerate/ -name *.so -exec chmod 755 '{}' \;
find %{buildroot}%{python3_sitearch}/OpenGL_accelerate/ -name *.so -exec chmod 755 '{}' \;

# Remove shebangs - note that weirdly these files have a space between
# the #! and the /, so this sed recipe is not the usual one
pushd %{buildroot}%{python2_sitelib}/OpenGL/arrays
sed -i -e '/^#! \//, 1d' buffers.py _buffers.py
popd

pushd %{buildroot}%{python3_sitelib}/OpenGL/arrays
sed -i -e '/^#! \//, 1d' buffers.py _buffers.py
popd


%files -n python2-%{shortname}
%license %{srcname}-%{version}/license.txt
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info
%{python2_sitelib}/OpenGL/
%exclude %{python2_sitelib}/OpenGL/Tk
%{python2_sitearch}/OpenGL_accelerate/
%{python2_sitearch}/%{srcname}_accelerate-%{version}-py%{python2_version}.egg-info/


%files -n python3-%{shortname}
%license %{srcname}-%{version}/license.txt
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/OpenGL/
%exclude %{python3_sitelib}/OpenGL/Tk
%{python3_sitearch}/OpenGL_accelerate/
%{python3_sitearch}/%{srcname}_accelerate-%{version}-py%{python3_version}.egg-info/


%files -n python3-%{shortname}-tk
%{python3_sitelib}/OpenGL/Tk


%changelog
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.1.1a1-18
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1a1-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Tue Jul 16 2019 Petr Viktorin <pviktori@redhat.com> - 3.1.1a1-16
- Remove build dependency on python2-Cython

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1a1-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Tue Sep 11 2018 Scott Talbert <swt@techie.net> - 3.1.1a1-14
- Remove unused python2-pyopengl-tk subpackage (#1627406)

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1a1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 26 2018 Jonathan Underwood <Jonathan G. Underwood@gmail.com> - 3.1.1a1-12
- Add BuildRequires for python{2,3}-Cython
- Remove uneeded Provides/Obsoletes
- Force Cython rebuild of c files
- Add missing .pxd files from upstream github repository
- Update URL to point to github
- Rename async.py modules to async_.py to avoid clash with async keyword

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.1.1a1-11
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1a1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1a1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1a1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1a1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.1.1a1-6
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.1a1-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Fri Mar  4 2016 Jonathan Underwood <Jonathan G. Underwood@gmail.com> - 3.1.1a1-4
- Fix upgrade path for python3-PyOpenGL

* Sat Feb 27 2016 Jonathan Underwood <Jonathan G. Underwood@gmail.com> - 3.1.1a1-3
- Fix python_provide macro calls for the -tk packages

* Sat Feb 27 2016 Jonathan Underwood <Jonathan G. Underwood@gmail.com> - 3.1.1a1-2
- Rename package to python-pyopengl
- Rename -Tk subpackages to -tk
- Fix Requires of python2-pyopengl-Tk to require python2-pyopengl

* Sat Feb 27 2016 Jonathan Underwood <Jonathan G. Underwood@gmail.com> - 3.1.1a1-1
- Fix Provides for renamed sub-packages
- Use standard build and install python packaging macros

* Fri Feb 26 2016 Jonathan Underwood <Jonathan G. Underwood@gmail.com> - 3.1.1a1-0
- Rename package to python-PyOpenGL
- Fix package to comply with current python packaging guidelines
- Add Provides for python2-PyOpenGL (BZ 1249421)

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-4
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Apr  1 2015 Jonathan Underwood <Jonathan G. Underwood@gmail.com> - 3.1.0-2
- Add accelerate modules for Python 2 and 3
- Package is no longer noarch
- Tk sub-packages are noarch

* Thu Jul 31 2014 Christopher Meng <rpm@cicku.me> - 3.1.0-1
- Update to 3.1.0
- Correct the python3 package dependency.

* Fri Jun 06 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0b2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 28 2014 Kalev Lember <kalevlember@gmail.com> - 3.1.0b2-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Mon May 05 2014 Christopher Meng <rpm@cicku.me> - 3.1.0b2-1
- Build python3 interface.
- Drop unneeded dependencies.

* Fri Apr 11 2014 François Cami <fcami@fedoraproject.org> - 3.1.0b2-1
- Update to latest upstream.

* Fri Aug 23 2013 François Cami <fcami@fedoraproject.org> - 3.0.2-1
- Update to latest upstream.

* Fri Aug 02 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Dec 06 2011 Nikolay Vladimirov <nikolay@vladimiroff.com> - 3.0.1-3
- Upload new archive with removed binary blobs - RHB #760366

* Sat Apr 16 2011 Nikolay Vladimirov <nikolay@vladimiroff.com> - 3.0.1-2
- Fix date in previous changelog entry
- specfile fixes

* Fri Apr 15 2011 Nikolay Vladimirov <nikolay@vladimiroff.com> - 3.0.1-1
- New upstream release
- Fix BZ # 635496 - PyOpenGL crashes on every program
- Update the shebang patch to work on the latest version
- Upstream restored license.txt to their distribution

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 3.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Thu Jul 30 2009 Jesse Keating <jkeating@redhat.com> - 3.0.0-2
- Rebuild for Fedora 12 mass rebuild

* Tue Jun 9 2009 Nikolay Vladimirov <nikolay@vladimiroff.com> - 3.0.0-1
- Updated to 3.0 stable
- Changed requires from python-numeric to numpy for BZ #504681
- upstream removed full license text in license.txt
- other minor spec fixes

* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.0-0.12.b8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Fri Jan 2 2009 Nikolay Vladimirov <nikolay@vladimiroff.com> - 3.0.0-0.11.b8
- New upstream 3.0.0b8 (b7 was skipped by upstream)
- performance, bug-fix and packaging release. 
- Use macro for "python"
- remove "--single-version-externally-managed" option for setup.py
- *.egg-info is no longer a folder, it's a file now 
- Tests are no longer installed by setup.py
- Obsolete 'doc' subpackage (no longer distributed "documentation" folder)
- license.txt is also no longer provided by upstream. Using one from b6
- Removed Requires for libGL and libGLU ( should be pulled for freeglut)

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 3.0.0-0.10.b6
- Fix locations for Python 2.6

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 3.0.0-0.9.b6
- Rebuild for Python 2.6

* Mon Sep 22 2008 Nikolay Vladimirov <nikolay@vladimiroff.com> 3.0.0-0.8.b6
- New upstream release 3.0.0b6

* Mon Jul 28 2008 Nikolay Vladimirov <nikolay@vladimiroff.com> 3.0.0-0.7.b5
- New upstream release 3.0.0b5

* Fri Jul 18 2008 Nikolay Vladimirov <nikolay@vladimiroff.com> 3.0.0-0.6.b4
- New upstream release 3.0.0b4

* Mon Dec 31 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-0.5.b1
- New upstream release 3.0.0b1

* Thu Aug 30 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-0.4.a6
- Change BuildRequires python-setuptools to python-setuptools-devel for
  the python-setuptools package split

* Fri Apr 13 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-0.3.a6
- Add missing freeglut, libGL and libGLU requires (bz 236159)

* Thu Mar 29 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-0.2.a6
- Remove tests from the package (bz 234121)
- Add -Tk subpackage (bz 234121)
- Remove shebang from files with shebang instead of chmod +x (bz 234121)
- Better description

* Sat Mar 24 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-0.1.a6
- Initial Fedora Extras package