14
0
forked from pool/python-PySDL2

Accepting request 963269 from home:bnavigator:branches:devel:languages:python

- Update to version 0.9.11
  * Added bindings for new functions and constants introduced in
    SDL2 2.0.20
  * Added bindings and documentation for new functions and
    constants introduced in SDL2_ttf 2.0.18
- Changelog for Release 0.9.10
  * Added bindings for new functions and constants introduced in
    SDL2 2.0.18
  * Added experimental support for SDL 2.0.3 and 2.0.4 for older
    platforms (tested on an iMac G4 running 10.4.11)
  * Major improvements to the ext.pixelaccess module
  * Major rewrite of the ext.image module
  * New object-oriented method of rendering with sdl2.ext.Renderers
    using the new sdl2.ext.Texture class
  * Major expansion and rewrite of the sdl2.ext.Renderer class
  * New powerful sdl2.ext.FontTTF class for font rendering
  * Redocumented most of the sdl2.ext modules for better clarity
    and maintainability
  * Added automatic detection of Homebrew SDL2 binaries on Apple
    Silicon Macs as a fallback Deprecated a number of sdl2.ext
    modules and functions
- Changelog for Release 0.9.9
  * Added bindings for new functions and constants introduced in
    SDL2 2.0.16
  * Reverted the fix for issue #139 which inadvertently caused
    Window.show() to force the window to use SDL2's software
    rendering, breaking the Renderer class and compatibility with
    PyOpenGL.
- Drop PySDL2-pr193-skipnumpy.patch
- Clean out test suite

OBS-URL: https://build.opensuse.org/request/show/963269
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PySDL2?expand=0&rev=14
This commit is contained in:
2022-03-21 07:24:13 +00:00
committed by Git OBS Bridge
parent 793affa45b
commit e0ab0957ff
5 changed files with 68 additions and 100 deletions

3
PySDL2-0.9.11.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93e51057d39fd583b80001d42b21d5a3f71e30d489d85924d944b2c7350e2da6
size 736026

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4dfa3168e4e4e9301a2cd5904bdcea15e2bf62a1c9abb5d3f92d9122ea22c26e
size 742279

View File

@@ -1,70 +0,0 @@
From ebe6ca1b97a080c229ee80cfdd82d35663851f27 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sun, 29 Aug 2021 13:17:22 +0200
Subject: [PATCH] Skip tests when numpy is not available
---
sdl2/test/sdl2ext_draw_test.py | 7 +++++++
sdl2/test/sdl2ext_font_test.py | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/sdl2/test/sdl2ext_draw_test.py b/sdl2/test/sdl2ext_draw_test.py
index 63ff360..ac11bc8 100644
--- a/sdl2/test/sdl2ext_draw_test.py
+++ b/sdl2/test/sdl2ext_draw_test.py
@@ -6,6 +6,11 @@
from sdl2.ext.compat import ExperimentalWarning
from sdl2 import ext as sdl2ext
+try:
+ import numpy
+ _HASNUMPY = True
+except:
+ _HASNUMPY = False
class TestSDL2ExtDraw(object):
__tags__ = ["sdl", "sdl2ext"]
@@ -21,6 +26,7 @@ def setup_class(cls):
def teardown_class(cls):
sdl2ext.quit()
+ @pytest.mark.skipif(not _HASNUMPY, reason="pixels3d requires numpy module")
def test_fill(self):
# Initialize colour and surface/view
WHITE = (255, 255, 255)
@@ -63,6 +69,7 @@ def test_fill(self):
with pytest.raises(ValueError):
sdl2ext.fill(sf.contents, WHITE, (1, 2, 3))
+ @pytest.mark.skipif(not _HASNUMPY, reason="pixels3d requires numpy module")
def test_line(self):
# Initialize colour and surface/view
WHITE = (255, 255, 255)
diff --git a/sdl2/test/sdl2ext_font_test.py b/sdl2/test/sdl2ext_font_test.py
index 8ad8000..a9acde5 100644
--- a/sdl2/test/sdl2ext_font_test.py
+++ b/sdl2/test/sdl2ext_font_test.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import pytest
-import numpy as np
from sdl2 import ext as sdl2ext
from sdl2.ext.compat import byteify, ExperimentalWarning
from sdl2.ext.pixelaccess import pixels2d
@@ -46,7 +45,7 @@ def test_BitmapFont(self):
# Try SDL_Surface surface
font = sdl2ext.BitmapFont(sf.contents, (32, 32), FONTMAP)
assert font.size == (32, 32)
-
+
# Try SDL_Surface pointer surface
font = sdl2ext.BitmapFont(sf, (32, 32), FONTMAP)
assert font.size == (32, 32)
@@ -72,6 +71,7 @@ def test_BitmapFont_render(self):
font.render("this_should_fail")
def test_BitmapFont_render_on(self):
+ np = pytest.importorskip("numpy", reason="numpy module is not available")
# Initialize font, surface, and BitmapFont for tests
fontpath = byteify(RESOURCES.get_path("font.bmp"), "utf-8")
sf = surface.SDL_LoadBMP(fontpath)

View File

@@ -1,3 +1,37 @@
-------------------------------------------------------------------
Sun Mar 20 09:55:17 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to version 0.9.11
* Added bindings for new functions and constants introduced in
SDL2 2.0.20
* Added bindings and documentation for new functions and
constants introduced in SDL2_ttf 2.0.18
- Changelog for Release 0.9.10
* Added bindings for new functions and constants introduced in
SDL2 2.0.18
* Added experimental support for SDL 2.0.3 and 2.0.4 for older
platforms (tested on an iMac G4 running 10.4.11)
* Major improvements to the ext.pixelaccess module
* Major rewrite of the ext.image module
* New object-oriented method of rendering with sdl2.ext.Renderers
using the new sdl2.ext.Texture class
* Major expansion and rewrite of the sdl2.ext.Renderer class
* New powerful sdl2.ext.FontTTF class for font rendering
* Redocumented most of the sdl2.ext modules for better clarity
and maintainability
* Added automatic detection of Homebrew SDL2 binaries on Apple
Silicon Macs as a fallback Deprecated a number of sdl2.ext
modules and functions
- Changelog for Release 0.9.9
* Added bindings for new functions and constants introduced in
SDL2 2.0.16
* Reverted the fix for issue #139 which inadvertently caused
Window.show() to force the window to use SDL2's software
rendering, breaking the Renderer class and compatibility with
PyOpenGL.
- Drop PySDL2-pr193-skipnumpy.patch
- Clean out test suite
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Aug 29 10:31:04 UTC 2021 - Ben Greiner <code@bnavigator.de> Sun Aug 29 10:31:04 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-PySDL2 # spec file for package python-PySDL2
# #
# Copyright (c) 2021 SUSE LLC # Copyright (c) 2022 SUSE LLC
# #
# 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
@@ -19,14 +19,12 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define X_display ":98" %define X_display ":98"
Name: python-PySDL2 Name: python-PySDL2
Version: 0.9.8 Version: 0.9.11
Release: 0 Release: 0
Summary: Python SDL2 bindings Summary: Python ctypes wrapper around SDL2
License: SUSE-Public-Domain License: SUSE-Public-Domain
URL: https://github.com/marcusva/py-sdl2 URL: https://github.com/py-sdl/py-sdl2
Source: https://files.pythonhosted.org/packages/source/P/PySDL2/PySDL2-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/P/PySDL2/PySDL2-%{version}.tar.gz
# PATCH-FIX-UPSTREAM PySDL2-pr193-skipnumpy.patch -- gh#marcusva/py-sdl2#193
Patch0: https://github.com/marcusva/py-sdl2/pull/193.patch#/PySDL2-pr193-skipnumpy.patch
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: SDL2 >= 2.0.5 BuildRequires: SDL2 >= 2.0.5
BuildRequires: SDL2_gfx >= 1.0.3 BuildRequires: SDL2_gfx >= 1.0.3
@@ -36,10 +34,10 @@ BuildRequires: SDL2_ttf >= 2.0.14
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
# SECTION test requirements # SECTION test requirements
BuildRequires: %{python_module opengl} BuildRequires: %{python_module numpy}
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}
BuildRequires: xorg-x11-server BuildRequires: xorg-x11-server
BuildRequires: %{python_module numpy if (%python-base without python36-base)}
# /SECTION # /SECTION
Requires: SDL2 >= 2.0.5 Requires: SDL2 >= 2.0.5
Requires: SDL2_gfx >= 1.0.3 Requires: SDL2_gfx >= 1.0.3
@@ -50,9 +48,10 @@ BuildArch: noarch
%python_subpackages %python_subpackages
%description %description
PySDL2 is a wrapper around the SDL2 library and as such similar to the PySDL2 is a pure Python wrapper around the SDL2, SDL2_mixer, SDL2_image,
discontinued PySDL project. In contrast to PySDL, it has no licensing SDL2_ttf, and SDL2_gfx libraries. Instead of relying on C code, it uses
restrictions, nor does it rely on C code, but uses ctypes instead. the built-in ctypes module to interface with SDL2, and provides simple
Python classes and wrappers for common SDL2 functionality.
%prep %prep
%autosetup -p1 -n PySDL2-%{version} %autosetup -p1 -n PySDL2-%{version}
@@ -75,22 +74,27 @@ Xvfb %{X_display} >& Xvfb.log &
trap "kill $! || true" EXIT trap "kill $! || true" EXIT
sleep 10 sleep 10
pushd sdl2/test export SDL_VIDEODRIVER=dummy
# these segfault when not tested separately export SDL_AUDIODRIVER=dummy
testextra="SpriteFactory or SDL2EXTSprite or test_SDL_GL" export SDL_RENDER_DRIVER=software
# we do not have audio devices in build environment export PYTHONFAULTHANDLER=1
donttest+=" or test_Mix_OpenAudio or test_SDL_GetNumAudioDevices or TestSDLMixer"
# we get border size 0 in build "desktop" environment donttest="pytest_k_dummyprefix"
donttest+=" or test_SDL_GetWindowsBordersSize" # color mismatches, test shell variable because this is a noarch package
# flaky segfaults if [ "$RPM_ARCH" = "ppc64" -o "$RPM_ARCH" = "ppc64le" -o "$RPM_ARCH" = "s390x" ]; then
donttest+=" or (TestSDL2ExtWindow and (test_Window_position or test_Window_size))" donttest="$donttest or sdl2ext"
# test suite assumes SDL devel version from mercurial (hg) checkout fi
donttest+=" or test_SDL_GetRevision" # Does not recognize big endian byteorder
# python2 env on Leap different, pytest arg missing if [ $(python3 -c "import sys; print(sys.byteorder)") = "big" ]; then
python2_donttest="or test_SDL_GetBasePath or test_BitmapFont_render_on" donttest="$donttest or PixelFormatEnum"
%pytest -rfEs -k "not (${testextra} ${donttest} ${$python_donttest})" fi
%pytest -rfEs -k "${testextra}" %if 0%{suse_version} < 1550
popd # Segfault with SDL on Leap
donttest="$donttest or test_SDL_GetPowerInfo"
# python2 env different, pytest arg missing
python2_donttest=" or test_SDL_GetBasePath or test_render_on"
%endif
%pytest -rfEs -k "not ($donttest ${$python_donttest})"
%files %{python_files} %files %{python_files}
%license COPYING.txt %license COPYING.txt