about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyautogui
diff options
context:
space:
mode:
authorlucasew <lucas59356@gmail.com>2021-12-04 07:35:22 -0300
committerlucasew <lucas59356@gmail.com>2021-12-05 15:53:35 -0300
commit29990fb83db4435cfafb45cb4221546f6cc067fb (patch)
tree1d6ee8a6e58f9eac48cba3baefc74e5175ff617f /pkgs/development/python-modules/pyautogui
parent0af9db3847e55fdb9709c1e2072fd63d3674ac68 (diff)
pyautogui: init at 0.9.53
Signed-off-by: lucasew <lucas59356@gmail.com>
Diffstat (limited to 'pkgs/development/python-modules/pyautogui')
-rw-r--r--pkgs/development/python-modules/pyautogui/default.nix59
-rw-r--r--pkgs/development/python-modules/pyautogui/fix-locateOnWindow-and-xlib.patch30
2 files changed, 89 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pyautogui/default.nix b/pkgs/development/python-modules/pyautogui/default.nix
new file mode 100644
index 0000000000000..08ab81ba93d35
--- /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 0000000000000..ef0c028922380
--- /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',