Loading pkgs/development/python-modules/pygame-ce/default.nix +76 −50 Original line number Diff line number Diff line { stdenv, lib, replaceVars, fetchFromGitHub, stdenv, buildPythonPackage, fetchFromGitHub, replaceVars, python, pkg-config, setuptools, # build-system cython, ninja, meson-python, ninja, pyproject-metadata, nix-update-script, setuptools, sphinx, sphinx-autoapi, # nativeBuildInputs astroid, pkg-config, # buildInputs fontconfig, freetype, libjpeg, Loading @@ -23,22 +30,27 @@ SDL2_image, SDL2_mixer, SDL2_ttf, # tests numpy, astroid, writableTmpDirAsHomeHook, # passthru nix-update-script, pygame-gui, }: buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "pygame-ce"; version = "2.5.6"; version = "2.5.7"; pyproject = true; __structuredAttrs = true; src = fetchFromGitHub { owner = "pygame-community"; repo = "pygame-ce"; tag = version; hash = "sha256-0DNvAs1E6OhN6wTvbMCDt9YAEFoBZp1r7hI4GSnJUl8="; tag = finalAttrs.version; hash = "sha256-Yjs2SLgPVMOy8DCS+Pfk0fs0G//sY20jfGQNJ5rN58Q="; # Unicode files cause different checksums on HFS+ vs. other filesystems postFetch = "rm -rf $out/docs/reST"; }; Loading @@ -50,52 +62,66 @@ buildPythonPackage rec { "${lib.getDev dep}/" "${lib.getDev dep}/include" "${lib.getDev dep}/include/SDL2" ]) buildInputs ]) finalAttrs.buildInputs ); buildinputs_lib = builtins.toJSON ( builtins.concatMap (dep: [ "${lib.getLib dep}/" "${lib.getLib dep}/lib" ]) buildInputs ]) finalAttrs.buildInputs ); }) # https://github.com/pygame-community/pygame-ce/pull/3680#issuecomment-3796052119 ./skip-failing-tests.patch ]; postPatch = '' postPatch = # "pyproject-metadata!=0.9.1" was pinned due to https://github.com/pygame-community/pygame-ce/pull/3395 # cython was pinned to fix windows build hangs (pygame-community/pygame-ce/pull/3015) '' substituteInPlace pyproject.toml \ --replace-fail '"pyproject-metadata!=0.9.1",' '"pyproject-metadata",' \ --replace-fail '"meson<=1.9.1",' '"meson",' \ --replace-fail '"meson-python<=0.18.0",' '"meson-python",' \ --replace-fail '"ninja<=1.13.0",' "" \ --replace-fail '"astroid<4.0.0",' "" \ --replace-fail '"cython<=3.1.4",' '"cython",' \ --replace-fail '"sphinx<=8.2.3",' "" \ --replace-fail '"sphinx-autoapi<=3.6.0",' "" --replace-fail "meson-python<=0.18.0" "meson-python" \ --replace-fail "meson<=1.10.0" "meson" \ --replace-fail "ninja<=1.13.0" "ninja" \ --replace-fail "cython<=3.2.4" "cython" \ --replace-fail "sphinx<=8.2.3" "sphinx" \ --replace-fail "astroid<4.0.0" "astroid" \ --replace-fail "sphinx-autoapi<=3.6.0" "sphinx-autoapi" \ --replace-fail "pyproject-metadata!=0.9.1" "pyproject-metadata" '' # distutils now lives under setuptools._distutils + '' substituteInPlace buildconfig/config_{unix,darwin}.py \ --replace-fail 'from distutils' 'from setuptools._distutils' '' # Inject the path to fc-list + '' substituteInPlace src_py/sysfont.py \ --replace-fail 'path="fc-list"' 'path="${fontconfig}/bin/fc-list"' \ --replace-fail /usr/X11/bin/fc-list ${fontconfig}/bin/fc-list --replace-fail \ 'path="fc-list"' \ 'path="${lib.getExe' fontconfig "fc-list"}"' \ --replace-fail \ '/usr/X11/bin/fc-list' \ '${lib.getExe' fontconfig "fc-list"}' '' + lib.optionalString stdenv.hostPlatform.isDarwin '' # flaky + lib.optionalString stdenv.hostPlatform.isDarwin '' rm test/system_test.py substituteInPlace test/meson.build \ --replace-fail "'system_test.py'," "" ''; nativeBuildInputs = [ pkg-config build-system = [ astroid cython setuptools ninja meson-python ninja pyproject-metadata setuptools sphinx sphinx-autoapi ]; nativeBuildInputs = [ pkg-config ]; buildInputs = [ Loading @@ -108,11 +134,11 @@ buildPythonPackage rec { (SDL2_image.override { enableSTB = false; }) SDL2_mixer SDL2_ttf astroid ]; nativeCheckInputs = [ numpy writableTmpDirAsHomeHook ]; preConfigure = '' Loading @@ -127,7 +153,6 @@ buildPythonPackage rec { }; preCheck = '' export HOME=$(mktemp -d) # No audio or video device in test environment export SDL_VIDEODRIVER=dummy export SDL_AUDIODRIVER=disk Loading Loading @@ -158,18 +183,19 @@ buildPythonPackage rec { "pygame.version" ]; passthru.updateScript = nix-update-script { }; passthru.tests = { passthru = { updateScript = nix-update-script { }; tests = { inherit pygame-gui; }; }; meta = { description = "Pygame Community Edition (CE) - library for multimedia application built on SDL"; homepage = "https://pyga.me/"; changelog = "https://github.com/pygame-community/pygame-ce/releases/tag/${src.tag}"; changelog = "https://github.com/pygame-community/pygame-ce/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.lgpl21Plus; maintainers = [ lib.maintainers.pbsds ]; platforms = lib.platforms.unix; }; } }) pkgs/development/python-modules/pygame-ce/fix-dependency-finding.patch +14 −8 Original line number Diff line number Diff line diff --git a/buildconfig/config_darwin.py b/buildconfig/config_darwin.py index 9503ea70..d0d3ab6e 100644 index fdc911318..9acce8e5f 100644 --- a/buildconfig/config_darwin.py +++ b/buildconfig/config_darwin.py @@ -140,16 +140,8 @@ def main(auto_config=False): ]) @@ -138,22 +138,8 @@ def main(auto_config=False): print('Hunting dependencies...') - incdirs = ['/usr/local/include', '/opt/homebrew/include'] - incdirs.extend(['/usr/local/include/SDL2', '/opt/homebrew/include/SDL2', '/opt/local/include/SDL2']) - homebrew_prefix = '/opt/homebrew' - try: - homebrew_prefix = check_output(['brew', '--prefix'], text=True, stderr=DEVNULL).strip() - except (FileNotFoundError, CalledProcessError): - pass - - incdirs = ['/usr/local/include', f'{homebrew_prefix}/include'] - incdirs.extend(['/usr/local/include/SDL2', f'{homebrew_prefix}/include/SDL2', '/opt/local/include/SDL2']) - - incdirs.extend([ - #'/usr/X11/include', Loading @@ -15,17 +21,17 @@ index 9503ea70..d0d3ab6e 100644 - '/opt/local/include/freetype2/freetype'] - ) - #libdirs = ['/usr/local/lib', '/usr/X11/lib', '/opt/local/lib'] - libdirs = ['/usr/local/lib', '/opt/local/lib', '/opt/homebrew/lib'] - libdirs = ['/usr/local/lib', '/opt/local/lib', f'{homebrew_prefix}/lib'] + incdirs = @buildinputs_include@ + libdirs = @buildinputs_lib@ for d in DEPS: if isinstance(d, (list, tuple)): diff --git a/buildconfig/config_unix.py b/buildconfig/config_unix.py index 3eba5b5c..53cc6233 100644 index a9ebc8394..0875da6dd 100644 --- a/buildconfig/config_unix.py +++ b/buildconfig/config_unix.py @@ -240,11 +240,8 @@ def main(auto_config=False): @@ -238,11 +238,8 @@ def main(auto_config=False): if not DEPS[0].found: raise RuntimeError('Unable to run "sdl-config". Please make sure a development version of SDL is installed.') Loading Loading
pkgs/development/python-modules/pygame-ce/default.nix +76 −50 Original line number Diff line number Diff line { stdenv, lib, replaceVars, fetchFromGitHub, stdenv, buildPythonPackage, fetchFromGitHub, replaceVars, python, pkg-config, setuptools, # build-system cython, ninja, meson-python, ninja, pyproject-metadata, nix-update-script, setuptools, sphinx, sphinx-autoapi, # nativeBuildInputs astroid, pkg-config, # buildInputs fontconfig, freetype, libjpeg, Loading @@ -23,22 +30,27 @@ SDL2_image, SDL2_mixer, SDL2_ttf, # tests numpy, astroid, writableTmpDirAsHomeHook, # passthru nix-update-script, pygame-gui, }: buildPythonPackage rec { buildPythonPackage (finalAttrs: { pname = "pygame-ce"; version = "2.5.6"; version = "2.5.7"; pyproject = true; __structuredAttrs = true; src = fetchFromGitHub { owner = "pygame-community"; repo = "pygame-ce"; tag = version; hash = "sha256-0DNvAs1E6OhN6wTvbMCDt9YAEFoBZp1r7hI4GSnJUl8="; tag = finalAttrs.version; hash = "sha256-Yjs2SLgPVMOy8DCS+Pfk0fs0G//sY20jfGQNJ5rN58Q="; # Unicode files cause different checksums on HFS+ vs. other filesystems postFetch = "rm -rf $out/docs/reST"; }; Loading @@ -50,52 +62,66 @@ buildPythonPackage rec { "${lib.getDev dep}/" "${lib.getDev dep}/include" "${lib.getDev dep}/include/SDL2" ]) buildInputs ]) finalAttrs.buildInputs ); buildinputs_lib = builtins.toJSON ( builtins.concatMap (dep: [ "${lib.getLib dep}/" "${lib.getLib dep}/lib" ]) buildInputs ]) finalAttrs.buildInputs ); }) # https://github.com/pygame-community/pygame-ce/pull/3680#issuecomment-3796052119 ./skip-failing-tests.patch ]; postPatch = '' postPatch = # "pyproject-metadata!=0.9.1" was pinned due to https://github.com/pygame-community/pygame-ce/pull/3395 # cython was pinned to fix windows build hangs (pygame-community/pygame-ce/pull/3015) '' substituteInPlace pyproject.toml \ --replace-fail '"pyproject-metadata!=0.9.1",' '"pyproject-metadata",' \ --replace-fail '"meson<=1.9.1",' '"meson",' \ --replace-fail '"meson-python<=0.18.0",' '"meson-python",' \ --replace-fail '"ninja<=1.13.0",' "" \ --replace-fail '"astroid<4.0.0",' "" \ --replace-fail '"cython<=3.1.4",' '"cython",' \ --replace-fail '"sphinx<=8.2.3",' "" \ --replace-fail '"sphinx-autoapi<=3.6.0",' "" --replace-fail "meson-python<=0.18.0" "meson-python" \ --replace-fail "meson<=1.10.0" "meson" \ --replace-fail "ninja<=1.13.0" "ninja" \ --replace-fail "cython<=3.2.4" "cython" \ --replace-fail "sphinx<=8.2.3" "sphinx" \ --replace-fail "astroid<4.0.0" "astroid" \ --replace-fail "sphinx-autoapi<=3.6.0" "sphinx-autoapi" \ --replace-fail "pyproject-metadata!=0.9.1" "pyproject-metadata" '' # distutils now lives under setuptools._distutils + '' substituteInPlace buildconfig/config_{unix,darwin}.py \ --replace-fail 'from distutils' 'from setuptools._distutils' '' # Inject the path to fc-list + '' substituteInPlace src_py/sysfont.py \ --replace-fail 'path="fc-list"' 'path="${fontconfig}/bin/fc-list"' \ --replace-fail /usr/X11/bin/fc-list ${fontconfig}/bin/fc-list --replace-fail \ 'path="fc-list"' \ 'path="${lib.getExe' fontconfig "fc-list"}"' \ --replace-fail \ '/usr/X11/bin/fc-list' \ '${lib.getExe' fontconfig "fc-list"}' '' + lib.optionalString stdenv.hostPlatform.isDarwin '' # flaky + lib.optionalString stdenv.hostPlatform.isDarwin '' rm test/system_test.py substituteInPlace test/meson.build \ --replace-fail "'system_test.py'," "" ''; nativeBuildInputs = [ pkg-config build-system = [ astroid cython setuptools ninja meson-python ninja pyproject-metadata setuptools sphinx sphinx-autoapi ]; nativeBuildInputs = [ pkg-config ]; buildInputs = [ Loading @@ -108,11 +134,11 @@ buildPythonPackage rec { (SDL2_image.override { enableSTB = false; }) SDL2_mixer SDL2_ttf astroid ]; nativeCheckInputs = [ numpy writableTmpDirAsHomeHook ]; preConfigure = '' Loading @@ -127,7 +153,6 @@ buildPythonPackage rec { }; preCheck = '' export HOME=$(mktemp -d) # No audio or video device in test environment export SDL_VIDEODRIVER=dummy export SDL_AUDIODRIVER=disk Loading Loading @@ -158,18 +183,19 @@ buildPythonPackage rec { "pygame.version" ]; passthru.updateScript = nix-update-script { }; passthru.tests = { passthru = { updateScript = nix-update-script { }; tests = { inherit pygame-gui; }; }; meta = { description = "Pygame Community Edition (CE) - library for multimedia application built on SDL"; homepage = "https://pyga.me/"; changelog = "https://github.com/pygame-community/pygame-ce/releases/tag/${src.tag}"; changelog = "https://github.com/pygame-community/pygame-ce/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.lgpl21Plus; maintainers = [ lib.maintainers.pbsds ]; platforms = lib.platforms.unix; }; } })
pkgs/development/python-modules/pygame-ce/fix-dependency-finding.patch +14 −8 Original line number Diff line number Diff line diff --git a/buildconfig/config_darwin.py b/buildconfig/config_darwin.py index 9503ea70..d0d3ab6e 100644 index fdc911318..9acce8e5f 100644 --- a/buildconfig/config_darwin.py +++ b/buildconfig/config_darwin.py @@ -140,16 +140,8 @@ def main(auto_config=False): ]) @@ -138,22 +138,8 @@ def main(auto_config=False): print('Hunting dependencies...') - incdirs = ['/usr/local/include', '/opt/homebrew/include'] - incdirs.extend(['/usr/local/include/SDL2', '/opt/homebrew/include/SDL2', '/opt/local/include/SDL2']) - homebrew_prefix = '/opt/homebrew' - try: - homebrew_prefix = check_output(['brew', '--prefix'], text=True, stderr=DEVNULL).strip() - except (FileNotFoundError, CalledProcessError): - pass - - incdirs = ['/usr/local/include', f'{homebrew_prefix}/include'] - incdirs.extend(['/usr/local/include/SDL2', f'{homebrew_prefix}/include/SDL2', '/opt/local/include/SDL2']) - - incdirs.extend([ - #'/usr/X11/include', Loading @@ -15,17 +21,17 @@ index 9503ea70..d0d3ab6e 100644 - '/opt/local/include/freetype2/freetype'] - ) - #libdirs = ['/usr/local/lib', '/usr/X11/lib', '/opt/local/lib'] - libdirs = ['/usr/local/lib', '/opt/local/lib', '/opt/homebrew/lib'] - libdirs = ['/usr/local/lib', '/opt/local/lib', f'{homebrew_prefix}/lib'] + incdirs = @buildinputs_include@ + libdirs = @buildinputs_lib@ for d in DEPS: if isinstance(d, (list, tuple)): diff --git a/buildconfig/config_unix.py b/buildconfig/config_unix.py index 3eba5b5c..53cc6233 100644 index a9ebc8394..0875da6dd 100644 --- a/buildconfig/config_unix.py +++ b/buildconfig/config_unix.py @@ -240,11 +240,8 @@ def main(auto_config=False): @@ -238,11 +238,8 @@ def main(auto_config=False): if not DEPS[0].found: raise RuntimeError('Unable to run "sdl-config". Please make sure a development version of SDL is installed.') Loading