From 826e451a29da794dd1d68f0a992ddc925391766680575b4674aff24d8acca941 Mon Sep 17 00:00:00 2001 From: Todd R Date: Mon, 3 Jun 2019 19:42:58 +0000 Subject: [PATCH] Accepting request 702409 from home:jayvdb:branches:devel:languages:python:numeric - Reactivate test suite, except for platforms ppc and s390 which regularly run out of memory while loading libraries - De-vendor python-future - Add MIT to License: and %license due to vendored pypng, using pypng-license.patch - Remove macos and win32 platform support - Add missing runtime dependency libxcb-glx0 and add several runtime recommended dependencies - Remove incorrect runtime dependencies - Remove unused build dependencies - Fix fdupes and permissions of examples OBS-URL: https://build.opensuse.org/request/show/702409 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyglet?expand=0&rev=22 --- pypng-license.patch | 71 +++++++++++ python-pyglet.changes | 15 +++ python-pyglet.spec | 267 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 325 insertions(+), 28 deletions(-) create mode 100644 pypng-license.patch diff --git a/pypng-license.patch b/pypng-license.patch new file mode 100644 index 0000000..faff619 --- /dev/null +++ b/pypng-license.patch @@ -0,0 +1,71 @@ +Index: pyglet-1.3.2/LICENSE.pypng +=================================================================== +--- /dev/null ++++ pyglet-1.3.2/LICENSE.pypng +@@ -0,0 +1,27 @@ ++Copyright (C) 2006 Johann C. Rocholl ++Portions Copyright (C) 2009 David Jones ++And probably portions Copyright (C) 2006 Nicko van Someren ++ ++Original concept by Johann C. Rocholl. ++ ++LICENCE (MIT) ++ ++Permission is hereby granted, free of charge, to any person ++obtaining a copy of this software and associated documentation files ++(the "Software"), to deal in the Software without restriction, ++including without limitation the rights to use, copy, modify, merge, ++publish, distribute, sublicense, and/or sell copies of the Software, ++and to permit persons to whom the Software is furnished to do so, ++subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be ++included in all copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++SOFTWARE. +Index: pyglet-1.3.2/pyglet/extlibs/png.py +=================================================================== +--- pyglet-1.3.2.orig/pyglet/extlibs/png.py ++++ pyglet-1.3.2/pyglet/extlibs/png.py +@@ -41,34 +41,6 @@ + # * Added Pyglet license + + # png.py - PNG encoder/decoder in pure Python +-# +-# Copyright (C) 2006 Johann C. Rocholl +-# Portions Copyright (C) 2009 David Jones +-# And probably portions Copyright (C) 2006 Nicko van Someren +-# +-# Original concept by Johann C. Rocholl. +-# +-# LICENCE (MIT) +-# +-# Permission is hereby granted, free of charge, to any person +-# obtaining a copy of this software and associated documentation files +-# (the "Software"), to deal in the Software without restriction, +-# including without limitation the rights to use, copy, modify, merge, +-# publish, distribute, sublicense, and/or sell copies of the Software, +-# and to permit persons to whom the Software is furnished to do so, +-# subject to the following conditions: +-# +-# The above copyright notice and this permission notice shall be +-# included in all copies or substantial portions of the Software. +-# +-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-# SOFTWARE. + + """ + Pure Python PNG Reader/Writer diff --git a/python-pyglet.changes b/python-pyglet.changes index 81fdab1..1cd5ba1 100644 --- a/python-pyglet.changes +++ b/python-pyglet.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Wed Mar 20 13:34:05 UTC 2019 - John Vandenberg + +- Reactivate test suite, except for platforms ppc and s390 which + regularly run out of memory while loading libraries +- De-vendor python-future +- Add MIT to License: and %license due to vendored pypng, using + pypng-license.patch +- Remove macos and win32 platform support +- Add missing runtime dependency libxcb-glx0 and add several + runtime recommended dependencies +- Remove incorrect runtime dependencies +- Remove unused build dependencies +- Fix fdupes and permissions of examples + ------------------------------------------------------------------- Tue Dec 4 12:52:16 UTC 2018 - Matej Cepl diff --git a/python-pyglet.spec b/python-pyglet.spec index bc2b5a8..a5108bb 100644 --- a/python-pyglet.spec +++ b/python-pyglet.spec @@ -1,7 +1,7 @@ # # spec file for package python-pyglet # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 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,43 +16,89 @@ # +%define X_display :98 %{?!python_module:%define python_module() python-%{**} python3-%{**}} + +%bcond_with pytest_helpers + +%ifarch %{arm} aarch64 x86_64 %{ix86} ppc64le +%bcond_without gtk2 +%bcond_without test +# test_worker_refill_multiple_players_refill_multiple failed once on armv7l +%else +# s390x fails without out of memory with gtk and freetype, +# even with 8G memory from _constraints +# ppc has lots of similar problems, especially with gdk +%bcond_with test +%bcond_with gtk2 +%endif + +# Set _version to 1.4 for 1.4.0betas and hg default +%define _version 1.3.2 Name: python-pyglet Version: 1.3.2 Release: 0 Summary: Windowing and multimedia library -License: BSD-3-Clause +# 1.3.2 contains a vendored old pypng +License: BSD-3-Clause AND MIT Group: Development/Languages/Python URL: https://bitbucket.org/pyglet/pyglet Source0: https://files.pythonhosted.org/packages/source/p/pyglet/pyglet-%{version}.tar.gz 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 -BuildRequires: %{python_module Pillow} +%if "%{_version}" == "1.3.2" +Patch1: pypng-license.patch +%endif 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: pkgconfig BuildRequires: python-rpm-macros +Requires: Mesa-dri +Requires: config(Mesa) +Requires: python-Pillow +Requires: python-future +Requires: libxcb-glx0 +%if "%{_version}" == "1.4" +Requires: python-pypng +%endif +Recommends: alsa-lib +Recommends: fontconfig +Recommends: freetype +Recommends: libGLU1 +Recommends: libopenal0 +%if %{with gtk2} +Recommends: gtk2 +%endif +BuildArch: noarch +%if %{with test} +BuildRequires: %{python_module Pillow} +BuildRequires: %{python_module future} +BuildRequires: %{python_module mock} +BuildRequires: %{python_module pytest} +BuildRequires: Mesa-dri +BuildRequires: alsa-lib +BuildRequires: fontconfig +BuildRequires: freetype +BuildRequires: gnu-free-fonts +BuildRequires: libopenal0 +BuildRequires: xorg-x11-server +BuildRequires: config(Mesa) BuildRequires: pkgconfig(gl) BuildRequires: pkgconfig(glu) +BuildRequires: pkgconfig(libpulse) BuildRequires: pkgconfig(x11) -Requires: alsa-devel -Requires: fontconfig-devel -Requires: freetype2-devel -Requires: gtk2-devel -Requires: openal-soft-devel -Requires: python-Pillow -Requires: config(Mesa) -Requires: pkgconfig(gl) -Requires: pkgconfig(glu) -Requires: pkgconfig(x11) -BuildArch: noarch +BuildRequires: pkgconfig(xcb-glx) +%if %{with gtk2} +BuildRequires: gtk2 +%endif +%if %{with pytest_helpers} +BuildRequires: %{python_module pytest-error-for-skips} +BuildRequires: %{python_module pytest-instafail} +BuildRequires: %{python_module pytest-timeout} +%endif +# endif test +%endif %python_subpackages %description @@ -62,29 +108,194 @@ developing games and other visually-rich applications. %prep %setup -q -n pyglet-%{version} %patch0 +%if "%{_version}" == "1.3.2" +%patch1 -p1 +%endif + # Can't be used for commercial purposes rm -r examples/noisy/ -# Convert to unix line end -find -name "*.py" -exec dos2unix "{}" "+" +# Not needed, and interferes with test discovery +rm -r pyglet/extlibs/future/ +rm -r tests/extlibs/future/ tests/extlibs/mock.py + +# Windows only, and is a vendored module +rm pyglet/font/win32*.py examples/font_comparison.py + +%if "%{_version}" == "1.4" +# De-vendoring pypng-ing results in failures in v1.3.2, as it is using pypng an earlier pypng: +# AttributeError: 'module' object has no attribute 'Writer' +# pyglet 1.4 is using the latest pypng 0.0.19, the same version as python-pypng package +rm pyglet/extlibs/png.py +sed -i 's/import pyglet.extlibs.png as pypng/import png as pypng/' pyglet/image/codecs/png.py +%endif + +# Files unneccessary for Linux runtimes +rm -r \ +%if "%{_version}" == "1.3.2" + pyglet/*/carbon.py pyglet/input/carbon_*.py pyglet/window/carbon/ pyglet/image/codecs/quicktime.py tests/unit/test_osx.py \ +%endif + pyglet/gl/lib_agl.py pyglet/gl/lib_wgl.py pyglet/gl/wgl*.py \ + pyglet/*/cocoa.py pyglet/*/quartz.py pyglet/*/win32.py \ + pyglet/input/darwin_hid.py pyglet/input/directinput.py pyglet/input/wintab.py \ + pyglet/image/codecs/quartz.py pyglet/image/codecs/gdiplus.py \ + pyglet/window/cocoa/ pyglet/window/win32/ \ + pyglet/libs/darwin/ pyglet/libs/win32/ \ + pyglet/media/drivers/directsound/ tests/integration/media/test_directsound.py \ + tests/integration/platform/test_win_multicore_clock.py + +%if %{without gtk2} +# Disable GdkPixbuf +sed -i 's/^\( *\).*gdkpixbuf2.*/\1pass/' pyglet/image/codecs/__init__.py +%endif + +# Allow invocation using unittest discover -vv --start-directory tests/xyz/ +# https://bitbucket.org/pyglet/pyglet/issues/231/allow-invocation-using-unittest-discover +sed -i 's/from \.\.\./from tests./' \ +%if "%{_version}" == "1.3.2" + tests/interactive/window/test_window_multisample.py \ +%endif +%if "%{_version}" == "1.4" + tests/unit/media/test_listener.py \ +%endif + tests/integration/image/test_gdkpixbuf2.py \ + tests/interactive/image/test_image.py + +# Fails with Arial and FreeSerif, Bitstream Vera Sans and Courier +# https://bitbucket.org/pyglet/pyglet/issues/245/bitstream-vera-sans-bold-and-italic-font +sed -i 's/test_find_font_match_bold/_test_find_font_match_bold/' tests/integration/platform/test_linux_fontconfig.py + +# Tests rely on Arial font, however webcore-fonts is not OSS, and fetchmsttfonts +# only includes the script. Use gnu-free-fonts instead. +# https://bitbucket.org/pyglet/pyglet/issues/230/use-a-free-er-font-in-test-suite +sed -i 's/arial/freeserif/g;s/Arial/FreeSerif/g' \ + tests/unit/test_text.py \ + tests/integration/platform/test_linux_fontconfig.py \ + tests/integration/font/*.py \ + tests/interactive/font/*.py + +## Unit tests + +# Convert to a mark, so it can be deselected, bypassing error-for-skips +sed -i "s/@unittest.skip('Requires changes to events from fork by Leif')/@pytest.mark.leif_fork/" tests/unit/test_events.py +sed -i 's/import unittest/import unittest, pytest/' tests/unit/test_events.py + +%if "%{_version}" == "1.3.2" +# https://bitbucket.org/pyglet/pyglet/issues/224/mediatest_playerplayertestcasetest_delete +sed -i 's/test_delete/_test_delete/' tests/unit/media/test_player.py +%endif + +# https://bitbucket.org/pyglet/pyglet/issues/223/clock-test-failures +# Occasional errors on all platforms, and test_clock.py fails on Python 2 only +rm tests/unit/test_clock_fps.py + +## Integration tests + +# Test fails on all platforms +#sed -i 's/test_unreferenced_cleanup/_test_unreferenced_cleanup/' tests/integration/media/test_player.py + +# test_driver: AssertionError: Cannot load audio driver for your platform +# test_openal: OpenALException: OpenAL Exception [40965: Out of Memory]: Failed to open device. +# Similar for pulse, and hang in player +rm -f tests/integration/media/test_driver.py \ + tests/integration/media/test_player.py \ + tests/integration/media/test_openal.py \ + tests/integration/media/test_pulse.py + +# test_immediate_drawing*, test_immediate_drawing and multitexture fails +# except on Tumbleweed +rm -f tests/integration/graphics/test_retained_drawing*.py \ + tests/integration/graphics/test_immediate_drawing*.py \ + tests/integration/graphics/test_multitexture.py + +## Interactive tests + +# Fix missing interactive_test_base +# See https://bitbucket.org/pyglet/pyglet/issues/234/interactive_test_base-is-missing +sed -i '/interactive_test_base/d' tests/run.py tests/interactive/__init__.py +rm tests/base/test_interactive_test_base.py + +# Final tidy up + +# Only useful to creates Windows or MacOS apps +rm examples/astraea/setup.py + +# Convert to unix line endings +find pyglet -name "*.py" -exec dos2unix "{}" "+" + +chmod a+x examples/synthesizer.py examples/soundspace/soundspace.py examples/game/version*/asteroid.py + +dos2unix examples/opengl_3.py examples/tablet.py %build %python_build %install %python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} -%{python_expand cp -Lr examples examples_%{$python_bin_suffix} -find examples_%{$python_bin_suffix} -name "*.py" -exec sed -i "s|^#!%{_bindir}/python$|#!%{__$python}|" {} \; -find examples_%{$python_bin_suffix} -name "*.py" -exec sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" {} \; -%fdupes examples_%{$python_bin_suffix} -%fdupes %{buildroot}%{$python_sitelib} +%{python_expand pkgdocdir=%{_docdir}/$(cat _current_flavor)-pyglet +mkdir -p %{buildroot}$pkgdocdir +cp -Lr examples/ %{buildroot}$pkgdocdir/ +find %{buildroot}$pkgdocdir/examples/ -name "*.py" -exec sed -i "s|^#!%{_bindir}/python$|#!%{__$python}|" {} \; +find %{buildroot}$pkgdocdir/examples/ -name "*.py" -exec sed -i "s|^#!%{_bindir}/env python$|#!%{__$python}|" {} \; + +%fdupes %{buildroot}$pkgdocdir/examples/ } +%if %{with test} +%check +############################################# +### Launch a virtual framebuffer X server ### +############################################# +export DISPLAY=%{X_display} +Xvfb +iglx %{X_display} -screen 0 1600x1200x16 & +trap "kill $! || true" EXIT +sleep 5 + +# This is to allow use of pytest-error-for-skips and pytest-instafail, +# used to see problems even when tests hang. +# test_multiple_start_stop is occasional failures on most platforms +pytest_k_list="test_openal or test_pulse or test_arb or \ + test_multitexture or test_clock or test_get_animation_no_video or \ + leif_fork or test_load_privatefont or test_load_privatefont_from_list or test_directsound_listener or \ + test_gdiplus_loading or test_quartz_loading or test_quicktime_loading or test_multiple_start_stop" + +%if %{without gtk2} +pytest_k_list="$pytest_k_list or test_gdkpixbuf2 or test_gdkpixbuf2_loading" +%endif + +%if %{with pytest_helpers} +pytest_addopts="--instafail --error-for-skips --timeout=30 " +%endif + +pytest_addopts="$pytest_addopts tests/unit tests/integration" + +# These are only problematic on Python 2, and are restored after Python 2 tests +# https://bitbucket.org/pyglet/pyglet/issues/223/clock-test-failures +mv tests/unit/test_clock.py tests/unit/.test_clock.py + +python2 -m pytest $pytest_addopts -k "not ($pytest_k_list)" + +mv tests/unit/.test_clock.py tests/unit/test_clock.py + +python3 -m pytest $pytest_addopts -k "not ($pytest_k_list)" + +# endif test +%endif + %files %{python_files} %license LICENSE +%if "%{_version}" == "1.3.2" +%license LICENSE.pypng +%endif %doc NOTICE README RELEASE_NOTES -%doc examples_%{python_bin_suffix} +%ifpython2 +%{_defaultdocdir}/python{,2}-pyglet/examples/ +%endif +%ifpython3 +%{_defaultdocdir}/python3-pyglet/examples/ +%endif %{python_sitelib}/pyglet %{python_sitelib}/pyglet-%{version}-py*.egg-info