diff --git a/.gitignore b/.gitignore index 814f533..d1b7169 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ /pyglet-1.4.6-repacked.tar.gz /pyglet-1.5.7-repacked.tar.gz /pyglet-1.5.11-repacked.tar.gz +/pyglet-1.5.16.tar.gz +/pyglet-1.5.16-repacked.tar.gz diff --git a/e44509b5e4.patch b/e44509b5e4.patch deleted file mode 100644 index 879c992..0000000 --- a/e44509b5e4.patch +++ /dev/null @@ -1,104 +0,0 @@ -From e44509b5e42525f30b62137599e574fdd41f68bc Mon Sep 17 00:00:00 2001 -From: Benjamin Moran -Date: Tue, 24 Nov 2020 11:42:02 +0900 -Subject: [PATCH] Simplify UBO code, and revert some experimental code. - ---- - RELEASE_NOTES | 8 ++++++ - pyglet/text/formats/attributed.py | 41 +++++++------------------------ - 2 files changed, 17 insertions(+), 32 deletions(-) - -diff --git a/RELEASE_NOTES b/RELEASE_NOTES -index 5c4fe67a..f084a013 100644 ---- a/RELEASE_NOTES -+++ b/RELEASE_NOTES -@@ -1,3 +1,11 @@ -+pyglet 1.5.12 -+Bugfix and feature release -+ -+Bugfixes -+-------- -+- Remove usage of deprecated `parser` module. (#312) -+ -+ - pyglet 1.5.11 - Bugfix release - -diff --git a/pyglet/text/formats/attributed.py b/pyglet/text/formats/attributed.py -index 350e0844..3eb815c6 100644 ---- a/pyglet/text/formats/attributed.py -+++ b/pyglet/text/formats/attributed.py -@@ -38,11 +38,7 @@ - """ - - import re --import token --import parser --import operator -- --from functools import reduce -+import ast - - import pyglet - -@@ -63,11 +59,13 @@ - - - class AttributedTextDecoder(pyglet.text.DocumentDecoder): -- def decode(self, text, location=None): -- self.doc = pyglet.text.document.FormattedDocument() - -+ def __init__(self): -+ self.doc = pyglet.text.document.FormattedDocument() - self.length = 0 - self.attributes = {} -+ -+ def decode(self, text, location=None): - next_trailing_space = True - trailing_newline = True - -@@ -90,22 +88,15 @@ def decode(self, text, location=None): - self.append(m.group('nl_para')[1:]) # ignore the first \n - trailing_newline = True - elif group == 'attr': -- try: -- ast = parser.expr(m.group('attr_val')) -- if self.safe(ast): -- val = eval(ast.compile()) -- else: -- val = None -- except (parser.ParserError, SyntaxError): -- val = None -+ value = ast.literal_eval(m.group('attr_val')) - name = m.group('attr_name') - if name[0] == '.': - if trailing_newline: -- self.attributes[name[1:]] = val -+ self.attributes[name[1:]] = value - else: -- self.doc.set_paragraph_style(self.length, self.length, {name[1:]: val}) -+ self.doc.set_paragraph_style(self.length, self.length, {name[1:]: value}) - else: -- self.attributes[name] = val -+ self.attributes[name] = value - elif group == 'escape_dec': - self.append(chr(int(m.group('escape_dec_val')))) - elif group == 'escape_hex': -@@ -122,17 +113,3 @@ def append(self, text): - self.doc.insert_text(self.length, text, self.attributes) - self.length += len(text) - self.attributes.clear() -- -- _safe_names = ('True', 'False', 'None') -- -- def safe(self, ast): -- tree = ast.totuple() -- return self.safe_node(tree) -- -- def safe_node(self, node): -- if token.ISNONTERMINAL(node[0]): -- return reduce(operator.and_, map(self.safe_node, node[1:])) -- elif node[0] == token.NAME: -- return node[1] in self._safe_names -- else: -- return True diff --git a/python-pyglet.spec b/python-pyglet.spec index 9e7eb9d..656d2fe 100644 --- a/python-pyglet.spec +++ b/python-pyglet.spec @@ -4,8 +4,8 @@ %bcond_without tests Name: python-%{srcname} -Version: 1.5.11 -Release: 2%{?dist} +Version: 1.5.16 +Release: 1%{?dist} Summary: A cross-platform windowing and multimedia library for Python License: BSD @@ -13,16 +13,22 @@ 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 1.3.2 +# Run the following (in rpmbuild/SOURCES) to generate the distributed tarball +# (the subcommand outputs a version number like 1.5.16): +# $ bash pyglet-get-tarball.sh $(grep Version python-pyglet.spec|cut -c10-) # See the script for details. Source0: %{versionedname}-repacked.tar.gz Source1: pyglet-get-tarball.sh -# Remove usage of the deprecated `parser` module. -# This makes pyglet compatible with Python 3.10a. -# Merged upstream. -Patch0: https://github.com/pyglet/pyglet/commit/e44509b5e4.patch +# Note that unbundling pypng removes "PNGImageDecoder", which is normally +# available for advanced use cases. Instead of: +# img = image.load(fname, decoder=PNGImageDecoder) # don't use! +# It is enough to let Pyglet choose an appropriate decoder with: +# img = image.load(fname) +# Pyglet docs even discourage hard-coding the decoder "unless your application +# has to work around specific deficiences in an operating system decoder": +# https://pyglet.readthedocs.io/en/latest/programming_guide/image.html?highlight=PILImageDecoder#loading-an-image +# If you do find an issue with the default decoder on Fedora, file a bug. BuildArch: noarch @@ -74,6 +80,9 @@ Requires: libGLU Requires: libX11 Requires: fontconfig +# Needed for experimental headless mode; see: https://github.com/pyglet/pyglet/issues/51 +Suggests: libEGL + # Pillow is technically optional, but in Fedora we always pull it in. # It can open PNG images, so we can remove the bundled "png.py" Requires: python3-pillow @@ -81,6 +90,7 @@ Requires: python3-pillow %if %{with tests} BuildRequires: libGL BuildRequires: libGLU +BuildRequires: libEGL BuildRequires: libX11 BuildRequires: fontconfig BuildRequires: python3-pillow @@ -142,6 +152,12 @@ ln -s %{_datadir}/sounds/purple/*.wav tests/data/media/ %changelog +* Wed Apr 14 2021 Petr Viktorin - 1.5.16-1 +- Update to 1.5.16 +- Add a comment on how to handle unbundled "pypng" +- Suggest libEGL for new headless mode (experimental, undocumented) +- Remove patch that's now upstream + * Wed Jan 27 2021 Fedora Release Engineering - 1.5.11-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index 3af51ca..d83243d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pyglet-1.5.11-repacked.tar.gz) = 5b658b11c5ddae223a1aee0db365d65e265f9fde80aa42abbc57272f508bcf26b285b51d66ff0e80da6854128f83d3bcba6457bfbfe5f1082b43ce5ad1288377 +SHA512 (pyglet-1.5.16-repacked.tar.gz) = 70df7e9f5d5e8c26b040b187b605dd56d4a4c588b99261b68d4a84f5a6154c9b940c17a99ee375cef28ca3b537f85c4ad3937a1e8534a66d81292c9eac0870dd