From 9955ecedec80099f29236341bb1d0fd678c6202a Mon Sep 17 00:00:00 2001 From: Rski Date: Tue, 21 Sep 2021 22:13:39 +0300 Subject: [PATCH] python3Packages.plyer: init at 2.0.0 (#136902) * python3Packages.plyer: init at 2.0.0 This is a dependency of the newer versions of mirage-im. * Update pkgs/development/python-modules/plyer/default.nix * python3Packages.plyer: use correct hashes for patches nix-prefetch-url works differently to fetchpatch, use the correct hashes here. Co-authored-by: Sandro Co-authored-by: Sandro --- .../python-modules/plyer/default.nix | 63 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 65 insertions(+) create mode 100644 pkgs/development/python-modules/plyer/default.nix diff --git a/pkgs/development/python-modules/plyer/default.nix b/pkgs/development/python-modules/plyer/default.nix new file mode 100644 index 000000000000..88dfd9a4a2bf --- /dev/null +++ b/pkgs/development/python-modules/plyer/default.nix @@ -0,0 +1,63 @@ +{ lib, buildPythonPackage, fetchFromGitHub, fetchpatch, keyring, mock, pytestCheckHook, stdenv }: + +buildPythonPackage rec { + pname = "plyer"; + version = "2.0.0"; + + src = fetchFromGitHub { + owner = "kivy"; + repo = pname; + rev = version; + sha256 = "15z1wpq6s69s76r6akzgg340bpc21l2r1j8270gp7i1rpnffcjwm"; + }; + + patches = [ + # fix naming of the DOCUMENTS dir + (fetchpatch { + url = "https://github.com/rski/plyer/commit/99dabb2d62248fc3ea5705c2720abf71c9fc378b.patch"; + sha256 = "sha256-bbnw0TxH4FGTso5dopzquDCjrjZAy+6CJauqi/nfstA="; + }) + # fix handling of the ~/.config/user-dirs.dir file + (fetchpatch { + url = "https://github.com/rski/plyer/commit/f803697a1fe4fb5e9c729ee6ef1997b8d64f3ccd.patch"; + sha256 = "sha256-akuh//P5puz2PwcBRXZQ4KoGk+fxi4jn2H3pTIT5M78="; + }) + ]; + + 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 ]; + + checkInputs = [ 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; { + 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 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 05773824fccb..791e6d3534b5 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5630,6 +5630,8 @@ in { ply = callPackage ../development/python-modules/ply { }; + plyer = callPackage ../development/python-modules/plyer { }; + plyfile = callPackage ../development/python-modules/plyfile { }; plyplus = callPackage ../development/python-modules/plyplus { };