pygame-sdl2: 2.1.0 -> 8.3.1.24090601; modernize derivation (#374642)

authored by 7c6f434c and committed by GitHub 670b96b9 b4df1fc7

+32 -36
+32 -36
pkgs/development/python-modules/pygame-sdl2/default.nix
··· 1 1 { 2 - lib, 3 2 buildPythonPackage, 4 - fetchurl, 5 - isPy27, 6 - renpy, 7 3 cython_0, 4 + fetchFromGitHub, 5 + lib, 6 + libjpeg, 7 + libpng, 8 + nix-update-script, 8 9 SDL2, 9 10 SDL2_image, 10 - SDL2_ttf, 11 11 SDL2_mixer, 12 - libjpeg, 13 - libpng, 12 + SDL2_ttf, 14 13 setuptools, 15 14 }: 16 - let 17 - pname = "pygame-sdl2"; 18 - version = "2.1.0"; 19 - renpy_version = renpy.base_version; 20 - in 21 15 22 - buildPythonPackage { 23 - inherit pname version; 24 - name = "${pname}-${version}-${renpy_version}"; 16 + buildPythonPackage rec { 17 + pname = "pygame-sdl2"; 18 + version = "8.3.1.24090601"; 25 19 pyproject = true; 26 20 27 - src = fetchurl { 28 - url = "https://www.renpy.org/dl/${renpy_version}/pygame_sdl2-${version}+renpy${renpy_version}.tar.gz"; 29 - hash = "sha256-bcTrdXWLTCnZQ/fP5crKIPoqJiyz+o6s0PzRChV7TQE="; 21 + src = fetchFromGitHub { 22 + owner = "renpy"; 23 + repo = "pygame_sdl2"; 24 + tag = "renpy-${version}"; 25 + hash = "sha256-0itOmDScM+4HmWTpjkln56pv+yXDPB1KIDbE6ub2Tls="; 30 26 }; 31 27 32 - # force rebuild of headers needed for install 33 - prePatch = '' 34 - rm -rf gen gen3 35 - ''; 36 - 37 - # Remove build tag which produces invaild version 38 - postPatch = '' 39 - sed -i '2d' setup.cfg 40 - ''; 41 - 42 - nativeBuildInputs = [ 43 - SDL2.dev 28 + build-system = [ 44 29 cython_0 30 + SDL2 45 31 setuptools 46 32 ]; 47 33 48 - buildInputs = [ 34 + dependencies = [ 35 + libjpeg 36 + libpng 49 37 SDL2 50 38 SDL2_image 51 - SDL2_ttf 52 39 SDL2_mixer 53 - libjpeg 54 - libpng 40 + SDL2_ttf 55 41 ]; 56 42 57 - doCheck = isPy27; # python3 tests are non-functional 43 + doCheck = true; 44 + 45 + preBuild = '' 46 + substituteInPlace setup.py --replace-fail "2.1.0" "${version}" 47 + substituteInPlace src/pygame_sdl2/version.py --replace-fail "2, 1, 0" "${ 48 + builtins.replaceStrings [ "." ] [ ", " ] version 49 + }" 50 + ''; 51 + 52 + passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=renpy-(.*)" ]; }; 58 53 59 54 meta = { 60 - description = "Reimplementation of parts of pygame API using SDL2"; 55 + description = "Reimplementation of the Pygame API using SDL2 and related libraries"; 61 56 homepage = "https://github.com/renpy/pygame_sdl2"; 62 57 license = with lib.licenses; [ 63 58 lgpl2 64 59 zlib 65 60 ]; 61 + platforms = lib.platforms.unix; 66 62 maintainers = with lib.maintainers; [ raskin ]; 67 63 }; 68 64 }