14
0
forked from pool/python-pyglet

Accepting request 513624 from home:kkirill:branches:devel:languages:python

- fix build for oS:Factory (fix examples)
- make Brain Workshop work with system pyglet and latest python2 (fix "import Image")
- add WMClass to have a proper application name instead of Unknown

OBS-URL: https://build.opensuse.org/request/show/513624
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyglet?expand=0&rev=7
This commit is contained in:
Todd R
2017-08-01 16:10:53 +00:00
committed by Git OBS Bridge
parent 10488d1e77
commit b721373fcd
5 changed files with 364 additions and 1 deletions

View File

@@ -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

View File

@@ -0,0 +1,300 @@
Index: examples/apple_remote.py
===================================================================
--- examples/apple_remote.py.orig
+++ examples/apple_remote.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
'''
'''
Index: examples/events.py
===================================================================
--- examples/events.py.orig
+++ examples/events.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/fixed_resolution.py
===================================================================
--- examples/fixed_resolution.py.orig
+++ examples/fixed_resolution.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/font_comparison.py
===================================================================
--- examples/font_comparison.py.orig
+++ examples/font_comparison.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/graphics.py
===================================================================
--- examples/graphics.py.orig
+++ examples/graphics.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/html_label.py
===================================================================
--- examples/html_label.py.orig
+++ examples/html_label.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/image_convert.py
===================================================================
--- examples/image_convert.py.orig
+++ examples/image_convert.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/image_display.py
===================================================================
--- examples/image_display.py.orig
+++ examples/image_display.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/input.py
===================================================================
--- examples/input.py.orig
+++ examples/input.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
'''
'''
Index: examples/joystick.py
===================================================================
--- examples/joystick.py.orig
+++ examples/joystick.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
'''
'''
Index: examples/media_info.py
===================================================================
--- examples/media_info.py.orig
+++ examples/media_info.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
'''Print details of a media file that pyglet can open (requires AVbin).
Index: examples/media_player.py
===================================================================
--- examples/media_player.py.orig
+++ examples/media_player.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/multiple_windows.py
===================================================================
--- examples/multiple_windows.py.orig
+++ examples/multiple_windows.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/opengl.py
===================================================================
--- examples/opengl.py.orig
+++ examples/opengl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/opengl_3.py
===================================================================
--- examples/opengl_3.py.orig
+++ examples/opengl_3.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# $Id:$
'''In order to use the new features of OpenGL 3, you must explicitly create
Index: examples/show_input.py
===================================================================
--- examples/show_input.py.orig
+++ examples/show_input.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
'''Graphically show all devices available via the pyglet.input interface.
Index: examples/tablet.py
===================================================================
--- examples/tablet.py.orig
+++ examples/tablet.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
# $Id:$
import pyglet
Index: examples/text_input.py
===================================================================
--- examples/text_input.py.orig
+++ examples/text_input.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
'''Demonstrates basic use of IncrementalTextLayout and Caret.
Index: examples/timer.py
===================================================================
--- examples/timer.py.orig
+++ examples/timer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/video.py
===================================================================
--- examples/video.py.orig
+++ examples/video.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/window_platform_event.py
===================================================================
--- examples/window_platform_event.py.orig
+++ examples/window_platform_event.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python2
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/astraea/astraea.py
===================================================================
--- examples/astraea/astraea.py.orig
+++ examples/astraea/astraea.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/astraea/setup.py
===================================================================
--- examples/astraea/setup.py.orig
+++ examples/astraea/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/noisy/noisy.py
===================================================================
--- examples/noisy/noisy.py.orig
+++ examples/noisy/noisy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/programming_guide/animation.py
===================================================================
--- examples/programming_guide/animation.py.orig
+++ examples/programming_guide/animation.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/programming_guide/events.py
===================================================================
--- examples/programming_guide/events.py.orig
+++ examples/programming_guide/events.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/programming_guide/hello_world.py
===================================================================
--- examples/programming_guide/hello_world.py.orig
+++ examples/programming_guide/hello_world.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/programming_guide/image_viewer.py
===================================================================
--- examples/programming_guide/image_viewer.py.orig
+++ examples/programming_guide/image_viewer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/programming_guide/window_subclass.py
===================================================================
--- examples/programming_guide/window_subclass.py.orig
+++ examples/programming_guide/window_subclass.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
Index: examples/soundspace/soundspace.py
===================================================================
--- examples/soundspace/soundspace.py.orig
+++ examples/soundspace/soundspace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner

View File

@@ -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):

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
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 yglet-1.2.4-fix-examples.patch to fix python shebang
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 3 08:47:16 UTC 2015 - nemysis@openSUSE.org Thu Sep 3 08:47:16 UTC 2015 - nemysis@openSUSE.org

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-pyglet # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -27,6 +27,12 @@ Group: Development/Languages/Python
Url: https://bitbucket.org/pyglet/pyglet Url: https://bitbucket.org/pyglet/pyglet
Source0: http://pypi.python.org/packages/source/p/%{oname}/%{oname}-%{version}.tar.gz Source0: http://pypi.python.org/packages/source/p/%{oname}/%{oname}-%{version}.tar.gz
Source1: %{name}-rpmlintrc Source1: %{name}-rpmlintrc
# 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
# PATCH-FIX-UPSTREAM pyglet-1.2.4-fix-examples.patch -- fix intrepreter shebang
Patch2: pyglet-1.2.4-fix-examples.patch
%if 0%{?suse_version} %if 0%{?suse_version}
BuildRequires: fdupes BuildRequires: fdupes
%endif %endif
@@ -65,6 +71,9 @@ for Windows, Mac OS X and Linux.
%prep %prep
%setup -q -n %{oname}-%{version} %setup -q -n %{oname}-%{version}
%patch0
%patch1
%patch2
# Convert to unix line end # Convert to unix line end
find -name "*.py" -exec dos2unix "{}" "+" find -name "*.py" -exec dos2unix "{}" "+"