From ee9be8a41665724b1e20a7f7d4df46556aa8520c Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:31:37 -0300 Subject: [PATCH] mouseinfo: init at 0.1.3 Signed-off-by: lucasew --- .../python-modules/mouseinfo/default.nix | 40 +++++++++++++++++++ .../mouseinfo/fix-xlib-version.patch | 14 +++++++ .../mouseinfo/pillow-version.patch | 20 ++++++++++ 3 files changed, 74 insertions(+) create mode 100644 pkgs/development/python-modules/mouseinfo/default.nix create mode 100644 pkgs/development/python-modules/mouseinfo/fix-xlib-version.patch create mode 100644 pkgs/development/python-modules/mouseinfo/pillow-version.patch diff --git a/pkgs/development/python-modules/mouseinfo/default.nix b/pkgs/development/python-modules/mouseinfo/default.nix new file mode 100644 index 000000000000..5279165b2f1d --- /dev/null +++ b/pkgs/development/python-modules/mouseinfo/default.nix @@ -0,0 +1,40 @@ +{ lib +, buildPythonPackage +, pyperclip +, fetchFromGitHub +, xlib +, pillow +}: +buildPythonPackage rec { + pname = "MouseInfo"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "asweigart"; + repo = "mouseinfo"; + rev = "1876ad5cd311b4352d46bc64a12edfb4da49974e"; + sha256 = "sha256-UTaHTJE0xFihN9r+DY/WhekZ7S/CXtMFbqAayzexRxk="; + }; + + patches = [ + ./fix-xlib-version.patch + ./pillow-version.patch + ]; + + doCheck = false; + # Mouseinfo requires a X server running to import succesfully + # pythonImportsCheck = [ "mouseinfo" ]; + + propagatedBuildInputs = [ + pyperclip + xlib + pillow + ]; + + meta = with lib; { + description = "An application to display XY position and RGB color information for the pixel currently under the mouse. Works on Python 2 and 3."; + homepage = "https://github.com/asweigart/mouseinfo"; + license = licenses.gpl3; + maintainers = with maintainers; [ lucasew ]; + }; +} diff --git a/pkgs/development/python-modules/mouseinfo/fix-xlib-version.patch b/pkgs/development/python-modules/mouseinfo/fix-xlib-version.patch new file mode 100644 index 000000000000..d6bd5f71ac57 --- /dev/null +++ b/pkgs/development/python-modules/mouseinfo/fix-xlib-version.patch @@ -0,0 +1,14 @@ +diff --git a/setup.py b/setup.py +index 37d5f77..894fe78 100644 +--- a/setup.py ++++ b/setup.py +@@ -31,8 +31,7 @@ setup( + test_suite='tests', + # NOTE: Update the python_version info for Pillow as Pillow supports later versions of Python. + install_requires=['rubicon-objc;platform_system=="Darwin"', +- 'python3-Xlib;platform_system=="Linux" and python_version>="3.0"', +- 'Xlib;platform_system=="Linux" and python_version<"3.0"', ++ 'python-Xlib;platform_system=="Linux"', + 'pyperclip', + 'Pillow >= 6.2.1; python_version == "3.8"', + 'Pillow >= 5.2.0; python_version == "3.7"', diff --git a/pkgs/development/python-modules/mouseinfo/pillow-version.patch b/pkgs/development/python-modules/mouseinfo/pillow-version.patch new file mode 100644 index 000000000000..b8abb02695f4 --- /dev/null +++ b/pkgs/development/python-modules/mouseinfo/pillow-version.patch @@ -0,0 +1,20 @@ +diff --git a/setup.py b/setup.py +index 894fe78..ac580a6 100644 +--- a/setup.py ++++ b/setup.py +@@ -33,14 +33,7 @@ setup( + install_requires=['rubicon-objc;platform_system=="Darwin"', + 'python-Xlib;platform_system=="Linux"', + 'pyperclip', +- 'Pillow >= 6.2.1; python_version == "3.8"', +- 'Pillow >= 5.2.0; python_version == "3.7"', +- 'Pillow >= 4.0.0; python_version == "3.6"', +- 'Pillow >= 3.2.0; python_version == "3.5"', +- 'Pillow <= 5.4.1, >= 2.5.0; python_version == "3.4"', +- 'Pillow <= 4.3.0, >= 2.0.0; python_version == "3.3"', +- 'Pillow <= 3.4.2, >= 2.0.0; python_version == "3.2"', +- 'Pillow >= 2.0.0; python_version == "2.7"', ++ 'Pillow', + ], + keywords='', + classifiers=[