3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/pysdl2/default.nix

42 lines
1.8 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchPypi, buildPythonPackage, SDL2, SDL2_ttf, SDL2_image, SDL2_gfx, SDL2_mixer }:
2018-03-08 09:38:26 +00:00
buildPythonPackage rec {
pname = "PySDL2";
2020-07-31 09:56:45 +01:00
version = "0.9.7";
2018-03-08 09:38:26 +00:00
# The tests use OpenGL using find_library, which would have to be
# patched; also they seem to actually open X windows and test stuff
# like "screensaver disabling", which would have to be cleverly
# sandboxed. Disable for now.
doCheck = false;
src = fetchPypi {
inherit pname version;
2020-07-31 09:56:45 +01:00
sha256 = "e4fcc8aa1108e4917cb56794575ee08c2a3d9c2c52620474e3ecc8538dadf209";
2018-03-08 09:38:26 +00:00
};
# Deliberately not in propagated build inputs; users can decide
# which library they want to include.
buildInputs = [ SDL2_ttf SDL2_image SDL2_gfx SDL2_mixer ];
propagatedBuildInputs = [ SDL2 ];
patches = [ ./PySDL2-dll.patch ];
postPatch = ''
substituteInPlace sdl2/dll.py --replace \
"DLL(\"SDL2\")" "DLL('${SDL2}/lib/libSDL2${stdenv.hostPlatform.extensions.sharedLibrary}')"
substituteInPlace sdl2/sdlttf.py --replace \
"DLL(\"SDL2_ttf\")" "DLL('${SDL2_ttf}/lib/libSDL2_ttf${stdenv.hostPlatform.extensions.sharedLibrary}')"
substituteInPlace sdl2/sdlimage.py --replace \
"DLL(\"SDL2_image\")" "DLL('${SDL2_image}/lib/libSDL2_image${stdenv.hostPlatform.extensions.sharedLibrary}')"
substituteInPlace sdl2/sdlgfx.py --replace \
"DLL(\"SDL2_gfx\")" "DLL('${SDL2_gfx}/lib/libSDL2_gfx${stdenv.hostPlatform.extensions.sharedLibrary}')"
substituteInPlace sdl2/sdlmixer.py --replace \
"DLL(\"SDL2_mixer\")" "DLL('${SDL2_mixer}/lib/libSDL2_mixer${stdenv.hostPlatform.extensions.sharedLibrary}')"
'';
meta = {
description = "A wrapper around the SDL2 library and as such similar to the discontinued PySDL project";
homepage = "https://github.com/marcusva/py-sdl2";
2018-03-08 09:38:26 +00:00
license = lib.licenses.publicDomain;
maintainers = with lib.maintainers; [ pmiddend ];
};
}