From 7c8bc33ec0a99cc6990784605329c3d7f6c27764 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:30:59 -0300 Subject: [PATCH 1/9] pyperclip: fix license Signed-off-by: lucasew --- pkgs/development/python-modules/pyperclip/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/pyperclip/default.nix b/pkgs/development/python-modules/pyperclip/default.nix index c04cc9eec346..7f91cc8aecce 100644 --- a/pkgs/development/python-modules/pyperclip/default.nix +++ b/pkgs/development/python-modules/pyperclip/default.nix @@ -13,7 +13,7 @@ buildPythonPackage rec { meta = with lib; { homepage = "https://github.com/asweigart/pyperclip"; - license = licenses.bsdOriginal; + license = licenses.bsd3; description = "Cross-platform clipboard module"; }; } From ee9be8a41665724b1e20a7f7d4df46556aa8520c Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:31:37 -0300 Subject: [PATCH 2/9] 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=[ From 98111a6214fcd5d3bac85cb45e17b2948875642b Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:32:34 -0300 Subject: [PATCH 3/9] pymsgbox: 1.0.6 -> 1.0.9 Signed-off-by: lucasew --- pkgs/development/python-modules/pymsgbox/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/pymsgbox/default.nix b/pkgs/development/python-modules/pymsgbox/default.nix index 84ab3dcab1bf..760a339b90af 100644 --- a/pkgs/development/python-modules/pymsgbox/default.nix +++ b/pkgs/development/python-modules/pymsgbox/default.nix @@ -2,18 +2,18 @@ buildPythonPackage rec { pname = "PyMsgBox"; - version = "1.0.6"; + version = "1.0.9"; src = fetchPypi { inherit pname version; - sha256 = "0kmd00w7p6maiyqpqqb2j8m6v2gh9c0h5i198pa02bc1c1m1321q"; - extension = "zip"; + sha256 = "sha256-IZQifei/96PW2lQYSHBaFV3LsqBu4SDZ8oCh1/USY/8="; }; propagatedBuildInputs = [ tkinter ]; # Finding tests fails doCheck = false; + pythonImportsCheck = [ "pymsgbox" ]; meta = with lib; { description = "A simple, cross-platform, pure Python module for JavaScript-like message boxes"; From 7ed4633ca3ae608b2b0d02de25f670f041b5b830 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:33:09 -0300 Subject: [PATCH 4/9] pygetwindow: init at 0.0.9 Signed-off-by: lucasew --- .../python-modules/pygetwindow/default.nix | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkgs/development/python-modules/pygetwindow/default.nix diff --git a/pkgs/development/python-modules/pygetwindow/default.nix b/pkgs/development/python-modules/pygetwindow/default.nix new file mode 100644 index 000000000000..3ca462115768 --- /dev/null +++ b/pkgs/development/python-modules/pygetwindow/default.nix @@ -0,0 +1,29 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pyrect +}: +buildPythonPackage rec { + pname = "PyGetWindow"; + version = "0.0.9"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-F4lDVefSswXNgy1xdwg4QBfBaYqQziT29/vwJC3Qpog="; + }; + + doCheck = false; + # This lib officially only works completely on Windows and partially on MacOS but pyautogui requires it + # pythonImportsCheck = [ "pygetwindow" ]; + + propagatedBuildInputs = [ + pyrect + ]; + + meta = with lib; { + description = "A simple, cross-platform module for obtaining GUI information on applications' windows."; + homepage = "https://github.com/asweigart/PyGetWindow"; + license = licenses.bsd3; + maintainers = with maintainers; [ lucasew ]; + }; +} From 11db3d404a4e4fb426f24dff6fc88af5333d405c Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:33:43 -0300 Subject: [PATCH 5/9] pyrect: init at 0.1.4 Signed-off-by: lucasew --- .../python-modules/pyrect/default.nix | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkgs/development/python-modules/pyrect/default.nix diff --git a/pkgs/development/python-modules/pyrect/default.nix b/pkgs/development/python-modules/pyrect/default.nix new file mode 100644 index 000000000000..e8041786b07b --- /dev/null +++ b/pkgs/development/python-modules/pyrect/default.nix @@ -0,0 +1,29 @@ +{ lib +, buildPythonPackage +, fetchPypi +, tox +, pytestCheckHook +, pygame +}: +buildPythonPackage rec { + pname = "PyRect"; + version = "0.1.4"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-Oy+nNTzjKhGqawoVSVlo0qdjQjyJR64ki5LAN9704gI="; + }; + + checkInputs = [ tox pytestCheckHook pygame ]; + pythonImportsCheck = [ "pyrect" ]; + preCheck = '' + export LC_ALL="en_US.UTF-8" + ''; + + meta = with lib; { + description = "Simple module with a Rect class for Pygame-like rectangular areas"; + homepage = "https://github.com/asweigart/pyrect"; + license = licenses.bsd3; + maintainers = with maintainers; [ lucasew ]; + }; +} From e52be73c2dbd7bf50f44a7e9902dec2f6d257780 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:34:15 -0300 Subject: [PATCH 6/9] pyscreeze: init at 0.1.26 Signed-off-by: lucasew --- .../python-modules/pyscreeze/default.nix | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 pkgs/development/python-modules/pyscreeze/default.nix diff --git a/pkgs/development/python-modules/pyscreeze/default.nix b/pkgs/development/python-modules/pyscreeze/default.nix new file mode 100644 index 000000000000..ddca8e72c23f --- /dev/null +++ b/pkgs/development/python-modules/pyscreeze/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pillow +, xlib +, xvfb-run +, scrot +}: +buildPythonPackage rec { + pname = "PyScreeze"; + version = "0.1.26"; + + src = fetchFromGitHub { + owner = "asweigart"; + repo = "pyscreeze"; + rev = "28ab707dceecbdd135a9491c3f8effd3a69680af"; + sha256 = "sha256-gn3ydjf/msdhIhngGlhK+jhEyFy0qGeDr58E7kM2YZs="; + }; + + pythonImportsCheck = [ "pyscreeze" ]; + checkInputs = [ scrot xlib xvfb-run ]; + checkPhase = '' + python -m unittest tests.test_pillow_unavailable + xvfb-run python -m unittest tests.test_pyscreeze + ''; + + propagatedBuildInputs = [ + pillow + ]; + + meta = with lib; { + description = "PyScreeze is a simple, cross-platform screenshot module for Python 2 and 3."; + homepage = "https://github.com/asweigart/pyscreeze"; + license = licenses.bsd3; + maintainers = with maintainers; [ lucasew ]; + }; +} From 0af9db3847e55fdb9709c1e2072fd63d3674ac68 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:34:49 -0300 Subject: [PATCH 7/9] pytweening: init at 1.0.4 Signed-off-by: lucasew --- .../python-modules/pytweening/default.nix | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pkgs/development/python-modules/pytweening/default.nix diff --git a/pkgs/development/python-modules/pytweening/default.nix b/pkgs/development/python-modules/pytweening/default.nix new file mode 100644 index 000000000000..d0ba9803063b --- /dev/null +++ b/pkgs/development/python-modules/pytweening/default.nix @@ -0,0 +1,25 @@ +{ lib +, buildPythonPackage +, fetchPypi +}: +buildPythonPackage rec { + pname = "pytweening"; + version = "1.0.4"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-hTMoLPcLMd6KBJnhz0IJMLABPHhxGIcrLsiZOCeS4uY="; + }; + + pythonImportsCheck = [ "pytweening" ]; + checkPhase = '' + python -m unittest tests.basicTests + ''; + + meta = with lib; { + description = "Set of tweening / easing functions implemented in Python"; + homepage = "https://github.com/asweigart/pytweening"; + license = licenses.bsd3; + maintainers = with maintainers; [ lucasew ]; + }; +} From 29990fb83db4435cfafb45cb4221546f6cc067fb Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:35:22 -0300 Subject: [PATCH 8/9] pyautogui: init at 0.9.53 Signed-off-by: lucasew --- .../python-modules/pyautogui/default.nix | 59 +++++++++++++++++++ .../fix-locateOnWindow-and-xlib.patch | 30 ++++++++++ 2 files changed, 89 insertions(+) create mode 100644 pkgs/development/python-modules/pyautogui/default.nix create mode 100644 pkgs/development/python-modules/pyautogui/fix-locateOnWindow-and-xlib.patch diff --git a/pkgs/development/python-modules/pyautogui/default.nix b/pkgs/development/python-modules/pyautogui/default.nix new file mode 100644 index 000000000000..08ab81ba93d3 --- /dev/null +++ b/pkgs/development/python-modules/pyautogui/default.nix @@ -0,0 +1,59 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, python3Packages +, pkgs +, fetchzip +, mouseinfo +, pygetwindow +, pymsgbox +, pyperclip +, pyrect +, pyscreeze +, pytweening +, tkinter +, xlib +, xvfb-run +, scrot +}: +buildPythonPackage rec { + pname = "pyautogui"; + version = "0.9.53"; + + src = fetchFromGitHub { + owner = "asweigart"; + repo = "pyautogui"; + rev = "5e4acb870f2e7ce0ea1927cc5188bc2f5ab7bbbc"; + sha256 = "sha256-R9tcTqxUaqw63FLOGFRaO/Oz6kD7V6MPHdQ8A29NdXw="; + }; + + checkInputs = [ xvfb-run scrot ]; + checkPhase = '' + xvfb-run python -c 'import pyautogui' + # The tests depend on some specific things that xvfb cant provide, like keyboard and mouse + # xvfb-run python -m unittest tests.test_pyautogui + ''; + + patches = [ + # https://github.com/asweigart/pyautogui/issues/598 + ./fix-locateOnWindow-and-xlib.patch + ]; + + propagatedBuildInputs = [ + mouseinfo + pygetwindow + pymsgbox + xlib + tkinter + pyperclip + pyscreeze + pytweening + ]; + + meta = with lib; { + description = "PyAutoGUI lets Python control the mouse and keyboard, and other GUI automation tasks."; + homepage = "https://github.com/asweigart/pyautogui"; + license = licenses.bsd3; + maintainers = with maintainers; [ lucasew ]; + }; +} diff --git a/pkgs/development/python-modules/pyautogui/fix-locateOnWindow-and-xlib.patch b/pkgs/development/python-modules/pyautogui/fix-locateOnWindow-and-xlib.patch new file mode 100644 index 000000000000..ef0c02892238 --- /dev/null +++ b/pkgs/development/python-modules/pyautogui/fix-locateOnWindow-and-xlib.patch @@ -0,0 +1,30 @@ +diff --git a/pyautogui/__init__.py b/pyautogui/__init__.py +index ec7d097..443b146 100644 +--- a/pyautogui/__init__.py ++++ b/pyautogui/__init__.py +@@ -216,9 +216,9 @@ try: + + @raisePyAutoGUIImageNotFoundException + def locateOnWindow(*args, **kwargs): +- return pyscreeze.locateOnWindow(*args, **kwargs) ++ return pyscreeze.locateOnScreen(*args, **kwargs) + +- locateOnWindow.__doc__ = pyscreeze.locateOnWindow.__doc__ ++ locateOnWindow.__doc__ = pyscreeze.locateOnScreen.__doc__ + + + except ImportError: +diff --git a/setup.py b/setup.py +index 196394d..6d90a88 100644 +--- a/setup.py ++++ b/setup.py +@@ -29,8 +29,7 @@ setup( + test_suite='tests', + install_requires=['pyobjc-core;platform_system=="Darwin"', + 'pyobjc;platform_system=="Darwin"', +- 'python3-Xlib;platform_system=="Linux" and python_version>="3.0"', +- 'python-xlib;platform_system=="Linux" and python_version<"3.0"', ++ 'python-xlib;platform_system=="Linux"', + 'pymsgbox', + 'PyTweening>=1.0.1', + 'pyscreeze>=0.1.21', From a3647046fee002a70a5c121101d46535afd640e0 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sun, 5 Dec 2021 09:27:46 -0300 Subject: [PATCH 9/9] add references for data a few commits behind Signed-off-by: lucasew --- pkgs/top-level/python-packages.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b97a7007ead8..5fceb2f7f424 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4854,6 +4854,8 @@ in { motor = callPackage ../development/python-modules/motor { }; + mouseinfo = callPackage ../development/python-modules/mouseinfo { }; + moviepy = callPackage ../development/python-modules/moviepy { }; mox3 = callPackage ../development/python-modules/mox3 { }; @@ -6141,6 +6143,8 @@ in { pyaudio = callPackage ../development/python-modules/pyaudio { }; + pyautogui = callPackage ../development/python-modules/pyautogui { }; + pyavm = callPackage ../development/python-modules/pyavm { }; pyaxmlparser = callPackage ../development/python-modules/pyaxmlparser { }; @@ -6436,6 +6440,8 @@ in { pygeoip = callPackage ../development/python-modules/pygeoip { }; + pygetwindow = callPackage ../development/python-modules/pygetwindow { }; + pygit2 = callPackage ../development/python-modules/pygit2 { }; PyGithub = callPackage ../development/python-modules/pyGithub { }; @@ -6939,6 +6945,8 @@ in { pythonPackages = self; }); + pyrect = callPackage ../development/python-modules/pyrect { }; + pyregion = callPackage ../development/python-modules/pyregion { }; pyres = callPackage ../development/python-modules/pyres { }; @@ -7009,6 +7017,8 @@ in { pyscreenshot = callPackage ../development/python-modules/pyscreenshot { }; + pyscreeze = callPackage ../development/python-modules/pyscreeze { }; + py_scrypt = callPackage ../development/python-modules/py_scrypt { }; pyscrypt = callPackage ../development/python-modules/pyscrypt { }; @@ -7738,6 +7748,8 @@ in { pyturbojpeg = callPackage ../development/python-modules/pyturbojpeg { }; + pytweening = callPackage ../development/python-modules/pytweening { }; + pytwitchapi = callPackage ../development/python-modules/pytwitchapi { }; pytz = callPackage ../development/python-modules/pytz { };