1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 keyring,
8 mock,
9 pytestCheckHook,
10}:
11
12buildPythonPackage rec {
13 pname = "plyer";
14 version = "2.1.0";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "kivy";
19 repo = pname;
20 rev = "refs/tags/${version}";
21 sha256 = "sha256-7Icb2MVj5Uit86lRHxal6b7y9gIJ3UT2HNqpA9DYWVE=";
22 };
23
24 postPatch = ''
25 rm -r examples
26 # remove all the wifi stuff. Depends on a python wifi module that has not been updated since 2016
27 find -iname "wifi*" -exec rm {} \;
28 substituteInPlace plyer/__init__.py \
29 --replace "wifi = Proxy('wifi', facades.Wifi)" "" \
30 --replace "'wifi', " ""
31 substituteInPlace plyer/facades/__init__.py \
32 --replace "from plyer.facades.wifi import Wifi" ""
33 '';
34
35 propagatedBuildInputs = [ keyring ];
36
37 nativeCheckInputs = [
38 mock
39 pytestCheckHook
40 ];
41
42 pytestFlagsArray = [ "plyer/tests" ];
43 disabledTests = [
44 # assumes dbus is not installed, it fails and is not very robust.
45 "test_notification_notifysend"
46 # fails during nix-build, but I am not able to explain why.
47 # The test and the API under test do work outside the nix build.
48 "test_uniqueid"
49 ];
50 preCheck = ''
51 HOME=$(mktemp -d)
52 mkdir -p $HOME/.config/ $HOME/Pictures
53 '';
54
55 pythonImportsCheck = [ "plyer" ];
56
57 meta = with lib; {
58 broken = stdenv.isDarwin;
59 description = "Plyer is a platform-independent api to use features commonly found on various platforms";
60 homepage = "https://github.com/kivy/plyer";
61 license = licenses.mit;
62 maintainers = with maintainers; [ rski ];
63 };
64}