Merge commit '8b2e7ee48ac9317b79bb7f0053a9201ada8d7d08' into fix-issue-857

This commit is contained in:
etienne 2014-09-02 14:50:01 -04:00
commit 2b844e7872
9 changed files with 35 additions and 22 deletions

View File

@ -4,6 +4,9 @@ Changelog (Pillow)
2.6.0 (unreleased) 2.6.0 (unreleased)
------------------ ------------------
- Windows fixes #871
[wiredfool]
- Fix TGA files with image ID field #856 - Fix TGA files with image ID field #856
[megabuz] [megabuz]

View File

@ -10,6 +10,9 @@ Install::
pip install coverage nose pip install coverage nose
If you're using Python 2.6, there's one additional dependency::
pip install unittest2
Execution Execution
--------- ---------

View File

@ -4,8 +4,7 @@ import os
from PIL import Image, TiffImagePlugin from PIL import Image, TiffImagePlugin
class LibTiffTestCase(PillowTestCase):
class TestFileLibTiff(PillowTestCase):
def setUp(self): def setUp(self):
codecs = dir(Image.core) codecs = dir(Image.core)
@ -32,6 +31,8 @@ class TestFileLibTiff(PillowTestCase):
out = self.tempfile("temp.png") out = self.tempfile("temp.png")
im.save(out) im.save(out)
class TestFileLibTiff(LibTiffTestCase):
def test_g4_tiff(self): def test_g4_tiff(self):
"""Test the ordinary file path load path""" """Test the ordinary file path load path"""

View File

@ -2,12 +2,10 @@ from helper import unittest
from PIL import Image from PIL import Image
from test_file_libtiff import TestFileLibTiff from test_file_libtiff import LibTiffTestCase
class TestFileLibTiffSmall(TestFileLibTiff): class TestFileLibTiffSmall(LibTiffTestCase):
# Inherits TestFileLibTiff's setUp() and self._assert_noerr()
""" The small lena image was failing on open in the libtiff """ The small lena image was failing on open in the libtiff
decoder because the file pointer was set to the wrong place decoder because the file pointer was set to the wrong place

View File

@ -13,7 +13,7 @@ tar -xvzf openjpeg-2.1.0.tar.gz
pushd openjpeg-2.1.0 pushd openjpeg-2.1.0
cmake -DCMAKE_INSTALL_PREFIX=/usr . && make && sudo make install cmake -DCMAKE_INSTALL_PREFIX=/usr . && make -j4 && sudo make -j4 install
popd popd

View File

@ -1,18 +1,15 @@
#!/bin/bash #!/bin/bash
# install webp # install webp
if [ ! -f libwebp-0.4.1.tar.gz ]; then
if [ ! -f libwebp-0.4.0.tar.gz ]; then wget 'http://downloads.webmproject.org/releases/webp/libwebp-0.4.1.tar.gz'
wget 'https://webp.googlecode.com/files/libwebp-0.4.0.tar.gz'
fi fi
rm -r libwebp-0.4.0 rm -r libwebp-0.4.1
tar -xvzf libwebp-0.4.0.tar.gz tar -xvzf libwebp-0.4.1.tar.gz
pushd libwebp-0.4.1
pushd libwebp-0.4.0 ./configure --prefix=/usr --enable-libwebpmux --enable-libwebpdemux && make -j4 && sudo make -j4 install
./configure --prefix=/usr --enable-libwebpmux --enable-libwebpdemux && make && sudo make install
popd popd

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))