From 9d00686f53296e7aafa9bd66789e7dce7367cc96 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Fri, 22 Aug 2014 16:14:48 -0700 Subject: [PATCH 1/3] backup implementation of Round for windows platforms --- libImaging/Convert.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libImaging/Convert.c b/libImaging/Convert.c index 46a6cfb72..3d9119c7f 100644 --- a/libImaging/Convert.c +++ b/libImaging/Convert.c @@ -49,6 +49,12 @@ #define L(rgb)\ ((INT32) (rgb)[0]*299 + (INT32) (rgb)[1]*587 + (INT32) (rgb)[2]*114) +#ifndef round +double round(double x) { + return floor(x+0.5); +} +#endif + /* ------------------- */ /* 1 (bit) conversions */ /* ------------------- */ From 1d58e711fede7059a9299a21f6121b9d41d44380 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Fri, 22 Aug 2014 16:15:22 -0700 Subject: [PATCH 2/3] mp is a little twitchy on windows --- mp_compile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mp_compile.py b/mp_compile.py index b7c3e7ce4..adbac7c19 100644 --- a/mp_compile.py +++ b/mp_compile.py @@ -3,7 +3,7 @@ from multiprocessing import Pool, cpu_count from distutils.ccompiler import CCompiler -import os +import os, sys try: MAX_PROCS = int(os.environ.get('MAX_CONCURRENCY', cpu_count())) @@ -50,7 +50,7 @@ def _mp_compile(self, sources, output_dir=None, macros=None, return objects # explicitly don't enable if environment says 1 processor -if MAX_PROCS != 1: +if MAX_PROCS != 1 and not sys.platform.startswith('win'): try: # bug, only enable if we can make a Pool. see issue #790 and # http://stackoverflow.com/questions/6033599/oserror-38-errno-38-with-multiprocessing From 136345a5a57afb76d15090e4ec9296659e59e003 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Fri, 22 Aug 2014 17:04:26 -0700 Subject: [PATCH 3/3] allowing for libwebp* library names --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 5cf0e5e65..8c46d7a0e 100644 --- a/setup.py +++ b/setup.py @@ -487,6 +487,8 @@ class pil_build_ext(build_ext): # In Google's precompiled zip it is call "libwebp": if _find_library_file(self, "webp"): feature.webp = "webp" + elif _find_library_file(self, "libwebp"): + feature.webp = "libwebp" if feature.want('webpmux'): if (_find_include_file(self, "webp/mux.h") and @@ -494,6 +496,9 @@ class pil_build_ext(build_ext): if (_find_library_file(self, "webpmux") and _find_library_file(self, "webpdemux")): feature.webpmux = "webpmux" + if (_find_library_file(self, "libwebpmux") and + _find_library_file(self, "libwebpdemux")): + feature.webpmux = "libwebpmux" for f in feature: if not getattr(feature, f) and feature.require(f): @@ -559,13 +564,13 @@ class pil_build_ext(build_ext): libraries=["lcms2"] + extra)) if os.path.isfile("_webp.c") and feature.webp: - libs = ["webp"] + libs = [feature.webp] defs = [] if feature.webpmux: defs.append(("HAVE_WEBPMUX", None)) - libs.append("webpmux") - libs.append("webpdemux") + libs.append(feature.webpmux) + libs.append(feature.webpmux.replace('pmux','pdemux')) exts.append(Extension( "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))