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