Commit 80bd21c5 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python3Packages.pygame-gui: cleanup, fix

parent 399d6c39
Loading
Loading
Loading
Loading
+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
    ];
  };
}
})