%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%define pyver %(python -c 'import sys;print(sys.version[0:3])')

Name:           PyOpenGL
Version:        3.1.0
Release:        1%{_dist_release}
Summary:        Python bindings for OpenGL
Summary(ja):    OpenGL の Python バインディング
License:        BSD
Group:          System Environment/Libraries
URL:            http://pyopengl.sourceforge.net/
Source0:        http://downloads.sourceforge.net/pyopengl/%{name}-%{version}.tar.gz
Patch0:         PyOpenGL-3.0.0a6-shebang.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildArch:      noarch
BuildRequires:  python-devel
BuildRequires:  python-setuptools
Requires:       python-numeric
Requires:       python-setuptools
Requires:       freeglut

# in some other repositories this is named python-opengl
Provides:       python-opengl = %{version}-%{release}
Obsoletes:      python-opengl < %{version}-%{release}

Vendor: Project Vine
Distribution: Vine Linux


%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 interoperable with a large number of external GUI libraries
for Python including (Tkinter, wxPython, FxPy, PyGame, and Qt). 


%package Tk
Summary:        %{name} OpenGL Tk widget
Group:          System Environment/Libraries
Requires:       %{name} = %{version}-%{release}, tkinter
Requires:       tkinter

%description Tk
%{name} Togl (Tk OpenGL widget) 1.6 support.


%package doc
Summary:        Documentation files for %{name}
Summary(ja):    %{name} のドキュメント
Group:          Documentation
Requires:       %{name} = %{version}-%{release}

%description doc
Documentation files for %{name}.


%prep
%setup -q
#patch0 -p1 -z .shebang

%build
python setup.py build


%install
rm -rf $RPM_BUILD_ROOT
python setup.py install -O1 --skip-build \
       --root="$RPM_BUILD_ROOT" --prefix="%{_prefix}"

#chmod -x $RPM_BUILD_ROOT%{python_sitelib}/%{name}-%{version}-py%{pyver}.egg-info

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc license.txt
%{python_sitelib}/*OpenGL*
%exclude %{python_sitelib}/OpenGL/Tk

%files Tk
%defattr(-,root,root,-)
%{python_sitelib}/OpenGL/Tk

%files doc
%defattr(-,root,root,-)
#doc documentation/*


%changelog
* Wed Nov 19 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.1.0-1
- updated to 3.1.0

* Sat Feb 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.0-4
- rebuild with python-2.7.2

* Sat Apr 16 2011 Shu KONNO <owa@bg.wakwak.com> 3.0.0-3
- rebuilt with rpm-4.8.1-3

* Wed Feb 03 2010 Shu KONNO <owa@bg.wakwak.com> 3.0.0-2
- rebuilt with python-2.6.4

* Sat Jul 11 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 3.0.0-1
- new upstream release 3.0.0
- remove Requires: XOrg-gl (libGL should be pulled by freeglut)

* Sun Jul 20 2008 Shu KONNO <owa@bg.wakwak.com> 3.0.0-0.b1.2
- rebuilt with python-2.5.2

* Mon Apr 21 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.0.0-0.b1.1
- Initial build for Vine Linux

* 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