diff --git a/.gitignore b/.gitignore index e69de29..07a088e 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/pyglet-1.2alpha1-repacked.tar.gz diff --git a/pyglet-get-tarball.sh b/pyglet-get-tarball.sh new file mode 100644 index 0000000..00a129f --- /dev/null +++ b/pyglet-get-tarball.sh @@ -0,0 +1,27 @@ +#! /bin/bash + +VERSIONEDNAME=$1 + +wget -N http://pyglet.googlecode.com/files/${VERSIONEDNAME}.tar.gz +tar xzvf ${VERSIONEDNAME}.tar.gz +pushd ${VERSIONEDNAME} +rm -rvf examples # includes non-free artwork +rm -rvf tests # includes non-free font +rm -rvf tools # random developer tools (*) +rm -rvf contrib # again, questionable licensing +rm -v pyglet/image/codecs/s3tc.py # patent-encumbered algorithm (**) +rm -v pyglet/image/codecs/dds.py # image codec that uses s3tc (**) +popd +tar czvf ${VERSIONEDNAME}-repacked.tar.gz ${VERSIONEDNAME} + + + +# (*) pyglet developers put random utilities in `tools`, without much +# regard to licenses. The development tree at 2012-10-19 included some GPL, +# for example. Given the project's culture, non-free code could be included +# in the future, so it's better to remove the directory to be on the safe side. + +# (**) pyglet uses the patented S3 texture compression algorithm to +# encode/decode DirectX texture files (*.dds). +# Removing the two files disables the feature cleanly (see the guarded +# dss import in pyglet/image/codecs/__init__.py). diff --git a/python-pyglet.spec b/python-pyglet.spec new file mode 100644 index 0000000..ace7fc4 --- /dev/null +++ b/python-pyglet.spec @@ -0,0 +1,141 @@ +# Python 3 support is not finished upstream +%global with_python3 0 + +%global srcname pyglet +%global srcversion 1.2 +%global versionedname %{srcname}-%{srcversion}alpha1 + +Name: python-%{srcname} +Version: %{srcversion} +Release: 0.4.alpha1%{?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: +# $ sh pyglet-get-tarball.sh pyglet-1.2alpha1 +# See the script for details. +Source0: %{versionedname}-repacked.tar.gz +Source1: pyglet-get-tarball.sh + +BuildArch: noarch +BuildRequires: python2-devel +%if 0%{?with_python3} +BuildRequires: python3-devel +%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/image/codecs/pypng.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 +%doc 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} +%doc LICENSE +%doc CHANGELOG +%doc README +%doc NOTICE +%doc PKG-INFO +%{python3_sitelib}/%{versionedname}-py3.3.egg-info +%{python3_sitelib}/%{srcname} +%endif + + +%changelog +* Wed Jun 05 2013 Petr Viktorin - 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 - 1.2-0.1.alpha1 +- initial version of package diff --git a/sources b/sources index e69de29..dbc02f3 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +f55f71bf7a478ce1ed3cd5f5fcb7f463 pyglet-1.2alpha1-repacked.tar.gz