ansible-later: 2.0.22 -> 2.0.23
[NixPkgs.git] / pkgs / development / python-modules / notify-py / default.nix
blob6d255424812e5f5ee46c5be0deaf8ea9e0069e2c
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , isPy3k
5 , fetchFromGitHub
6 , substituteAll
7 , alsa-utils
8 , libnotify
9 , which
10 , jeepney
11 , loguru
12 , pytest
13 , dbus
14 , coreutils
17 buildPythonPackage rec {
18   pname = "notify-py";
19   version = "0.3.3";
21   disabled = !isPy3k;
23   src = fetchFromGitHub {
24     owner = "ms7m";
25     repo = pname;
26     rev = "v${version}";
27     sha256 = "1n35adwsyhz304n4ifnsz6qzkymwhyqc8sg8d76qv5psv2xsnzlf";
28   };
30   patches = lib.optionals stdenv.isLinux [
31     # hardcode paths to aplay and notify-send
32     (substituteAll {
33       src = ./linux-paths.patch;
34       aplay = "${alsa-utils}/bin/aplay";
35       notifysend = "${libnotify}/bin/notify-send";
36     })
37   ] ++ lib.optionals stdenv.isDarwin [
38     # hardcode path to which
39     (substituteAll {
40       src = ./darwin-paths.patch;
41       which = "${which}/bin/which";
42     })
43   ];
45   propagatedBuildInputs = [
46     loguru
47   ] ++ lib.optionals stdenv.isLinux [
48     jeepney
49   ];
51   checkInputs = [
52     pytest
53   ] ++ lib.optionals stdenv.isLinux [
54     dbus
55   ];
57   checkPhase = if stdenv.isDarwin then ''
58     # Tests search for "afplay" binary which is built in to macOS and not available in nixpkgs
59     mkdir $TMP/bin
60     ln -s ${coreutils}/bin/true $TMP/bin/afplay
61     PATH="$TMP/bin:$PATH" pytest
62   '' else if stdenv.isLinux then ''
63     dbus-run-session \
64       --config-file=${dbus.daemon}/share/dbus-1/session.conf \
65       pytest
66   '' else ''
67     pytest
68   '';
70   pythonImportsCheck = [ "notifypy" ];
72   meta = with lib; {
73     description = "Cross-platform desktop notification library for Python";
74     homepage = "https://github.com/ms7m/notify-py";
75     license = licenses.mit;
76     maintainers = with maintainers; [ austinbutler dotlambda ];
77   };