Blob Blame History Raw
%global with_python3 1

%global srcname pyglet
%global srcversion 1.2.1
%global versionedname %{srcname}-%{srcversion}

Name: python-%{srcname}
Version: %{srcversion}
Release: 4%{?dist}
Summary: A cross-platform windowing and multimedia library for Python

License: BSD
URL: http://www.pyglet.org/

# The upstream tarball includes some non-free files in the examples and tests,
# and a patented texture compression algorithm.
# Run the following (in rpmbuild/SOURCES) to generate the distributed tarball:
# $ bash pyglet-get-tarball.sh pyglet-1.2.1
# See the script for details.
Source0: %{versionedname}-repacked.tar.gz
Source1: pyglet-get-tarball.sh

BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif

Requires: python
%if 0%{?fedora} <= 18
Requires: python-imaging%{?_isa}
%else
Requires: python-pillow%{?_isa}
%endif

# The libraries are imported dynamically using ctypes, so rpm can't find them.
Requires: libGL
Requires: libX11


%description
This library provides an object-oriented programming interface for developing
games and other visually-rich applications with Python.
pyglet has virtually no external dependencies. For most applications and game
requirements, pyglet needs nothing else besides Python, simplifying
distribution and installation. It also handles multiple windows and
fully aware of multi-monitor setups.

pyglet might be seen as an alternative to PyGame.

%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: A cross-platform windowing and multimedia library for Python 3

Requires: python3
Requires: python3-pillow%{?_isa}

# The libraries are imported dynamically using ctypes, so rpm can't find them.
Requires: libGL
Requires: libX11

%description -n python3-%{srcname}
This library provides an object-oriented programming interface for developing
games and other visually-rich applications with Python 3.
pyglet has virtually no external dependencies. For most applications and game
requirements, pyglet needs nothing else besides Python, simplifying
distribution and installation. It also handles multiple windows and
fully aware of multi-monitor setups.

pyglet might be seen as an alternative to PyGame.

%endif


%prep
%setup -q -n %{versionedname}

# Remove the bundled pypng library (python-pillow provides the same functionality)
rm pyglet/image/codecs/png.py
rm pyglet/extlibs/png.py

# Get rid of hashbang lines. This is a library, it has no executable scripts.
# Also remove Windows newlines
find . -name '*.py' | xargs sed --in-place -e's|#!/usr/bin/\(env \)\?python||;s/\r//'

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif


%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%{__python} setup.py install --skip-build --root %{buildroot}
%py_byte_compile %{__python} %{buildroot}%{python_sitelib}/%{srcname}

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/%{srcname}
popd
%endif

%files
%license LICENSE
%doc CHANGELOG
%doc README
%doc NOTICE
%doc PKG-INFO
%{python_sitelib}/%{versionedname}-py2.7.egg-info
%{python_sitelib}/%{srcname}

%if 0%{?with_python3}
%files -n python3-%{srcname}
%license LICENSE
%doc CHANGELOG
%doc README
%doc NOTICE
%doc PKG-INFO
%{python3_sitelib}/%{versionedname}-py%{python3_version}.egg-info
%{python3_sitelib}/%{srcname}
%endif


%changelog
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

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

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Jan 28 2015 Petr Viktorin <pviktori@redhat.com> - 1.2.1-0
- Update to upstream 1.2.1 release

* Wed Jan 28 2015 Petr Viktorin <pviktori@redhat.com> - 1.2-0.13
- Actually use the 1.2.0 release

* Wed Jan 28 2015 Petr Viktorin <pviktori@redhat.com> - 1.2-0.12
- Use the official 1.2 release

* Wed Jan 28 2015 Petr Viktorin <pviktori@redhat.com> - 1.2-0.11.alpha1
- Install LICENSE as a license file

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-0.10.alpha1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2-0.9.alpha1
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Fri Jan 17 2014 Petr Viktorin <encukou@gmail.com> - 1.2-0.8.alpha1
- Remove Python 3 from BuildRequires if building without python3 support
  (needed for EPEL)

* Mon Oct 07 2013 Petr Viktorin <encukou@gmail.com> - 1.2-0.7.alpha1
- Enable Python 3 build

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-0.6.alpha1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Jun 05 2013 Petr Viktorin <encukou@gmail.com> - 1.2-0.5.alpha1
- Add python3-devel to BuildRequires

* Wed Jun 05 2013 Petr Viktorin <encukou@gmail.com> - 1.2-0.4.alpha1
- Replace dos2unix by an additional sed command
- Remove bundled pypng, replace by a dependency in python-pillow
- Add a Python 3 build

* Fri Oct 19 2012 Petr Viktorin <encukou@gmail.com> - 1.2-0.1.alpha1
- initial version of package