From c53ae382cf87945f23745483e1c42eb3bee10b14 Mon Sep 17 00:00:00 2001 From: Matt Wobensmith Date: Mon, 28 Oct 2019 09:20:41 -0700 Subject: [PATCH 1/4] Increase mozlog to 5.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2a3ea4bc..2f021db7 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ INSTALL_REQUIRES = [ "mozdownload==1.26", "mozinfo==1.1.0", "mozinstall==2.0.0", - "mozlog==4.2.0", + "mozlog==5.0", "mozrunner==7.5.1", "mozversion==2.1.0", "mss==4.0.3", From 28edb56a934e35bb96f222c1e3486a6e6415aa72 Mon Sep 17 00:00:00 2001 From: Matt Wobensmith Date: Mon, 28 Oct 2019 11:32:39 -0700 Subject: [PATCH 2/4] Update mozrunner and mozversion libraries to latest releases --- Pipfile | 6 ++---- setup.py | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Pipfile b/Pipfile index 7dde9958..93276b3e 100644 --- a/Pipfile +++ b/Pipfile @@ -15,9 +15,8 @@ more-itertools = "==7.2.0" mozdownload = "==1.26" mozinfo = "==1.1.0" mozinstall = "==2.0.0" -mozlog = "==4.2.0" -mozrunner = "==7.5.1" -mozversion = "==2.1.0" +mozrunner = "==7.7" +mozversion = "==2.2.0" mss = "==4.0.3" numpy = "==1.17.2" opencv-python = "==4.1.1.26" @@ -31,7 +30,6 @@ pyperclip = "==1.7.0" pytesseract = "==0.3.0" pytest = "==5.1.2" python-dateutil = "==2.8.0" - # Platform dependencies xlib = {platform_system = "== 'Linux'",version = "==0.21"} diff --git a/setup.py b/setup.py index 2f021db7..0ab2da70 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import platform from setuptools import setup, find_packages PACKAGE_NAME = "moziris" -PACKAGE_VERSION = "0.7" +PACKAGE_VERSION = "0.8" INSTALL_REQUIRES = [ "bugzilla==1.0.0", @@ -19,9 +19,8 @@ INSTALL_REQUIRES = [ "mozdownload==1.26", "mozinfo==1.1.0", "mozinstall==2.0.0", - "mozlog==5.0", - "mozrunner==7.5.1", - "mozversion==2.1.0", + "mozrunner==7.7", + "mozversion==2.2.0", "mss==4.0.3", "numpy==1.17.2", "opencv-python==4.1.1.26", From 8f1a90f78a731f889458e35959f4050a2fd549d9 Mon Sep 17 00:00:00 2001 From: Anthony Hughes Date: Thu, 24 Oct 2019 14:06:39 -0700 Subject: [PATCH 3/4] Ensure Python 3.7 and dependencies are installed with win_bootstrap --- bootstrap/win_bootstrap.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bootstrap/win_bootstrap.sh b/bootstrap/win_bootstrap.sh index b73067b1..7fb6804f 100755 --- a/bootstrap/win_bootstrap.sh +++ b/bootstrap/win_bootstrap.sh @@ -103,11 +103,11 @@ if command -v python3 &>/dev/null; then echo -e "\n${GREEN} ---> Verified for specific python3.7. Skipped install. Already installed. ${NC}\n" else echo -e "${GREEN} ---> Update to Python 3.7 . ${NC}\n" - powershell -Command "scoop update python" | grep 'bucket already exists.' &> /dev/null + powershell -Command "scoop update python37" | grep 'bucket already exists.' &> /dev/null fi else echo -e "\n${GREEN} ---> Installing Python 3.7 #####${NC}\n" - powershell -Command "scoop install python" | grep 'bucket already exists.' &> /dev/null + powershell -Command "scoop install python37" | grep 'bucket already exists.' &> /dev/null if [ $? != 0 ]; then echo -e "\n${RED} ---> Python 3.7 now installed. You need to restart the terminal one more time and run the bootstrap.sh again to complete the install.${NC}\n" echo -e "\n${RED} ---> Last restart needed in order to use 'python3' and install python3 dependent packages ${NC}\n" @@ -118,8 +118,8 @@ fi echo -e "\n${GREEN} ---> installing/upgrading pipenv ${NC}\n" if command -v pipenv &>/dev/null; then - powershell -Command "pip3.7 install --upgrade pip" - powershell -Command "pip3.7 install --upgrade pipenv" + powershell -Command "pip install --upgrade pip" + powershell -Command "pip install --upgrade pipenv" else - powershell -Command "pip3.7 install pipenv" + powershell -Command "pip install pipenv" fi From cbfdfce27647d902fcf38d2df156a77f12e3af14 Mon Sep 17 00:00:00 2001 From: mwobensmith Date: Tue, 29 Oct 2019 15:16:42 -0700 Subject: [PATCH 4/4] Reinstate better screenshot logic (#636) * Reinstate better screenshot logic * Bump version to 0.8.1 --- moziris/api/screen/screenshot_image.py | 41 ++++++++++++++++++-------- setup.py | 2 +- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/moziris/api/screen/screenshot_image.py b/moziris/api/screen/screenshot_image.py index 19ea70d9..7c636001 100644 --- a/moziris/api/screen/screenshot_image.py +++ b/moziris/api/screen/screenshot_image.py @@ -101,16 +101,24 @@ class ScreenshotImage: def _region_to_image(region) -> Image or ScreenshotError: - if not OSHelper.is_linux(): - grabbed_area = _mss_screenshot(region) - else: - try: - grabbed_area = np.array( - screenshot(region=(region.x, region.y, region.width, region.height)) - ) - except (IOError, OSError): - logger.debug("Call to pyautogui.screnshot failed, using mss instead.") - grabbed_area = _mss_screenshot(region) + # On Linux, try to use pyautogui to take screenshots, and revert to mss if it fails. + # On Windows/Mac, do the reverse. + try: + if OSHelper.is_linux(): + try: + grabbed_area = _pyautogui_screenshot(region) + except ScreenshotError as e: + logger.debug(e) + grabbed_area = _mss_screenshot(region) + else: + try: + grabbed_area = _mss_screenshot(region) + except ScreenshotError as e: + logger.debug(e) + grabbed_area = _pyautogui_screenshot(region) + except ScreenshotError as e: + logger.error("Screenshot failed: %s" % e) + raise ScreenshotError("Cannot create screenshot: %s" % e) return grabbed_area @@ -130,5 +138,14 @@ def _convert_image_to_color(image): def _mss_screenshot(region): try: return np.array(_mss.grab(region)) - except Exception: - raise ScreenshotError("Unable to take screenshot.") + except Exception as e: + raise ScreenshotError("Call to _mss.grab failed: %s" % e) + + +def _pyautogui_screenshot(region): + try: + return np.array( + screenshot(region=(region.x, region.y, region.width, region.height)) + ) + except (IOError, OSError): + raise ScreenshotError("Call to pyautogui.screenshot failed.") diff --git a/setup.py b/setup.py index 0ab2da70..04d563ed 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import platform from setuptools import setup, find_packages PACKAGE_NAME = "moziris" -PACKAGE_VERSION = "0.8" +PACKAGE_VERSION = "0.8.1" INSTALL_REQUIRES = [ "bugzilla==1.0.0",