Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / pysdl2 / default.nix
blob0ab7010f09238a3c6191cdad510aa5b941e6c784
1 { stdenv, lib, substituteAll, fetchPypi, buildPythonPackage, SDL2, SDL2_ttf, SDL2_image, SDL2_gfx, SDL2_mixer }:
3 buildPythonPackage rec {
4   pname = "pysdl2";
5   version = "0.9.16";
7   # The tests use OpenGL using find_library, which would have to be
8   # patched; also they seem to actually open X windows and test stuff
9   # like "screensaver disabling", which would have to be cleverly
10   # sandboxed. Disable for now.
11   doCheck = false;
12   pythonImportsCheck = [ "sdl2" ];
14   src = fetchPypi {
15     pname = "PySDL2";
16     inherit version;
17     hash = "sha256-ECdAa62+zdMP5W6AClp2rX1ycaOuwLes94DuJqAPLUA=";
18   };
20   # Deliberately not in propagated build inputs; users can decide
21   # which library they want to include.
22   buildInputs = [ SDL2_ttf SDL2_image SDL2_gfx SDL2_mixer ];
23   propagatedBuildInputs = [ SDL2 ];
24   patches = [
25     (substituteAll ({
26       src = ./PySDL2-dll.patch;
27     } // builtins.mapAttrs (_: pkg: "${pkg}/lib/lib${pkg.pname}${stdenv.hostPlatform.extensions.sharedLibrary}") {
28       # substituteAll keys must start lowercase
29       sdl2 = SDL2;
30       sdl2_ttf = SDL2_ttf;
31       sdl2_image = SDL2_image;
32       sdl2_gfx = SDL2_gfx;
33       sdl2_mixer = SDL2_mixer;
34     }))
35   ];
37   meta = {
38     description = "A wrapper around the SDL2 library and as such similar to the discontinued PySDL project";
39     homepage = "https://github.com/marcusva/py-sdl2";
40     license = lib.licenses.publicDomain;
41     maintainers = with lib.maintainers; [ pmiddend ];
42   };