From adfe8fd28d62480c5ff1edf076ebbbc06697e6762fd114b7643f9158ff3ca640 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Mon, 28 Apr 2025 13:58:35 +0000 Subject: [PATCH 1/2] - 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 --- .gitattributes | 23 +++ .gitignore | 1 + PySDL2-0.9.16.tar.gz | 3 + fix-partially-resolve-video_test.patch | 240 +++++++++++++++++++++++++ fix-test-SDL_hid_enumerate.patch | 43 +++++ fix-tests-SDL_GetError.patch | 148 +++++++++++++++ pysdl2-0.9.17.tar.gz | 3 + python-PySDL2.changes | 223 +++++++++++++++++++++++ python-PySDL2.spec | 87 +++++++++ 9 files changed, 771 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 PySDL2-0.9.16.tar.gz create mode 100644 fix-partially-resolve-video_test.patch create mode 100644 fix-test-SDL_hid_enumerate.patch create mode 100644 fix-tests-SDL_GetError.patch create mode 100644 pysdl2-0.9.17.tar.gz create mode 100644 python-PySDL2.changes create mode 100644 python-PySDL2.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/PySDL2-0.9.16.tar.gz b/PySDL2-0.9.16.tar.gz new file mode 100644 index 0000000..e448149 --- /dev/null +++ b/PySDL2-0.9.16.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1027406badbecdd30fe56e800a5a76ad7d7271a3aec0b7acf780ee26a00f2d40 +size 773537 diff --git a/fix-partially-resolve-video_test.patch b/fix-partially-resolve-video_test.patch new file mode 100644 index 0000000..7303aea --- /dev/null +++ b/fix-partially-resolve-video_test.patch @@ -0,0 +1,240 @@ +From ed28ea6305dede1b6ba046e36ddae9ba2016b62e Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Sat, 19 Aug 2023 23:44:03 +0100 +Subject: [PATCH] Partially resolve #257: video_test (#270) + +* video_test: Don't check error unless a function failed + +Helps: https://github.com/py-sdl/py-sdl2/issues/257 +Signed-off-by: Simon McVittie + +* video_test: Use _check_error_msg() a bit more often + +Signed-off-by: Simon McVittie + +* video_test: Mitigate unsuitability of SDL_GetError() for detecting failure + +SDL_GetError() is like errno: it's documented not to be suitable for +detecting failure, only for getting more details if failure was already +detected (its result is unspecified on success, because a successful +API call might have been implemented by doing something that failed, +detecting that, and falling back to doing something different). +However, some functions in SDL2 return void, so we have no other way +to tell whether they have failed (they do return a result in SDL3). + +To make it less likely that upgrading SDL2 will make these tests regress, +clear the error indicator immediately before calling the function under +test. It is still not guaranteed to be empty on success, but at least +this way we make sure it doesn't already contain an error message from +a previous function call. + +Helps: https://github.com/py-sdl/py-sdl2/issues/257 +Signed-off-by: Simon McVittie + +--------- + +Signed-off-by: Simon McVittie +--- + sdl2/test/video_test.py | 58 +++++++++++++++++++++-------------------- + 1 file changed, 30 insertions(+), 28 deletions(-) + +diff --git a/sdl2/test/video_test.py b/sdl2/test/video_test.py +index 83cb620..ca5a8e4 100644 +--- a/sdl2/test/video_test.py ++++ b/sdl2/test/video_test.py +@@ -52,8 +52,7 @@ def with_sdl_gl(with_sdl): + def window(with_sdl): + flag = sdl2.SDL_WINDOW_BORDERLESS + w = sdl2.SDL_CreateWindow(b"Test", 10, 40, 12, 13, flag) +- if not w: +- assert SDL_GetError() == b"" ++ assert w, _check_error_msg() + assert isinstance(w.contents, sdl2.SDL_Window) + sdl2.SDL_ClearError() + yield w +@@ -63,8 +62,7 @@ def window(with_sdl): + def decorated_window(with_sdl): + flag = sdl2.SDL_WINDOW_RESIZABLE + w = sdl2.SDL_CreateWindow(b"Test", 10, 40, 12, 13, flag) +- if not w: +- assert SDL_GetError() == b"" ++ assert w, _check_error_msg() + assert isinstance(w.contents, sdl2.SDL_Window) + sdl2.SDL_ClearError() + yield w +@@ -74,20 +72,18 @@ def decorated_window(with_sdl): + def gl_window(with_sdl_gl): + flag = sdl2.SDL_WINDOW_OPENGL + w = sdl2.SDL_CreateWindow(b"OpenGL", 10, 40, 12, 13, flag) +- if not w: +- assert SDL_GetError() == b"" ++ assert w, _check_error_msg() + assert isinstance(w.contents, sdl2.SDL_Window) + sdl2.SDL_ClearError() + ctx = sdl2.SDL_GL_CreateContext(w) +- assert SDL_GetError() == b"" ++ assert ctx, _check_error_msg() + yield (w, ctx) + sdl2.SDL_GL_DeleteContext(ctx) + sdl2.SDL_DestroyWindow(w) + + def _create_window(name, h, w, x, y, flags): + window = sdl2.SDL_CreateWindow(name, h, w, x, y, flags) +- if not window: +- assert SDL_GetError() == b"" ++ assert window, _check_error_msg() + assert isinstance(window.contents, sdl2.SDL_Window) + sdl2.SDL_ClearError() + return window +@@ -193,7 +189,7 @@ def test_SDL_VideoInitQuit(): + # Test with default driver + assert sdl2.SDL_WasInit(0) & sdl2.SDL_INIT_VIDEO != sdl2.SDL_INIT_VIDEO + ret = sdl2.SDL_VideoInit(None) +- assert ret == 0, sdl2.SDL_GetError().decode('utf-8', 'replace') ++ assert ret == 0, _check_error_msg() + assert sdl2.SDL_GetCurrentVideoDriver() # If initialized, should be string + sdl2.SDL_VideoQuit() + assert not sdl2.SDL_GetCurrentVideoDriver() +@@ -234,8 +230,7 @@ def test_SDL_GetDisplayMode(with_sdl): + for mode in range(modes): + dmode = sdl2.SDL_DisplayMode() + ret = sdl2.SDL_GetDisplayMode(index, mode, byref(dmode)) +- assert sdl2.SDL_GetError() == b"" +- assert ret == 0 ++ assert ret == 0, _check_error_msg() + if not DRIVER_DUMMY: + assert dmode.w > 0 + assert dmode.h > 0 +@@ -245,8 +240,7 @@ def test_SDL_GetCurrentDisplayMode(with_sdl): + for index in range(numdisplays): + dmode = sdl2.SDL_DisplayMode() + ret = sdl2.SDL_GetCurrentDisplayMode(index, byref(dmode)) +- assert sdl2.SDL_GetError() == b"" +- assert ret == 0 ++ assert ret == 0, _check_error_msg() + assert dmode.w > 0 + assert dmode.h > 0 + +@@ -255,8 +249,7 @@ def test_SDL_GetDesktopDisplayMode(with_sdl): + for index in range(numdisplays): + dmode = sdl2.SDL_DisplayMode() + ret = sdl2.SDL_GetDesktopDisplayMode(index, byref(dmode)) +- assert sdl2.SDL_GetError() == b"" +- assert ret == 0 ++ assert ret == 0, _check_error_msg() + assert dmode.w > 0 + assert dmode.h > 0 + +@@ -266,8 +259,7 @@ def test_SDL_GetClosestDisplayMode(with_sdl): + for index in range(numdisplays): + dmode = sdl2.SDL_DisplayMode() + ret = sdl2.SDL_GetCurrentDisplayMode(index, byref(dmode)) +- assert sdl2.SDL_GetError() == b"" +- assert ret == 0 ++ assert ret == 0, _check_error_msg() + cmode = sdl2.SDL_DisplayMode( + dmode.format, dmode.w - 1, dmode.h - 1, dmode.refresh_rate + ) +@@ -286,8 +278,7 @@ def test_SDL_GetDisplayBounds(with_sdl): + for index in range(numdisplays): + bounds = rect.SDL_Rect() + ret = sdl2.SDL_GetDisplayBounds(index, byref(bounds)) +- assert sdl2.SDL_GetError() == b"" +- assert ret == 0 ++ assert ret == 0, _check_error_msg() + assert bounds.w > 0 + assert bounds.h > 0 + assert not rect.SDL_RectEmpty(bounds) +@@ -345,8 +336,8 @@ def test_GetDisplayInfo(with_sdl): + def test_SDL_CreateDestroyWindow(with_sdl): + flag = sdl2.SDL_WINDOW_BORDERLESS + window = sdl2.SDL_CreateWindow(b"Test", 10, 40, 12, 13, flag) ++ assert window, _check_error_msg() + if not isinstance(window.contents, sdl2.SDL_Window): +- assert SDL_GetError() == b"" + assert isinstance(window.contents, sdl2.SDL_Window) + sdl2.SDL_DestroyWindow(window) + +@@ -453,7 +444,10 @@ def test_SDL_SetWindowIcon(window): + 0, 16, 16, 16, 0xF000, 0x0F00, 0x00F0, 0x000F + ) + assert isinstance(sf.contents, surface.SDL_Surface) ++ sdl2.SDL_ClearError() + sdl2.SDL_SetWindowIcon(window, sf) ++ # TODO: This is not 100% safe, but in SDL2, SetWindowIcon returns void, ++ # so we can't reliably detect error + assert SDL_GetError() == b"" + + @pytest.mark.xfail(is_pypy, reason="PyPy can't create proper py_object values") +@@ -535,7 +529,10 @@ def test_SDL_GetSetWindowMinimumSize(window): + sdl2.SDL_GetWindowSize(window, byref(sx), byref(sy)) + assert (sx.value, sy.value) == (12, 13) + # Set and verify the minimum window size ++ sdl2.SDL_ClearError() + sdl2.SDL_SetWindowMinimumSize(window, 10, 10) ++ # TODO: This is not 100% safe, but in SDL2, SetWindowMinimumSize returns ++ # void, so we can't reliably detect error + assert SDL_GetError() == b"" + sdl2.SDL_GetWindowMinimumSize(window, byref(minx), byref(miny)) + assert (minx.value, miny.value) == (10, 10) +@@ -549,8 +546,11 @@ def test_SDL_GetSetWindowMaximumSize(window): + maxx, maxy = c_int(0), c_int(0) + sdl2.SDL_GetWindowSize(window, byref(sx), byref(sy)) + assert (sx.value, sy.value) == (12, 13) ++ sdl2.SDL_ClearError() + # Set and verify the maximum window size + sdl2.SDL_SetWindowMaximumSize(window, 32, 32) ++ # TODO: This is not 100% safe, but in SDL2, SetWindowMaximumSize returns ++ # void, so we can't reliably detect error + assert SDL_GetError() == b"" + sdl2.SDL_GetWindowMaximumSize(window, byref(maxx), byref(maxy)) + assert (maxx.value, maxy.value) == (32, 32) +@@ -660,7 +660,7 @@ def test_SDL_HasWindowSurface(window): + + def test_SDL_GetWindowSurface(window): + sf = sdl2.SDL_GetWindowSurface(window) +- assert SDL_GetError() == b"" ++ assert sf, _check_error_msg() + assert isinstance(sf.contents, surface.SDL_Surface) + + def test_SDL_UpdateWindowSurface(window): +@@ -857,23 +857,22 @@ def test_SDL_GL_CreateDeleteContext(with_sdl_gl): + b"OpenGL", 10, 40, 32, 24, sdl2.SDL_WINDOW_OPENGL + ) + ctx = sdl2.SDL_GL_CreateContext(window) +- assert SDL_GetError() == b"" ++ assert ctx, _check_error_msg() + sdl2.SDL_GL_DeleteContext(ctx) + ctx = sdl2.SDL_GL_CreateContext(window) +- assert SDL_GetError() == b"" ++ assert ctx, _check_error_msg() + sdl2.SDL_GL_DeleteContext(ctx) + sdl2.SDL_DestroyWindow(window) + + @pytest.mark.skipif(DRIVER_DUMMY, reason="Doesn't work with dummy driver") + def test_SDL_GL_GetProcAddress(gl_window): + procaddr = sdl2.SDL_GL_GetProcAddress(b"glGetString") +- assert SDL_GetError() == b"" +- assert procaddr is not None and int(procaddr) != 0 ++ assert procaddr is not None and int(procaddr) != 0, _check_error_msg() + + @pytest.mark.skipif(DRIVER_DUMMY, reason="Doesn't work with dummy driver") + def test_SDL_GL_ExtensionSupported(gl_window): +- assert sdl2.SDL_GL_ExtensionSupported(b"GL_EXT_bgra") +- assert SDL_GetError() == b"" ++ sdl2.SDL_ClearError() ++ assert sdl2.SDL_GL_ExtensionSupported(b"GL_EXT_bgra"), _check_error_msg() + + @pytest.mark.skipif(DRIVER_DUMMY, reason="Doesn't work with dummy driver") + def test_SDL_GL_GetSetResetAttribute(with_sdl_gl): +@@ -946,7 +945,10 @@ def test_SDL_GL_SwapWindow(gl_window): + window, ctx = gl_window + ret = sdl2.SDL_GL_MakeCurrent(window, ctx) + assert ret == 0, _check_error_msg() ++ sdl2.SDL_ClearError() + sdl2.SDL_GL_SwapWindow(window) + sdl2.SDL_GL_SwapWindow(window) + sdl2.SDL_GL_SwapWindow(window) ++ # TODO: This is not 100% safe, but in SDL2, GL_SwapWindow returns ++ # void, so we can't reliably detect error + assert SDL_GetError() == b"" diff --git a/fix-test-SDL_hid_enumerate.patch b/fix-test-SDL_hid_enumerate.patch new file mode 100644 index 0000000..7ac41d1 --- /dev/null +++ b/fix-test-SDL_hid_enumerate.patch @@ -0,0 +1,43 @@ +From d7c0604381f6cbefa2c8b51c84b879e2f927e91e Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Sat, 19 Aug 2023 23:38:36 +0100 +Subject: [PATCH] test: Don't assert that SDL_hid_enumerate doesn't set error + (#269) + +On my Linux system, enumeration succeeds, but the error indicator gets +set as a side-effect (which appears to be because the loader checks +whether the symbol exists in SDL or a direct dependency before it +dlopens libudev). + +The API of SDL_hid_enumerate does not make it possible to distinguish +between successfully returning an empty list of devices (returns NULL +with the error indicator in an undefined state) and a failure (returns +NULL with the error indicator set), and systems that run automated tests +usually don't have any HID game controllers connected, so we can't make +any meaningful use of the error indicator here. + +Helps: https://github.com/py-sdl/py-sdl2/issues/257 + +Signed-off-by: Simon McVittie +--- + sdl2/test/hidapi_test.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sdl2/test/hidapi_test.py b/sdl2/test/hidapi_test.py +index 68bb9f9..5422d42 100644 +--- a/sdl2/test/hidapi_test.py ++++ b/sdl2/test/hidapi_test.py +@@ -38,10 +38,11 @@ def test_SDL_hid_device_change_count(hidapi_setup): + + def test_SDL_hid_enumerate(hidapi_setup): + devices = sdl2.SDL_hid_enumerate(0, 0) +- assert SDL_GetError() == b"" ++ # Cannot check the error indicator here: a non-error empty list is ++ # indistinguishable from an error, and it is not guaranteed that the ++ # error indicator will not be set as a side-effect of a successful load + if devices != None: + sdl2.SDL_hid_free_enumeration(devices) +- assert SDL_GetError() == b"" + + + @pytest.mark.skip("not implemented") diff --git a/fix-tests-SDL_GetError.patch b/fix-tests-SDL_GetError.patch new file mode 100644 index 0000000..5b748d3 --- /dev/null +++ b/fix-tests-SDL_GetError.patch @@ -0,0 +1,148 @@ +From 1c865e3f751e678f3ad2d8f3fca17a0755fbeaf7 Mon Sep 17 00:00:00 2001 +From: basak +Date: Fri, 11 Aug 2023 17:52:01 +0100 +Subject: [PATCH] tests: SDL_GetError() != b'' isn't an error (#267) + +* tests: SDL_GetError() != b'' isn't an error + +In Ubuntu, we're seeing test failures of the following pattern when +moving from libsdl2 2.28.1+dfsg-1 to 2.28.2+dfsg-1: + + > assert sdl2.SDL_GetError() == b"" + E AssertionError: assert b'Unexpected ...r element crc' == b'' + E Full diff: + E - b'' + E + b'Unexpected controller element crc' + +This looks like an issue similar to that fixed in commit 8c39f40. We +should check the relevant return value, and only if it indicates failure +should we attach any particular meaning to the return value of +SDL_GetError(). + +* Add myself to AUTHORS.txt + +As instructed in #267 +--- + AUTHORS.txt | 1 + + sdl2/test/gamecontroller_test.py | 16 +++------------- + 2 files changed, 4 insertions(+), 13 deletions(-) + +diff --git a/AUTHORS.txt b/AUTHORS.txt +index 287109e..6d40500 100644 +--- a/AUTHORS.txt ++++ b/AUTHORS.txt +@@ -45,6 +45,7 @@ Thanks to everyone else for their assistance, support, fixes and improvements: + * Radomir Dopieralski + * Rob Rolls + * Robert Winkler ++* Robie Basak + * Roger Flores + * Simon McVittie + * smea lum +diff --git a/sdl2/test/gamecontroller_test.py b/sdl2/test/gamecontroller_test.py +index 7a00aac..f509a88 100644 +--- a/sdl2/test/gamecontroller_test.py ++++ b/sdl2/test/gamecontroller_test.py +@@ -51,7 +51,7 @@ def gamepads(with_sdl): + for i in range(count): + if sdl2.SDL_IsGameController(i) == SDL_TRUE: + pad = sdl2.SDL_GameControllerOpen(i) +- assert sdl2.SDL_GetError() == b"" ++ assert pad, _check_error_msg() + assert isinstance(pad.contents, sdl2.SDL_GameController) + devices.append(pad) + yield devices +@@ -133,21 +133,18 @@ def test_SDL_GameControllerMappingForGUID(with_sdl): + def test_SDL_GameControllerMapping(gamepads): + for pad in gamepads: + mapping = sdl2.SDL_GameControllerMapping(pad) +- assert SDL_GetError() == b"" + assert mapping == None or type(mapping) in (str, bytes) + + def test_SDL_IsGameController(with_sdl): + count = joystick.SDL_NumJoysticks() + for index in range(count): + ret = sdl2.SDL_IsGameController(index) +- assert sdl2.SDL_GetError() == b"" + assert ret in [SDL_TRUE, SDL_FALSE] + + def test_SDL_GameControllerNameForIndex(with_sdl): + count = joystick.SDL_NumJoysticks() + for index in range(count): + name = sdl2.SDL_GameControllerNameForIndex(index) +- assert sdl2.SDL_GetError() == b"" + assert name == None or type(name) in (str, bytes) + + @pytest.mark.skipif(sdl2.dll.version < 2231, reason="not available") +@@ -174,7 +171,7 @@ def test_SDL_GameControllerOpenClose(with_sdl): + for index in range(count): + if sdl2.SDL_IsGameController(index) == SDL_TRUE: + pad = sdl2.SDL_GameControllerOpen(index) +- assert sdl2.SDL_GetError() == b"" ++ assert pad, _check_error_msg() + assert isinstance(pad.contents, sdl2.SDL_GameController) + sdl2.SDL_GameControllerClose(pad) + +@@ -220,7 +217,6 @@ def test_SDL_GameControllerPath(gamepads): + def test_SDL_GameControllerGetType(gamepads): + for pad in gamepads: + padtype = sdl2.SDL_GameControllerGetType(pad) +- assert SDL_GetError() == b"" + assert padtype in gamepad_types + if is_virtual(pad): + assert padtype == sdl2.SDL_CONTROLLER_TYPE_VIRTUAL +@@ -244,7 +240,6 @@ def test_SDL_GameControllerSetPlayerIndex(gamepads): + def test_SDL_GameControllerGetVendor(gamepads): + for pad in gamepads: + vid = sdl2.SDL_GameControllerGetVendor(pad) +- assert SDL_GetError() == b"" + if not is_virtual(pad): + assert vid > 0 + +@@ -252,7 +247,6 @@ def test_SDL_GameControllerGetVendor(gamepads): + def test_SDL_GameControllerGetProduct(gamepads): + for pad in gamepads: + pid = sdl2.SDL_GameControllerGetProduct(pad) +- assert SDL_GetError() == b"" + if not is_virtual(pad): + assert pid > 0 + +@@ -260,21 +254,18 @@ def test_SDL_GameControllerGetProduct(gamepads): + def test_SDL_GameControllerGetProductVersion(gamepads): + for pad in gamepads: + pver = sdl2.SDL_GameControllerGetProductVersion(pad) +- assert SDL_GetError() == b"" + assert pver >= 0 + + @pytest.mark.skipif(sdl2.dll.version < 2231, reason="not available") + def test_SDL_GameControllerGetFirmwareVersion(gamepads): + for pad in gamepads: + fw_ver = sdl2.SDL_GameControllerGetFirmwareVersion(pad) +- assert SDL_GetError() == b"" + assert fw_ver >= 0 + + @pytest.mark.skipif(sdl2.dll.version < 2014, reason="not available") + def test_SDL_GameControllerGetSerial(gamepads): + for pad in gamepads: + serial = sdl2.SDL_GameControllerGetSerial(pad) +- assert SDL_GetError() == b"" + assert serial == None or type(serial) in (str, bytes) + + def test_SDL_GameControllerGetAttached(gamepads): +@@ -285,7 +276,7 @@ def test_SDL_GameControllerGetAttached(gamepads): + def test_SDL_GameControllerGetJoystick(gamepads): + for pad in gamepads: + stick = sdl2.SDL_GameControllerGetJoystick(pad) +- assert SDL_GetError() == b"" ++ assert stick, _check_error_msg() + assert isinstance(stick.contents, joystick.SDL_Joystick) + + def test_SDL_GameControllerEventState(with_sdl): +@@ -298,7 +289,6 @@ def test_SDL_GameControllerEventState(with_sdl): + def test_SDL_GameControllerUpdate(with_sdl): + # NOTE: Returns void, can't really test anything else + sdl2.SDL_GameControllerUpdate() +- assert SDL_GetError() == b"" + + def test_SDL_GameControllerGetAxisFromString(with_sdl): + expected = { diff --git a/pysdl2-0.9.17.tar.gz b/pysdl2-0.9.17.tar.gz new file mode 100644 index 0000000..064dade --- /dev/null +++ b/pysdl2-0.9.17.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48c6ef01a4eb123db5f7e46e1a1b565675755b07e615f3fe20a623c94735b52b +size 775955 diff --git a/python-PySDL2.changes b/python-PySDL2.changes new file mode 100644 index 0000000..04dcb70 --- /dev/null +++ b/python-PySDL2.changes @@ -0,0 +1,223 @@ +------------------------------------------------------------------- +Mon Apr 28 13:58:16 UTC 2025 - Matej Cepl + +- Adjust dependencies so that it builds with SDL3. + +------------------------------------------------------------------- +Tue Mar 4 15:07:23 UTC 2025 - Markéta Machová + +- 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 + +- Remove .DS_Store files from sources +- Remove not needed python_module macro definition + +------------------------------------------------------------------- +Wed Nov 2 11:58:38 UTC 2022 - Daniel Garcia + +- 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 + +- 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 don’t need to explicitly skip ANY + tests! Wow! + +------------------------------------------------------------------- +Sun Mar 20 09:55:17 UTC 2022 - Ben Greiner + +- 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 + +- 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 + +- 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 + +- 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 + +- Run through spec-cleaner + +------------------------------------------------------------------- +Tue Dec 4 12:52:49 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Tue Nov 7 18:24:56 UTC 2017 - toddrme2178@gmail.com + +- initial version diff --git a/python-PySDL2.spec b/python-PySDL2.spec new file mode 100644 index 0000000..2b75d5a --- /dev/null +++ b/python-PySDL2.spec @@ -0,0 +1,87 @@ +# +# spec file for package python-PySDL2 +# +# Copyright (c) 2025 SUSE LLC +# +# 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 +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: SDL3 >= 2.0.22 +Requires: SDL2_gfx >= 1.0.4 +Requires: SDL2_image >= 2.6.0 +Requires: SDL2_mixer >= 2.6.0 +Requires: SDL2_ttf >= 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 From 3d10e2a52daabac0ba6b7d51b8f878c2ea3d780ae6dd17c45798fe2f8c0f44c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Wed, 30 Apr 2025 06:36:52 +0000 Subject: [PATCH 2/2] - 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 --- python-PySDL2.changes | 7 ++++++- python-PySDL2.spec | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/python-PySDL2.changes b/python-PySDL2.changes index 04dcb70..12e4829 100644 --- a/python-PySDL2.changes +++ b/python-PySDL2.changes @@ -1,7 +1,12 @@ +------------------------------------------------------------------- +Wed Apr 30 00:41:39 UTC 2025 - Jan Engelhardt + +- Adjust run-time dependencies to avoid old virtual provides. + ------------------------------------------------------------------- Mon Apr 28 13:58:16 UTC 2025 - Matej Cepl -- Adjust dependencies so that it builds with SDL3. +- Adjust build-time dependencies so that it builds with SDL3. ------------------------------------------------------------------- Tue Mar 4 15:07:23 UTC 2025 - Markéta Machová diff --git a/python-PySDL2.spec b/python-PySDL2.spec index 2b75d5a..50f2de2 100644 --- a/python-PySDL2.spec +++ b/python-PySDL2.spec @@ -43,11 +43,11 @@ BuildRequires: %{python_module pytest} BuildRequires: libmpg123-0 BuildRequires: xorg-x11-server # /SECTION -Requires: SDL3 >= 2.0.22 -Requires: SDL2_gfx >= 1.0.4 -Requires: SDL2_image >= 2.6.0 -Requires: SDL2_mixer >= 2.6.0 -Requires: SDL2_ttf >= 2.20.0 +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