diff --git a/pyglet-1.2.4-add-wmclass.patch b/pyglet-1.2.4-add-wmclass.patch new file mode 100644 index 0000000..73a2c53 --- /dev/null +++ b/pyglet-1.2.4-add-wmclass.patch @@ -0,0 +1,34 @@ +Index: pyglet/window/xlib/__init__.py +=================================================================== +--- pyglet/window/xlib/__init__.py.orig ++++ pyglet/window/xlib/__init__.py +@@ -352,6 +352,9 @@ class XlibWindow(BaseWindow): + # Set caption + self.set_caption(self._caption) + ++ # Set WM_CLASS for modern desktop environments ++ self.set_wm_class(self._caption) ++ + # this is supported by some compositors (ie gnome-shell), and more to come + # see: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idp6357888 + _NET_WM_BYPASS_COMPOSITOR_HINT_ON = c_ulong(int(self._fullscreen)) +@@ -513,6 +516,19 @@ class XlibWindow(BaseWindow): + self._set_text_property('_NET_WM_NAME', caption) + self._set_text_property('_NET_WM_ICON_NAME', caption) + ++ def set_wm_class(self, name): ++ # WM_CLASS can only contain Ascii characters ++ try: ++ name = name.encode('ascii') ++ except UnicodeEncodeError: ++ name = "pyglet" ++ ++ hints = xlib.XAllocClassHint() ++ hints.contents.res_class = asbytes(name) ++ hints.contents.res_name = asbytes(name.lower()) ++ xlib.XSetClassHint(self._x_display, self._window, hints.contents) ++ xlib.XFree(hints) ++ + def get_caption(self): + return self._caption + diff --git a/pyglet-1.2.4-fix-image-import.patch b/pyglet-1.2.4-fix-image-import.patch new file mode 100644 index 0000000..0dc72b1 --- /dev/null +++ b/pyglet-1.2.4-fix-image-import.patch @@ -0,0 +1,13 @@ +Index: pyglet/image/codecs/pil.py +=================================================================== +--- pyglet/image/codecs/pil.py.orig ++++ pyglet/image/codecs/pil.py +@@ -48,7 +48,7 @@ from pyglet.image.codecs import * + + try: + import Image +-except ImportError: ++except (ImportError, ValueError): + from PIL import Image + + class PILImageDecoder(ImageDecoder): diff --git a/python-pyglet.changes b/python-pyglet.changes index 477dca3..21d56b1 100644 --- a/python-pyglet.changes +++ b/python-pyglet.changes @@ -1,3 +1,33 @@ +------------------------------------------------------------------- +Sun Aug 13 15:07:20 UTC 2017 - toddrme2178@gmail.com + +- Remove obsolete python-imaging dependency + +------------------------------------------------------------------- +Tue Aug 8 21:33:53 UTC 2017 - jengelh@inai.de + +- Other OS need not be mentioned in description for an openSUSE + package. + +------------------------------------------------------------------- +Mon Aug 7 16:33:50 UTC 2017 - toddrme2178@gmail.com + +- Further fix shebangs +- Remove pyglet-1.2.4-fix-examples.patch + We will fix shebangs dynamically + +------------------------------------------------------------------- +Sun Aug 6 02:32:29 UTC 2017 - toddrme2178@gmail.com + +- Implement single-spec version + +------------------------------------------------------------------- +Mon Jul 31 21:13:01 UTC 2017 - kkirill@opensuse.org + +- Add pyglet-1.2.4-fix-image-import.patch to fix "import Image" +- Add pyglet-1.2.4-add-wmclass.patch to add WMClass +- Add pyglet-1.2.4-fix-examples.patch to fix python shebang + ------------------------------------------------------------------- Thu Sep 3 08:47:16 UTC 2015 - nemysis@openSUSE.org diff --git a/python-pyglet.spec b/python-pyglet.spec index 2ba1aeb..7c30cc1 100644 --- a/python-pyglet.spec +++ b/python-pyglet.spec @@ -1,7 +1,7 @@ # # spec file for package python-pyglet # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 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 @@ -16,29 +16,31 @@ # -%define oname pyglet - +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pyglet Version: 1.2.4 Release: 0 -Summary: Cross-platform windowing and multimedia library +Summary: Windowing and multimedia library License: BSD-3-Clause Group: Development/Languages/Python Url: https://bitbucket.org/pyglet/pyglet -Source0: http://pypi.python.org/packages/source/p/%{oname}/%{oname}-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/p/pyglet/pyglet-%{version}.tar.gz Source1: %{name}-rpmlintrc -%if 0%{?suse_version} -BuildRequires: fdupes -%endif +# PATCH-FIX-OPENSUSE pyglet-1.2.4-fix-image-import.patch -- fix "import Image" +Patch0: pyglet-1.2.4-fix-image-import.patch +# PATCH-FEATURE-UPSTREAM pyglet-1.2.4-add-wmclass.patch -- https://bitbucket.org/pyglet/pyglet/issues/92 +Patch1: pyglet-1.2.4-add-wmclass.patch +BuildRequires: %{python_module Pillow} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} BuildRequires: alsa-devel BuildRequires: dos2unix +BuildRequires: fdupes BuildRequires: fontconfig-devel BuildRequires: freetype2-devel BuildRequires: gtk2-devel BuildRequires: openal-soft-devel -BuildRequires: python-devel -BuildRequires: python-imaging -BuildRequires: python-setuptools +BuildRequires: python-rpm-macros BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(glu) BuildRequires: pkgconfig(x11) @@ -47,42 +49,43 @@ Requires: fontconfig-devel Requires: freetype2-devel Requires: gtk2-devel Requires: openal-soft-devel -Requires: python-imaging Requires: pkgconfig(gl) Requires: pkgconfig(glu) Requires: pkgconfig(x11) -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else +Requires: python-Pillow BuildArch: noarch -%endif +%python_subpackages %description -pyglet provides an object-oriented programming -interface for developing games and other visually-rich applications -for Windows, Mac OS X and Linux. +pyglet provides an object-oriented programming interface for +developing games and other visually-rich applications. %prep -%setup -q -n %{oname}-%{version} +%setup -q -n pyglet-%{version} +%patch0 +%patch1 # Convert to unix line end find -name "*.py" -exec dos2unix "{}" "+" %build -python setup.py build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install -%if 0%{?suse_version} - %fdupes -s %{buildroot}%{_prefix} -%endif +%{python_expand cp -Lr examples examples_%{$python_bin_suffix} +find examples_%{$python_bin_suffix} -name "*.py" -exec sed -i "s|^#!/usr/bin/python$|#!%{__$python}|" {} \; +find examples_%{$python_bin_suffix} -name "*.py" -exec sed -i "s|^#!/usr/bin/env python$|#!%{__$python}|" {} \; +%fdupes examples_%{$python_bin_suffix} +%fdupes %{buildroot}%{$python_sitelib} +} -%files +%files %{python_files} %defattr(-,root,root,-) -%doc CHANGELOG README LICENSE NOTICE RELEASE_NOTES examples -%{python_sitelib}/%{oname} -%{python_sitelib}/%{oname}-%{version}-py%{py_ver}.egg-info +%doc CHANGELOG README LICENSE NOTICE RELEASE_NOTES +%doc examples_%{python_bin_suffix} +%{python_sitelib}/pyglet +%{python_sitelib}/pyglet-%{version}-py*.egg-info %changelog