python3Packages.pygame{,-ce}: unbreak on darwin (#401206)

This commit is contained in:
Gaétan Lepage
2025-04-25 08:43:31 +02:00
committed by GitHub
8 changed files with 59 additions and 31 deletions
@@ -0,0 +1,13 @@
{
SDL2_image,
SDL2_classic,
enableSTB ? true,
}:
(SDL2_image.override {
SDL2 = SDL2_classic;
inherit enableSTB;
}).overrideAttrs
{
pname = "SDL2_classic_image";
}
@@ -0,0 +1,11 @@
{
SDL2_mixer,
SDL2_classic,
}:
(SDL2_mixer.override {
SDL2 = SDL2_classic;
}).overrideAttrs
{
pname = "SDL2_classic_mixer";
}
@@ -0,0 +1,8 @@
{
SDL2_mixer_2_0,
SDL2_classic_mixer,
}:
SDL2_mixer_2_0.override {
SDL2_mixer = SDL2_classic_mixer;
}
@@ -0,0 +1,11 @@
{
SDL2_ttf,
SDL2_classic,
}:
(SDL2_ttf.override {
SDL2 = SDL2_classic;
}).overrideAttrs
{
pname = "SDL2_classic_ttf";
}
-6
View File
@@ -2,10 +2,7 @@
lib,
SDL2,
autoreconfHook,
darwin,
fetchurl,
giflib,
libXpm,
libjpeg,
libpng,
libtiff,
@@ -19,9 +16,6 @@
enableSdltest ? (!stdenv.hostPlatform.isDarwin),
}:
let
inherit (darwin.apple_sdk.frameworks) Foundation;
in
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_image";
version = "2.8.5";
@@ -20,9 +20,9 @@
libX11,
portmidi,
SDL2_classic,
SDL2_image,
SDL2_mixer,
SDL2_ttf,
SDL2_classic_image,
SDL2_classic_mixer_2_0,
SDL2_classic_ttf,
numpy,
pygame-gui,
@@ -100,9 +100,9 @@ buildPythonPackage rec {
libpng
portmidi
SDL2_classic
(SDL2_image.override { enableSTB = false; })
SDL2_mixer
SDL2_ttf
(SDL2_classic_image.override { enableSTB = false; })
SDL2_classic_mixer_2_0
SDL2_classic_ttf
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ AppKit ];
nativeCheckInputs = [
@@ -126,6 +126,8 @@ buildPythonPackage rec {
# No audio or video device in test environment
export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=disk
# traceback for segfaults
export PYTHONFAULTHANDLER=1
'';
checkPhase = ''
@@ -162,12 +164,5 @@ buildPythonPackage rec {
license = lib.licenses.lgpl21Plus;
maintainers = [ lib.maintainers.pbsds ];
platforms = lib.platforms.unix;
badPlatforms = [
# loading pygame.tests.font_test
# /nix/store/mrvg4qq09d51w5s95v15y4ym05q009fd-stdenv-darwin/setup: line 1771: 64131 Segmentation fault: 11
#
# https://github.com/NixOS/nixpkgs/issues/400378
lib.systems.inspect.patterns.isDarwin
];
};
}
@@ -21,9 +21,9 @@
libpng,
libX11,
portmidi,
SDL2_image,
SDL2_mixer,
SDL2_ttf,
SDL2_classic_image,
SDL2_classic_mixer,
SDL2_classic_ttf,
}:
buildPythonPackage rec {
@@ -87,9 +87,9 @@ buildPythonPackage rec {
libX11
portmidi
SDL2_classic
(SDL2_image.override { enableSTB = false; })
SDL2_mixer
SDL2_ttf
(SDL2_classic_image.override { enableSTB = false; })
SDL2_classic_mixer
SDL2_classic_ttf
];
preConfigure = ''
@@ -106,6 +106,8 @@ buildPythonPackage rec {
# No audio or video device in test environment
export SDL_VIDEODRIVER=dummy
export SDL_AUDIODRIVER=disk
# traceback for segfaults
export PYTHONFAULTHANDLER=1
${python.interpreter} -m pygame.tests -v \
--exclude opengl,timing \
@@ -122,10 +124,5 @@ buildPythonPackage rec {
license = lib.licenses.lgpl21Plus;
maintainers = with lib.maintainers; [ emilytrau ];
platforms = lib.platforms.unix;
badPlatforms = [
# Several tests segfault
# https://github.com/pygame/pygame/issues/4486
lib.systems.inspect.patterns.isDarwin
];
};
}
-1
View File
@@ -12306,7 +12306,6 @@ self: super: with self; {
pygame-ce = callPackage ../development/python-modules/pygame-ce {
inherit (pkgs.darwin.apple_sdk.frameworks) AppKit;
SDL2_mixer = pkgs.SDL2_mixer_2_0;
};
pygame-gui = callPackage ../development/python-modules/pygame-gui { };