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=[ 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', 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 ]; + }; +} 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"; 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"; }; } 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 ]; + }; +} 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 ]; + }; +} 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 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b05183e99425..e7825d77fea6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4946,6 +4946,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 { }; @@ -6261,6 +6263,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 { }; @@ -6568,6 +6572,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 { }; @@ -7077,6 +7083,8 @@ in { pythonPackages = self; }); + pyrect = callPackage ../development/python-modules/pyrect { }; + pyregion = callPackage ../development/python-modules/pyregion { }; pyres = callPackage ../development/python-modules/pyres { }; @@ -7147,6 +7155,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 { }; @@ -7878,6 +7888,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 { };