15
0
forked from pool/python-PySDL2

- Add upstream PRs fixing test failures:

* surface_test.patch
  * video_test.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PySDL2?expand=0&rev=38
This commit is contained in:
2026-01-21 11:55:29 +00:00
committed by Git OBS Bridge
commit bdf9858c35
7 changed files with 444 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
pysdl2-0.9.17.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:48c6ef01a4eb123db5f7e46e1a1b565675755b07e615f3fe20a623c94735b52b
size 775955

235
python-PySDL2.changes Normal file
View File

@@ -0,0 +1,235 @@
-------------------------------------------------------------------
Wed Jan 21 11:12:54 UTC 2026 - Markéta Machová <mmachova@suse.com>
- Add upstream PRs fixing test failures:
* surface_test.patch
* video_test.patch
-------------------------------------------------------------------
Wed Apr 30 00:41:39 UTC 2025 - Jan Engelhardt <jengelh@inai.de>
- Adjust run-time dependencies to avoid old virtual provides.
-------------------------------------------------------------------
Mon Apr 28 13:58:16 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Adjust build-time dependencies so that it builds with SDL3.
-------------------------------------------------------------------
Tue Mar 4 15:07:23 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Update to 0.9.17
* Updated to wrap new functions and constants in SDL 2.30.10.
* Updated to wrap new functions and constants in SDL_mixer 2.8.0
* Updated to wrap new function in SDL_image 2.8.0.
* Added a new function sdl2.ext.get_key_state for checking if a given
key is currently down or up independently of the SDL event queue.
- Drop merged patches:
* fix-tests-SDL_GetError.patch
* fix-partially-resolve-video_test.patch
* fix-test-SDL_hid_enumerate.patch
-------------------------------------------------------------------
Fri Feb 2 09:28:39 UTC 2024 - munix9@googlemail.com
- Add libmpg123-0 as a build requirement for the tests
-------------------------------------------------------------------
Sun Aug 20 11:55:43 UTC 2023 - munix9@googlemail.com
- Remove fix-tests.patch in favor of upstream patches
- Add upstream patches to resolve test failures:
fix-partially-resolve-video_test.patch
fix-test-SDL_hid_enumerate.patch
fix-tests-SDL_GetError.patch
-------------------------------------------------------------------
Sun Jul 16 06:08:53 UTC 2023 - munix9@googlemail.com
- Update to 0.9.16:
* Updated to wrap new functions and constants in SDL 2.28.0.
* Added a new method to sdl2.ext.Renderer, Renderer.rcopy(), for
drawing textures to the renderer with relative alignment.
* Added a new module, sdl2.ext.input for processing common SDL
input events in a Pythonic manner.
* Added a new function sdl2.ext.quit_requested() for checking
whether an SDL event queue contains any sdl2.SDL_QUIT events.
- Update to 0.9.15:
* Updated to wrap new functions and constants in SDL 2.26.0.
* Added a new module sdl2.ext.mouse for showing/hiding/moving/
retrieving the mouse cursor and querying the current state of
the mouse buttons.
* Added indexing/unpacking support to the sdl2.ext.Point and
sdl2.ext.Rect classes and their float equivalents.
* Updated sdl2.ext.SpriteFactory.from_image() to allow passing
PIL.Image.Image objects directly.
* Improved sdl2.ext.Texture performance.
* Fixed a bug preventing SDL Points and Rects from being used
as srcrect or dstrect for sdl2.ext.Renderer.copy().
* Added a binding for SDL_ResetHint, which was added in SDL
2.24.0 but got missed in PR #246.
- Adjust fix-tests.patch
- Remove fix-version_test.patch (fixed upstream)
- Remove python-PySDL2.rpmlintrc (obsolete)
-------------------------------------------------------------------
Sat Nov 26 14:51:13 UTC 2022 - munix9@googlemail.com
- Add fix-version_test.patch (gh#py-sdl/py-sdl2#248):
Don't assert that SDL_GetRevision() starts with http
- Skip rpmlint error python-tests-in-package
-------------------------------------------------------------------
Wed Nov 2 12:09:29 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Remove .DS_Store files from sources
- Remove not needed python_module macro definition
-------------------------------------------------------------------
Wed Nov 2 11:58:38 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Add fix-tests.patch to fix the test run in the rpmbuild container without
access to /dev/input.
-------------------------------------------------------------------
Wed Nov 2 06:56:40 UTC 2022 - munix9@googlemail.com
- Update to 0.9.14:
* Updated to wrap new functions and constants in SDL 2.24.0.
* Added a new module sdl2.ext.displays for retrieving and working
with connected displays and their supported resolutions/refresh
rates.
* Extended sdl2.ext.init to allow initializing all SDL subsystems
individually (previously just initialized the video subsystem).
* Improved the memory safety of the sdl2.ext.Window class.
* Added raise_sdl_err to the public ext API.
* Fixed sdl2.ext.line to work correctly on 1bpp surfaces.
* Various fixes/improvements to the unit test suite for Linux
package maintainers.
- Remove mixer_tests_fix.patch (fixed upstream)
-------------------------------------------------------------------
Fri Jul 29 12:38:06 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Update to 0.9.13:
- Updated to wrap new functions and constants in SDL_ttf
2.20.0.
- Updated to wrap new functions and constants in SDL_mixer
2.6.0.
- Updated to wrap new functions and constants in SDL_image
2.6.0.
- Added experimental bindings for the new functions and
constants in the SDL 2.23.1 pre-release.
- Added a new function :func:sdl2.ext.load_svg that allows
loading simple SVG images at arbitrary resolutions with
SDL_image 2.6.0 or later.
- Added bindings for new functions and constants introduced in
SDL2 2.0.22
- Added a stable API for accessing the raw ctypes function
objects for SDL2 functions
- Various bugfixes (see the project's news.rst for more info)
- Add mixer_tests_fix.patch to switch off failing tests
(gh#py-sdl/py-sdl2#241).
- Otherwise, we actually dont need to explicitly skip ANY
tests! Wow!
-------------------------------------------------------------------
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>
- Update to version 0.9.8
* This release fixes a number of bugs, updates the bindings to
support new functions in SDL2 2.0.14, adds a wrapper for the
SDL2 MessageBox API, and more.
* Added bindings for new functions and constants introduced in
SDL2 2.0.12 and 2.0.14
* Added full support for SDL2 binaries in non-system locations
(e.g., with pysdl2-dll) when using PySDL2 with Python installed
from the Microsoft Store on Windows.
* Improved handling of SDL2 binaries that are too old to be used
with PySDL2.
* Added a new sdl2.ext API for displaying SDL2 MessageBox alerts
and dialog boxes.
- Add PySDL2-pr193-skipnumpy.patch (gh#marcusva/py-sdl2#193) for
missing NumPy in python36
-------------------------------------------------------------------
Mon Feb 8 22:45:09 UTC 2021 - Ben Greiner <code@bnavigator.de>
- remove duplicate check section: Only the Xvfb version runs
without segfaults when loading the SDL libraries. (Except for
two flaky Window position and size tests)
-------------------------------------------------------------------
Fri Mar 27 10:23:12 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- update to version 0.9.7
* The minimum required SDL version is 2.0.5
* The minimum required SDL_ttf version is 2.0.14
* The minimum required SDL_mixer version is 2.0.1
* The minimum required SDL_image version is 2.0.1
* Improved compatibility with older SDL2 releases by raising informative
exceptions whenever a function requiring a newer SDL2 binary is called
* fixed bug preventing use of background color with wrapped text using
:meth:`sdl2.ext.FontManager.render()` (PR #134)
* fixed issue #112: allow easy moving and resizing of :obj:`sdl2.ext.Window()`
objects through 'position' and 'size' attributes, added 'open' and 'close'
methods to Window objects
* fixed issue #130: SDL_RW* functions now accept pointers to RW objects
* fixed issue #135: :func:`sdl2.SDL_GetPrefPath()` and
:func:`sdl2.SDL_GetPrefPath()` now return bytestrings instead of pointers
to strings.
* fixed issue #148: added support for loading SDL2 .so binaries with numeric
suffixes on Unix-like OSes (e.g. 'libSDL2.so.2')
* fixed transparency issues with pallete indexed PNGs (PR #159)
-------------------------------------------------------------------
Thu Nov 7 15:32:19 UTC 2019 - Matej Cepl <mcepl@suse.com>
- Run through spec-cleaner
-------------------------------------------------------------------
Tue Dec 4 12:52:49 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Tue Nov 7 18:24:56 UTC 2017 - toddrme2178@gmail.com
- initial version

91
python-PySDL2.spec Normal file
View File

@@ -0,0 +1,91 @@
#
# spec file for package python-PySDL2
#
# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define X_display ":98"
%define lname pysdl2
Name: python-PySDL2
Version: 0.9.17
Release: 0
Summary: Python ctypes wrapper around SDL2
License: SUSE-Public-Domain
URL: https://github.com/py-sdl/py-sdl2
Source: https://files.pythonhosted.org/packages/source/p/%{lname}/%{lname}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/py-sdl/py-sdl2/pull/290 surface_test: Expect intended behaviour if SDL2 is new enough
Patch0: surface_test.patch
# PATCH-FIX-UPSTREAM https://github.com/py-sdl/py-sdl2/pull/291 video_test: Skip SDL_SetWindowMouseRect with sdl2-compat dummy driver
Patch1: video_test.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(SDL2_gfx) >= 1.0.4
BuildRequires: pkgconfig(SDL2_image) >= 2.6.0
BuildRequires: pkgconfig(SDL2_mixer) >= 2.6.0
BuildRequires: pkgconfig(SDL2_ttf) >= 2.20.0
BuildRequires: pkgconfig(sdl3) >= 2.0.22
# SECTION test requirements
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module pytest}
BuildRequires: libmpg123-0
BuildRequires: xorg-x11-server
# /SECTION
Requires: libSDL2-2_0-0 >= 2.0.22
Requires: libSDL2_gfx-1_0-0 >= 1.0.4
Requires: libSDL2_image-2_0-0 >= 2.6.0
Requires: libSDL2_mixer-2_0-0 >= 2.6.0
Requires: libSDL2_ttf-2_0-0 >= 2.20.0
BuildArch: noarch
%python_subpackages
%description
PySDL2 is a pure Python wrapper around the SDL2, SDL2_mixer, SDL2_image,
SDL2_ttf, and SDL2_gfx libraries. Instead of relying on C code, it uses
the built-in ctypes module to interface with SDL2, and provides simple
Python classes and wrappers for common SDL2 functionality.
%prep
%autosetup -p1 -n %{lname}-%{version}
sed -i 's/\r$//' AUTHORS.txt COPYING.txt README.md
find . -name *DS_Store -delete
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=dummy
export SDL_RENDER_DRIVER=software
export PYTHONFAULTHANDLER=1
%pytest -rfEs -k 'not (test_SDL_SetWindowDisplayMode or test_SDL_SetWindowFullscreen or test_SDL_SetHint)'
%files %{python_files}
%license COPYING.txt
%doc AUTHORS.txt README.md doc/
%{python_sitelib}/sdl2
%{python_sitelib}/[Pp]y[Ss][Dd][Ll]2-%{version}*-info
%changelog

66
surface_test.patch Normal file
View File

@@ -0,0 +1,66 @@
From a9163d3c134f22add5d672d11d2e2e1ae07e58f1 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Fri, 19 Dec 2025 17:58:01 +0000
Subject: [PATCH] surface_test: Expect intended behaviour if SDL2 is new enough
In older versions of "classic" SDL2, including the 2.32.x series,
intersecting an empty rectangle with another rectangle would have an
empty result (w=0, h=0) with an uninitialized position (x, y arbitrary).
However, SDL upstream considers this to be a bug, and it caused
observable visual issues in some older games when used in conjunction
with sdl12-compat.
This test previously asserted that the clip rectangle would not be equal
to the requested clip rectangle, but that was only true because of
this bug: the uninitialized x and y coordinates were very unlikely to be
equal to the requested rectangle. With the bug fix in sdl2-compat,
the coordinates come out as equal to those that were requested.
If SDL2 is sufficiently new, assert that the comparison result is true
(which is the correct result according to SDL upstream), and if not,
make no assertion (in case the bug fix is backported).
Resolves: https://github.com/py-sdl/py-sdl2/issues/289
Signed-off-by: Simon McVittie <smcv@debian.org>
---
sdl2/test/surface_test.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/sdl2/test/surface_test.py b/sdl2/test/surface_test.py
index e8740e8..f241846 100644
--- a/sdl2/test/surface_test.py
+++ b/sdl2/test/surface_test.py
@@ -467,13 +467,20 @@ def test_SDL_FreeSurface(self):
sdl2.SDL_FreeSurface(sf)
def test_SDL_GetSetClipRect(self):
+ # A bug in intersecting empty rectangles was fixed in SDL2 2.33.x
+ # and in sdl2-compat (which reports its version as >= 2.32.50)
+ if sdl2.dll.version_tuple >= (2, 32, 50):
+ true_if_fixed = True
+ else:
+ true_if_fixed = None
+
rectlist = ((rect.SDL_Rect(0, 0, 0, 0), SDL_FALSE, True),
- (rect.SDL_Rect(2, 2, 0, 0), SDL_FALSE, False),
+ (rect.SDL_Rect(2, 2, 0, 0), SDL_FALSE, true_if_fixed),
(rect.SDL_Rect(2, 2, 5, 1), SDL_TRUE, True),
(rect.SDL_Rect(6, 5, 10, 3), SDL_TRUE, False),
(rect.SDL_Rect(0, 0, 10, 10), SDL_TRUE, True),
- (rect.SDL_Rect(0, 0, -10, 10), SDL_FALSE, False),
- (rect.SDL_Rect(0, 0, -10, -10), SDL_FALSE, False),
+ (rect.SDL_Rect(0, 0, -10, 10), SDL_FALSE, true_if_fixed),
+ (rect.SDL_Rect(0, 0, -10, -10), SDL_FALSE, true_if_fixed),
(rect.SDL_Rect(-10, -10, 10, 10), SDL_FALSE, False),
(rect.SDL_Rect(10, -10, 10, 10), SDL_FALSE, False),
(rect.SDL_Rect(10, 10, 10, 10), SDL_TRUE, False)
@@ -490,7 +497,8 @@ def test_SDL_GetSetClipRect(self):
sdl2.SDL_GetClipRect(sf, byref(clip))
err = "Could not set clip rect %s" % r
assert retval == clipsetval, "retval: " + err
- assert (clip == r) == cmpval, "clip: " + err
+ if cmpval is not None:
+ assert (clip == r) == cmpval, "clip: " + err
sdl2.SDL_FreeSurface(sf)
def test_SDL_GetSetSurfaceAlphaMod(self):

25
video_test.patch Normal file
View File

@@ -0,0 +1,25 @@
From 96ba83b67daac9d45efb5e5d7d4c904aee8446ac Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Fri, 19 Dec 2025 18:07:02 +0000
Subject: [PATCH] video_test: Skip SDL_SetWindowMouseRect with sdl2-compat
dummy driver
This driver doesn't implement mouse confinement.
Signed-off-by: Simon McVittie <smcv@debian.org>
---
sdl2/test/video_test.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/sdl2/test/video_test.py b/sdl2/test/video_test.py
index 0b8801f..a216906 100644
--- a/sdl2/test/video_test.py
+++ b/sdl2/test/video_test.py
@@ -730,6 +730,7 @@ def test_SDL_GetGrabbedWindow(window):
# NOTE: Should implement this once the above tests are fixed
pass
+@pytest.mark.skipif(DRIVER_DUMMY, reason="Not implemented by dummy driver")
@pytest.mark.skipif(sdl2.dll.version < 2018, reason="not available")
def test_SDL_GetSetWindowMouseRect(with_sdl):
flags = sdl2.SDL_WINDOW_BORDERLESS