15
0
forked from pool/python-PySDL2

Compare commits

7 Commits

Author SHA256 Message Date
9be395c534 Accepting request 1328491 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1328491
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-PySDL2?expand=0&rev=17
2026-01-21 13:19:53 +00:00
bdf9858c35 - 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
2026-01-21 11:55:29 +00:00
2f7b12a3a1 Accepting request 1275032 from devel:languages:python
Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/1275032
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-PySDL2?expand=0&rev=16
2025-05-07 17:18:19 +00:00
3d10e2a52d - Adjust run-time dependencies to avoid old virtual provides.
- Adjust build-time dependencies so that it builds with SDL3.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PySDL2?expand=0&rev=36
2025-04-30 06:36:52 +00:00
adfe8fd28d - Adjust dependencies so that it builds with SDL3.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PySDL2?expand=0&rev=35
2025-04-28 13:58:35 +00:00
5108f4523e Accepting request 1251643 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1251643
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-PySDL2?expand=0&rev=15
2025-03-10 17:05:52 +00:00
6216048b07 - 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

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PySDL2?expand=0&rev=33
2025-03-10 06:47:59 +00:00
4 changed files with 103 additions and 1 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
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>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-PySDL2
#
# Copyright (c) 2025 SUSE LLC
# 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
@@ -25,6 +25,10 @@ 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}

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