Unverified Commit 646d0f5d authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

python3Packages.pygame-ce: 2.5.6 -> 2.5.7, & more fixes (#514437)

parents c45d500b d2068665
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
  numpy,

  # optional-dependencies
  pygame,
  pygame-ce,
  pymunk,
  chess,
  rlcard,
@@ -31,16 +31,17 @@
  pytestCheckHook,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "pettingzoo";
  version = "1.25.0";
  version = "1.26.1";
  pyproject = true;
  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "Farama-Foundation";
    repo = "PettingZoo";
    tag = version;
    hash = "sha256-hQe/TMlLG//Bn8aaSo0/FPOUvOEyKfztuTIS7SMsUQ4=";
    tag = finalAttrs.version;
    hash = "sha256-WrfjkDnmir6bZvtMD7MVQKVoGvK+lutlOoNe9SNQ8jU=";
  };

  build-system = [
@@ -53,26 +54,25 @@ buildPythonPackage rec {
  ];

  optional-dependencies = {
    all = lib.concatAttrValues (lib.removeAttrs optional-dependencies [ "all" ]);
    atari = [
      # multi-agent-ale-py
      pygame
      pygame-ce
    ];
    butterfly = [
      pygame
      pygame-ce
      pymunk
    ];
    classic = [
      chess
      pygame
      pygame-ce
      rlcard
      shimmy
    ];
    mpe = [ pygame ];
    mpe = [ pygame-ce ];
    other = [ pillow ];
    sisl = [
      pybox2d
      pygame
      pygame-ce
      pymunk
      scipy
    ];
@@ -91,7 +91,7 @@ buildPythonPackage rec {

  nativeCheckInputs = [
    chess
    pygame
    pygame-ce
    pymunk
    pytest-markdown-docs
    pytest-xdist
@@ -118,8 +118,8 @@ buildPythonPackage rec {
  meta = {
    description = "API standard for multi-agent reinforcement learning environments, with popular reference environments and related utilities";
    homepage = "https://github.com/Farama-Foundation/PettingZoo";
    changelog = "https://github.com/Farama-Foundation/PettingZoo/releases/tag/${version}";
    changelog = "https://github.com/Farama-Foundation/PettingZoo/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ GaetanLepage ];
  };
}
})
+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,
@@ -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";
  };
@@ -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 = [
@@ -108,11 +134,11 @@ buildPythonPackage rec {
    (SDL2_image.override { enableSTB = false; })
    SDL2_mixer
    SDL2_ttf
    astroid
  ];

  nativeCheckInputs = [
    numpy
    writableTmpDirAsHomeHook
  ];

  preConfigure = ''
@@ -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
@@ -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;
  };
}
})
+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',
@@ -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.')
 
+43 −13
Original line number Diff line number Diff line
@@ -3,43 +3,57 @@
  pkgs,
  stdenv,
  buildPythonPackage,
  nix-update-script,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  pygame-ce,
  python-i18n,

  # tests
  pytestCheckHook,
  writableTmpDirAsHomeHook,

  # passthru
  nix-update-script,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "pygame-gui";
  version = "0614";
  pyproject = true;
  __structuredAttrs = true;
  # nixpkgs-update: no auto update

  src = fetchFromGitHub {
    owner = "MyreMylar";
    repo = "pygame_gui";
    tag = "v_${version}";
    tag = "v_${finalAttrs.version}";
    hash = "sha256-wLvWaJuXMXk7zOaSZfIpsXhQt+eCjOtlh8IRuKbR75o=";
  };

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [
    pygame-ce
    python-i18n
  ];

  postPatch = ''
    substituteInPlace pygame_gui/core/utility.py \
      --replace-fail "xsel" "${lib.getExe pkgs.xsel}"
  '';

  nativeCheckInputs = [ pytestCheckHook ];
  build-system = [
    setuptools
  ];

  dependencies = [
    pygame-ce
    python-i18n
  ];

  nativeCheckInputs = [
    pytestCheckHook
    writableTmpDirAsHomeHook
  ];

  preCheck = ''
    export HOME=$TMPDIR
    export SDL_VIDEODRIVER=dummy
  '';

@@ -54,6 +68,22 @@ buildPythonPackage rec {
    "test_process_event_text_ctrl_v_select_range"
    "test_process_event_text_ctrl_a"
    "test_process_event_text_ctrl_x"

    # Pixel-level rendering mismatches with pygame-ce 2.5.7
    "test_clear"
    "test_creation_grow_to_fit_width"
    "test_draw_ui"
    "test_on_hovered"
    "test_on_unhovered"
    "test_process_event_mouse_buttons"
    "test_set_active"
    "test_set_cursor_from_click_pos"
    "test_set_cursor_position"
    "test_set_default_text_colour"
    "test_set_inactive"
    "test_set_text"
    "test_split"
    "test_split_index"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # fails to determine "/" as an existing path
@@ -79,4 +109,4 @@ buildPythonPackage rec {
      pbsds
    ];
  };
}
})
+9 −8
Original line number Diff line number Diff line
@@ -19,18 +19,17 @@
  pytestCheckHook,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "pysdl2";
  version = "0.9.17-unstable-2025-04-03";
  version = "0.9.17-unstable-2025-11-18";
  pyproject = true;

  pythonImportsCheck = [ "sdl2" ];
  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "py-sdl";
    repo = "py-sdl2";
    rev = "6414ee1c5f4a6eb91b71f5f9e35d469eee395b9f";
    hash = "sha256-E6Jpuin4bqDkvFTaZTsTNkNQJd2e5fuTf2oLsQ71uQ0=";
    rev = "3d0672135fab3ca58e2f00c0a76b7b25cb818784";
    hash = "sha256-SgorCWZmJk13LNlTmh5Aomik14PTZdWliU3GWtkTASE=";
  };

  patches = [
@@ -72,6 +71,8 @@ buildPythonPackage rec {
    PYTHONFAULTHANDLER = "1";
  };

  pythonImportsCheck = [ "sdl2" ];

  nativeCheckInputs = [
    numpy
    pillow
@@ -91,10 +92,10 @@ buildPythonPackage rec {
  ];

  meta = {
    changelog = "https://github.com/py-sdl/py-sdl2/compare/0.9.17..${src.rev}";
    changelog = "https://github.com/py-sdl/py-sdl2/compare/0.9.17..${finalAttrs.src.rev}";
    description = "Wrapper around the SDL2 library and as such similar to the discontinued PySDL project";
    homepage = "https://github.com/py-sdl/py-sdl2";
    license = lib.licenses.publicDomain;
    maintainers = with lib.maintainers; [ pmiddend ];
  };
}
})
Loading