Merge pull request #871 from wiredfool/windows_fixes2

Windows fixes
This commit is contained in:
Hugo 2014-08-26 09:17:23 +03:00
commit 4c26e08d8a
3 changed files with 16 additions and 5 deletions

View File

@ -49,6 +49,12 @@
#define L(rgb)\ #define L(rgb)\
((INT32) (rgb)[0]*299 + (INT32) (rgb)[1]*587 + (INT32) (rgb)[2]*114) ((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 */ /* 1 (bit) conversions */
/* ------------------- */ /* ------------------- */

View File

@ -3,7 +3,7 @@
from multiprocessing import Pool, cpu_count from multiprocessing import Pool, cpu_count
from distutils.ccompiler import CCompiler from distutils.ccompiler import CCompiler
import os import os, sys
try: try:
MAX_PROCS = int(os.environ.get('MAX_CONCURRENCY', cpu_count())) 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 return objects
# explicitly don't enable if environment says 1 processor # explicitly don't enable if environment says 1 processor
if MAX_PROCS != 1: if MAX_PROCS != 1 and not sys.platform.startswith('win'):
try: try:
# bug, only enable if we can make a Pool. see issue #790 and # bug, only enable if we can make a Pool. see issue #790 and
# http://stackoverflow.com/questions/6033599/oserror-38-errno-38-with-multiprocessing # http://stackoverflow.com/questions/6033599/oserror-38-errno-38-with-multiprocessing

View File

@ -487,6 +487,8 @@ class pil_build_ext(build_ext):
# In Google's precompiled zip it is call "libwebp": # In Google's precompiled zip it is call "libwebp":
if _find_library_file(self, "webp"): if _find_library_file(self, "webp"):
feature.webp = "webp" feature.webp = "webp"
elif _find_library_file(self, "libwebp"):
feature.webp = "libwebp"
if feature.want('webpmux'): if feature.want('webpmux'):
if (_find_include_file(self, "webp/mux.h") and 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 if (_find_library_file(self, "webpmux") and
_find_library_file(self, "webpdemux")): _find_library_file(self, "webpdemux")):
feature.webpmux = "webpmux" feature.webpmux = "webpmux"
if (_find_library_file(self, "libwebpmux") and
_find_library_file(self, "libwebpdemux")):
feature.webpmux = "libwebpmux"
for f in feature: for f in feature:
if not getattr(feature, f) and feature.require(f): if not getattr(feature, f) and feature.require(f):
@ -559,13 +564,13 @@ class pil_build_ext(build_ext):
libraries=["lcms2"] + extra)) libraries=["lcms2"] + extra))
if os.path.isfile("_webp.c") and feature.webp: if os.path.isfile("_webp.c") and feature.webp:
libs = ["webp"] libs = [feature.webp]
defs = [] defs = []
if feature.webpmux: if feature.webpmux:
defs.append(("HAVE_WEBPMUX", None)) defs.append(("HAVE_WEBPMUX", None))
libs.append("webpmux") libs.append(feature.webpmux)
libs.append("webpdemux") libs.append(feature.webpmux.replace('pmux','pdemux'))
exts.append(Extension( exts.append(Extension(
"PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs)) "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))