From dd46d2d7b4100fd518cabe4de2468868d22a1adb Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 9 Sep 2014 06:25:29 +0200 Subject: [PATCH] [DEV] remove resize image when no PIL is found (for TRAVIS building) --- lutinImage.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lutinImage.py b/lutinImage.py index e9c7cb8..04b8051 100644 --- a/lutinImage.py +++ b/lutinImage.py @@ -5,11 +5,15 @@ import platform import os import lutinMultiprocess import lutinDepend as dependency - -if platform.system() == "Darwin": - import CoreGraphics -else: - from PIL import Image +enableResizeImage = True +try: + if platform.system() == "Darwin": + import CoreGraphics + else: + from PIL import Image +except: + enableResizeImage = False + debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL") def get_pow_2_multiple(size): base = 2 @@ -22,6 +26,8 @@ def get_pow_2_multiple(size): # check if time change # check if command line change def resize(srcFile, destFile, x, y, cmd_file=None): + if enableResizeImage == False: + return if os.path.exists(srcFile) == False: debug.error("Request a resize an image that does not existed : '" + srcFile + "'") cmd_line = "resize Image : " + srcFile + " ==> " + destFile + " newSize=(" + str(x) + "x" + str(y) + ")"