Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.03 1.9 kB view raw
1{ stdenv, lib, fetchPypi, buildPythonPackage, SDL2, SDL2_ttf, SDL2_image, SDL2_gfx, SDL2_mixer }: 2 3buildPythonPackage rec { 4 pname = "PySDL2"; 5 version = "0.9.6"; 6 # The tests use OpenGL using find_library, which would have to be 7 # patched; also they seem to actually open X windows and test stuff 8 # like "screensaver disabling", which would have to be cleverly 9 # sandboxed. Disable for now. 10 doCheck = false; 11 12 src = fetchPypi { 13 inherit pname version; 14 sha256 = "08r1v9wdq8pzds4g3sng2xgh1hlzfs2z7qgy5a6b0xrs96swlamm"; 15 }; 16 17 # Deliberately not in propagated build inputs; users can decide 18 # which library they want to include. 19 buildInputs = [ SDL2_ttf SDL2_image SDL2_gfx SDL2_mixer ]; 20 propagatedBuildInputs = [ SDL2 ]; 21 patches = [ ./PySDL2-dll.patch ]; 22 postPatch = '' 23 substituteInPlace sdl2/dll.py --replace \ 24 "DLL(\"SDL2\")" "DLL('${SDL2}/lib/libSDL2${stdenv.hostPlatform.extensions.sharedLibrary}')" 25 substituteInPlace sdl2/sdlttf.py --replace \ 26 "DLL(\"SDL2_ttf\")" "DLL('${SDL2_ttf}/lib/libSDL2_ttf${stdenv.hostPlatform.extensions.sharedLibrary}')" 27 substituteInPlace sdl2/sdlimage.py --replace \ 28 "DLL(\"SDL2_image\")" "DLL('${SDL2_image}/lib/libSDL2_image${stdenv.hostPlatform.extensions.sharedLibrary}')" 29 substituteInPlace sdl2/sdlgfx.py --replace \ 30 "DLL(\"SDL2_gfx\")" "DLL('${SDL2_gfx}/lib/libSDL2_gfx${stdenv.hostPlatform.extensions.sharedLibrary}')" 31 substituteInPlace sdl2/sdlmixer.py --replace \ 32 "DLL(\"SDL2_mixer\")" "DLL('${SDL2_mixer}/lib/libSDL2_mixer${stdenv.hostPlatform.extensions.sharedLibrary}')" 33 ''; 34 35 meta = { 36 description = "A wrapper around the SDL2 library and as such similar to the discontinued PySDL project"; 37 homepage = https://github.com/marcusva/py-sdl2; 38 license = lib.licenses.publicDomain; 39 maintainers = with lib.maintainers; [ pmiddend ]; 40 }; 41}