1{
2 lib,
3 pkgs,
4 stdenv,
5 buildPythonPackage,
6 nix-update-script,
7 fetchFromGitHub,
8 setuptools,
9 pygame-ce,
10 python-i18n,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "pygame-gui";
16 version = "0613";
17 pyproject = true;
18 # nixpkgs-update: no auto update
19
20 src = fetchFromGitHub {
21 owner = "MyreMylar";
22 repo = "pygame_gui";
23 tag = "v_${version}";
24 hash = "sha256-vLDl3VcrjjWpw4hLuKmomK6EykF1VK1CGLkEqjNUQ/Q=";
25 };
26
27 nativeBuildInputs = [ setuptools ];
28
29 propagatedBuildInputs = [
30 pygame-ce
31 python-i18n
32 ];
33
34 postPatch = ''
35 substituteInPlace pygame_gui/core/utility.py \
36 --replace-fail "xsel" "${lib.getExe pkgs.xsel}"
37 '';
38
39 nativeCheckInputs = [ pytestCheckHook ];
40
41 preCheck = ''
42 export HOME=$TMPDIR
43 export SDL_VIDEODRIVER=dummy
44 '';
45
46 disabledTests =
47 [
48 # Clipboard doesn't exist in test environment
49 "test_process_event_text_ctrl_c"
50 "test_process_event_text_ctrl_v"
51 "test_process_event_text_ctrl_v_nothing"
52 "test_process_event_ctrl_v_over_limit"
53 "test_process_event_ctrl_v_at_limit"
54 "test_process_event_ctrl_v_over_limit_select_range"
55 "test_process_event_text_ctrl_v_select_range"
56 "test_process_event_text_ctrl_a"
57 "test_process_event_text_ctrl_x"
58 ]
59 ++ lib.optionals stdenv.hostPlatform.isDarwin [
60 # fails to determine "/" as an existing path
61 # https://github.com/MyreMylar/pygame_gui/issues/644
62 "test_process_event"
63 ];
64
65 disabledTestPaths = [ "tests/test_performance/test_text_performance.py" ];
66
67 passthru.updateScript = nix-update-script {
68 extraArgs = [
69 "--version-regex"
70 "v_(.*)"
71 ];
72 };
73
74 meta = with lib; {
75 description = "GUI system for pygame";
76 homepage = "https://github.com/MyreMylar/pygame_gui";
77 license = with licenses; [ mit ];
78 maintainers = with maintainers; [
79 emilytrau
80 pbsds
81 ];
82 };
83}