about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pygame/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/pygame/default.nix')
-rw-r--r--pkgs/development/python-modules/pygame/default.nix89
1 files changed, 50 insertions, 39 deletions
diff --git a/pkgs/development/python-modules/pygame/default.nix b/pkgs/development/python-modules/pygame/default.nix
index a219804f34b81..65315b3243b89 100644
--- a/pkgs/development/python-modules/pygame/default.nix
+++ b/pkgs/development/python-modules/pygame/default.nix
@@ -1,30 +1,32 @@
-{ stdenv
-, lib
-, substituteAll
-, fetchFromGitHub
-, buildPythonPackage
-, pythonOlder
-
-# build-system
-, cython
-, setuptools
-, pkg-config
-
-# native dependencies
-, AppKit
-, fontconfig
-, freetype
-, libjpeg
-, libpng
-, libX11
-, portmidi
-, SDL2
-, SDL2_image
-, SDL2_mixer
-, SDL2_ttf
-
-# tests
-, python
+{
+  stdenv,
+  lib,
+  substituteAll,
+  fetchpatch,
+  fetchFromGitHub,
+  buildPythonPackage,
+  pythonOlder,
+
+  # build-system
+  cython,
+  setuptools,
+  pkg-config,
+
+  # native dependencies
+  AppKit,
+  fontconfig,
+  freetype,
+  libjpeg,
+  libpng,
+  libX11,
+  portmidi,
+  SDL2,
+  SDL2_image,
+  SDL2_mixer,
+  SDL2_ttf,
+
+  # tests
+  python,
 }:
 
 buildPythonPackage rec {
@@ -49,18 +51,29 @@ buildPythonPackage rec {
     # Patch pygame's dependency resolution to let it find build inputs
     (substituteAll {
       src = ./fix-dependency-finding.patch;
-      buildinputs_include = builtins.toJSON (builtins.concatMap (dep: [
-        "${lib.getDev dep}/"
-        "${lib.getDev dep}/include"
-        "${lib.getDev dep}/include/SDL2"
-      ]) buildInputs);
-      buildinputs_lib = builtins.toJSON (builtins.concatMap (dep: [
-        "${lib.getLib dep}/"
-        "${lib.getLib dep}/lib"
-      ]) buildInputs);
+      buildinputs_include = builtins.toJSON (
+        builtins.concatMap (dep: [
+          "${lib.getDev dep}/"
+          "${lib.getDev dep}/include"
+          "${lib.getDev dep}/include/SDL2"
+        ]) buildInputs
+      );
+      buildinputs_lib = builtins.toJSON (
+        builtins.concatMap (dep: [
+          "${lib.getLib dep}/"
+          "${lib.getLib dep}/lib"
+        ]) buildInputs
+      );
     })
     # Skip tests that should be disabled without video driver
     ./skip-surface-tests.patch
+
+    # removes distutils unbreaking py312, part of https://github.com/pygame/pygame/pull/4211
+    (fetchpatch {
+      name = "remove-distutils.patch";
+      url = "https://github.com/pygame/pygame/commit/6038e7d6583a7a25fcc6e15387cf6240e427e5a7.patch";
+      hash = "sha256-HxcYjjhsu/Y9HiK9xDvY4X5dgWPP4XFLxdYGXC6tdWM=";
+    })
   ];
 
   postPatch = ''
@@ -86,9 +99,7 @@ buildPythonPackage rec {
     SDL2_image
     SDL2_mixer
     SDL2_ttf
-  ] ++ lib.optionals stdenv.isDarwin [
-    AppKit
-  ];
+  ] ++ lib.optionals stdenv.isDarwin [ AppKit ];
 
   preConfigure = ''
     ${python.pythonOnBuildForHost.interpreter} buildconfig/config.py