summary refs log tree commit diff
path: root/pkgs/development/python-modules/plyer/default.nix
blob: 5b8bc870b838d8da6158dd64237c0f513ac6f610 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ stdenv, lib, buildPythonPackage, fetchFromGitHub, fetchpatch, keyring, mock, pytestCheckHook }:

buildPythonPackage rec {
  pname = "plyer";
  version = "2.1.0";

  src = fetchFromGitHub {
    owner = "kivy";
    repo = pname;
    rev = "refs/tags/${version}";
    sha256 = "sha256-7Icb2MVj5Uit86lRHxal6b7y9gIJ3UT2HNqpA9DYWVE=";
  };

  postPatch = ''
    rm -r examples
    # remove all the wifi stuff. Depends on a python wifi module that has not been updated since 2016
    find -iname "wifi*" -exec rm {} \;
    substituteInPlace plyer/__init__.py \
      --replace "wifi = Proxy('wifi', facades.Wifi)" "" \
      --replace "'wifi', " ""
    substituteInPlace plyer/facades/__init__.py \
      --replace "from plyer.facades.wifi import Wifi" ""
  '';

  propagatedBuildInputs = [ keyring ];

  nativeCheckInputs = [ mock pytestCheckHook ];

  pytestFlagsArray = [ "plyer/tests" ];
  disabledTests = [
    # assumes dbus is not installed, it fails and is not very robust.
    "test_notification_notifysend"
    # fails during nix-build, but I am not able to explain why.
    # The test and the API under test do work outside the nix build.
    "test_uniqueid"
  ];
  preCheck = ''
    HOME=$(mktemp -d)
    mkdir -p $HOME/.config/ $HOME/Pictures
  '';

  pythonImportsCheck = [ "plyer" ];

  meta = with lib; {
    broken = stdenv.isDarwin;
    description = "Plyer is a platform-independent api to use features commonly found on various platforms";
    homepage = "https://github.com/kivy/plyer";
    license = licenses.mit;
    maintainers = with maintainers; [ rski ];
  };
}