1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pillow,
7 xlib,
8 six,
9 xvfb-run,
10 setuptools,
11 gobject-introspection,
12 pygobject3,
13 gtk3,
14 libayatana-appindicator,
15}:
16
17buildPythonPackage rec {
18 pname = "pystray";
19 version = "0.19.5";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "moses-palmer";
24 repo = "pystray";
25 rev = "v${version}";
26 hash = "sha256-CZhbaXwKFrRBEomzfFPMQdMkTOl5lbgI64etfDRiRu4=";
27 };
28
29 patches = [
30 # fix test_menu_construct_from_none test case
31 # https://github.com/moses-palmer/pystray/pull/133
32 (fetchpatch {
33 url = "https://github.com/moses-palmer/pystray/commit/813007e3034d950d93a2f3e5b029611c3c9c98ad.patch";
34 hash = "sha256-m2LfZcWXSfgxb73dac21VDdMDVz3evzcCz5QjdnfM1U=";
35 })
36 ];
37
38 postPatch = ''
39 substituteInPlace setup.py \
40 --replace-fail "'sphinx >=1.3.1'" ""
41 '';
42
43 nativeBuildInputs = [
44 gobject-introspection
45 setuptools
46 ];
47
48 propagatedBuildInputs = [
49 pillow
50 xlib
51 six
52 pygobject3
53 gtk3
54 libayatana-appindicator
55 ];
56
57 nativeCheckInputs = [ xvfb-run ];
58
59 checkPhase = ''
60 rm tests/icon_tests.py # test needs user input
61
62 xvfb-run -s '-screen 0 800x600x24' python setup.py test
63 '';
64
65 meta = with lib; {
66 homepage = "https://github.com/moses-palmer/pystray";
67 description = "This library allows you to create a system tray icon";
68 license = with licenses; [
69 gpl3Plus
70 lgpl3Plus
71 ];
72 platforms = platforms.linux;
73 maintainers = with maintainers; [ jojosch ];
74 };
75}