From 29990fb83db4435cfafb45cb4221546f6cc067fb Mon Sep 17 00:00:00 2001 From: lucasew Date: Sat, 4 Dec 2021 07:35:22 -0300 Subject: [PATCH] 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',