at 22.05-pre 2.0 kB view raw
1{ lib, buildPythonPackage, fetchFromGitHub, fetchpatch, keyring, mock, pytestCheckHook }: 2 3buildPythonPackage rec { 4 pname = "plyer"; 5 version = "2.0.0"; 6 7 src = fetchFromGitHub { 8 owner = "kivy"; 9 repo = pname; 10 rev = version; 11 sha256 = "15z1wpq6s69s76r6akzgg340bpc21l2r1j8270gp7i1rpnffcjwm"; 12 }; 13 14 patches = [ 15 # fix naming of the DOCUMENTS dir 16 (fetchpatch { 17 url = "https://github.com/rski/plyer/commit/99dabb2d62248fc3ea5705c2720abf71c9fc378b.patch"; 18 sha256 = "sha256-bbnw0TxH4FGTso5dopzquDCjrjZAy+6CJauqi/nfstA="; 19 }) 20 # fix handling of the ~/.config/user-dirs.dir file 21 (fetchpatch { 22 url = "https://github.com/rski/plyer/commit/f803697a1fe4fb5e9c729ee6ef1997b8d64f3ccd.patch"; 23 sha256 = "sha256-akuh//P5puz2PwcBRXZQ4KoGk+fxi4jn2H3pTIT5M78="; 24 }) 25 ]; 26 27 postPatch = '' 28 rm -r examples 29 # remove all the wifi stuff. Depends on a python wifi module that has not been updated since 2016 30 find -iname "wifi*" -exec rm {} \; 31 substituteInPlace plyer/__init__.py \ 32 --replace "wifi = Proxy('wifi', facades.Wifi)" "" \ 33 --replace "'wifi'" "" 34 substituteInPlace plyer/facades/__init__.py \ 35 --replace "from plyer.facades.wifi import Wifi" "" 36 ''; 37 38 propagatedBuildInputs = [ keyring ]; 39 40 checkInputs = [ mock pytestCheckHook ]; 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 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}