From 225330b95d0bfa9302e7fe617fbc7887d0dec974 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Thu, 15 May 2025 18:09:47 +0200 Subject: [PATCH] pygame-ce: migrate to sdl2-compat Signed-off-by: Marcin Serwin --- .../python-modules/pygame-ce/default.nix | 20 ++++++++++--------- .../pygame-ce/skip-rle-tests.patch | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch diff --git a/pkgs/development/python-modules/pygame-ce/default.nix b/pkgs/development/python-modules/pygame-ce/default.nix index 3df97d3af92d..386fd25c22c8 100644 --- a/pkgs/development/python-modules/pygame-ce/default.nix +++ b/pkgs/development/python-modules/pygame-ce/default.nix @@ -18,10 +18,10 @@ libpng, libX11, portmidi, - SDL2_classic, - SDL2_classic_image, - SDL2_classic_mixer, - SDL2_classic_ttf, + SDL2, + SDL2_image, + SDL2_mixer, + SDL2_ttf, numpy, pygame-gui, @@ -59,6 +59,8 @@ buildPythonPackage rec { ]) buildInputs ); }) + # https://github.com/libsdl-org/sdl2-compat/issues/476 + ./skip-rle-tests.patch ]; postPatch = @@ -98,10 +100,10 @@ buildPythonPackage rec { libjpeg libpng portmidi - SDL2_classic - (SDL2_classic_image.override { enableSTB = false; }) - SDL2_classic_mixer - SDL2_classic_ttf + SDL2 + (SDL2_image.override { enableSTB = false; }) + SDL2_mixer + SDL2_ttf ]; nativeCheckInputs = [ @@ -114,7 +116,7 @@ buildPythonPackage rec { env = { - SDL_CONFIG = lib.getExe' (lib.getDev SDL2_classic) "sdl2-config"; + SDL_CONFIG = lib.getExe' (lib.getDev SDL2) "sdl2-config"; } // lib.optionalAttrs stdenv.cc.isClang { NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-function-pointer-types"; diff --git a/pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch b/pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch new file mode 100644 index 000000000000..d0792e0e0e92 --- /dev/null +++ b/pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch @@ -0,0 +1,20 @@ +diff --git a/test/surface_test.py b/test/surface_test.py +index 4e4b5d4..ffc7ffb 100644 +--- a/test/surface_test.py ++++ b/test/surface_test.py +@@ -375,6 +375,7 @@ class SurfaceTypeTest(unittest.TestCase): + self.assertTrue(s1.get_flags() & pygame.RLEACCELOK) + self.assertTrue(not s2.get_flags() & pygame.RLEACCELOK) + ++ @unittest.skipIf(True, "https://github.com/libsdl-org/sdl2-compat/issues/476") + def test_solarwolf_rle_usage(self): + """Test for error/crash when calling set_colorkey() followed + by convert twice in succession. Code originally taken +@@ -403,6 +404,7 @@ class SurfaceTypeTest(unittest.TestCase): + finally: + pygame.display.quit() + ++ @unittest.skipIf(True, "https://github.com/libsdl-org/sdl2-compat/issues/476") + def test_solarwolf_rle_usage_2(self): + """Test for RLE status after setting alpha""" +