From e9b7f540c4dede99921f491aff5ed1078b34d82a Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Wed, 2 Jul 2014 09:33:10 +0200 Subject: [PATCH] Update to 2.5.0 --- .gitignore | 1 + python-imaging-Pillow_ghostscript.patch | 89 ---------- python-pillow.spec | 25 +-- python-pillow_openjpeg-2.1.0.patch | 213 ------------------------ python-pillow_tmpsuffix.patch | 16 -- sources | 2 +- 6 files changed, 9 insertions(+), 337 deletions(-) delete mode 100644 python-imaging-Pillow_ghostscript.patch delete mode 100644 python-pillow_openjpeg-2.1.0.patch delete mode 100644 python-pillow_tmpsuffix.patch diff --git a/.gitignore b/.gitignore index e5bd4a8..80ae596 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /python-imaging-Pillow-2.3.0-0-gb1b88cf.tar.gz /python-imaging-Pillow-2.3.1-0-gb8d4895.tar.gz /python-imaging-Pillow-2.4.0-0-g72de37c.tar.gz +/python-pillow-Pillow-2.5.0-0-g80d6137.tar.gz diff --git a/python-imaging-Pillow_ghostscript.patch b/python-imaging-Pillow_ghostscript.patch deleted file mode 100644 index 068e387..0000000 --- a/python-imaging-Pillow_ghostscript.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 82d7524add60d020a339503efe0559a11f89e238 Mon Sep 17 00:00:00 2001 -From: wiredfool -Date: Fri, 4 Apr 2014 13:33:54 -0700 -Subject: [PATCH] made has_ghostscript a method, using it from test_imagefile - ---- - PIL/EpsImagePlugin.py | 15 +++++++++++++++ - Tests/test_file_eps.py | 12 +----------- - Tests/test_imagefile.py | 6 ++++-- - 3 files changed, 20 insertions(+), 13 deletions(-) - -diff --git a/PIL/EpsImagePlugin.py b/PIL/EpsImagePlugin.py -index 8868634..4d19c1f 100644 ---- a/PIL/EpsImagePlugin.py -+++ b/PIL/EpsImagePlugin.py -@@ -50,6 +50,21 @@ - else: - gs_windows_binary = False - -+def has_ghostscript(): -+ if gs_windows_binary: -+ return True -+ if not sys.platform.startswith('win'): -+ import subprocess -+ try: -+ gs = subprocess.Popen(['gs','--version'], stdout=subprocess.PIPE) -+ gs.stdout.read() -+ return True -+ except OSError: -+ # no ghostscript -+ pass -+ return False -+ -+ - def Ghostscript(tile, size, fp, scale=1): - """Render an image using Ghostscript""" - -diff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py -index 61faa63..0041824 100644 ---- a/Tests/test_file_eps.py -+++ b/Tests/test_file_eps.py -@@ -4,19 +4,9 @@ - import sys - import io - --if not EpsImagePlugin.gs_windows_binary: -- # already checked. Not there. -+if not EpsImagePlugin.has_ghostscript(): - skip() - --if not sys.platform.startswith('win'): -- import subprocess -- try: -- gs = subprocess.Popen(['gs','--version'], stdout=subprocess.PIPE) -- gs.stdout.read() -- except OSError: -- # no ghostscript -- skip() -- - #Our two EPS test files (they are identical except for their bounding boxes) - file1 = "Tests/images/zero_bb.eps" - file2 = "Tests/images/non_zero_bb.eps" -diff --git a/Tests/test_imagefile.py b/Tests/test_imagefile.py -index 12061eb..adf282b 100644 ---- a/Tests/test_imagefile.py -+++ b/Tests/test_imagefile.py -@@ -2,6 +2,7 @@ - - from PIL import Image - from PIL import ImageFile -+from PIL import EpsImagePlugin - - codecs = dir(Image.core) - -@@ -46,8 +47,9 @@ def roundtrip(format): - assert_image_equal(*roundtrip("TGA")) - assert_image_equal(*roundtrip("PCX")) - -- im1, im2 = roundtrip("EPS") -- assert_image_similar(im1, im2.convert('L'),20) # EPS comes back in RGB -+ if EpsImagePlugin.has_ghostscript(): -+ im1, im2 = roundtrip("EPS") -+ assert_image_similar(im1, im2.convert('L'),20) # EPS comes back in RGB - - if "jpeg_encoder" in codecs: - im1, im2 = roundtrip("JPEG") # lossy compression --- -1.9.1 - diff --git a/python-pillow.spec b/python-pillow.spec index 60898cf..2077fa2 100644 --- a/python-pillow.spec +++ b/python-pillow.spec @@ -17,7 +17,7 @@ # Refer to the comment for Source0 below on how to obtain the source tarball # The saved file has format python-imaging-Pillow-$version-$ahead-g$shortcommit.tar.gz -%global commit 72de37caada5d9ff7c657ce5f4ad6f8a6a3870f0 +%global commit 80d6137c860b9322572ee1390514df1975acb2e7 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global ahead 0 @@ -27,8 +27,8 @@ %endif Name: python-pillow -Version: 2.4.0 -Release: 11%{?snap}%{?dist} +Version: 2.5.0 +Release: 1%{?snap}%{?dist} Summary: Python image processing library # License: see http://www.pythonware.com/products/pil/license.htm @@ -37,14 +37,7 @@ URL: http://python-pillow.github.io/ # Obtain the tarball for a certain commit via: # wget --content-disposition https://github.com/python-pillow/Pillow/tarball/$commit -Source0: https://github.com/python-pillow/Pillow/tarball/%{commit}/python-imaging-Pillow-%{version}-%{ahead}-g%{shortcommit}.tar.gz - -# Fix ghostscript detection (upstream commit 82d7524add60d020a339503efe0559a11f89e238) -Patch0: python-imaging-Pillow_ghostscript.patch -# Have the tempfile use a suffix with a dot -Patch1: python-pillow_tmpsuffix.patch -# openjpeg-2.1.0 compatibility -Patch2: python-pillow_openjpeg-2.1.0.patch +Source0: https://github.com/python-pillow/Pillow/tarball/%{commit}/python-pillow-Pillow-%{version}-%{ahead}-g%{shortcommit}.tar.gz BuildRequires: tk-devel BuildRequires: libjpeg-devel @@ -219,12 +212,7 @@ PIL image wrapper for Qt. %prep %setup -q -n python-imaging-Pillow-%{shortcommit} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -# Running test fails, see #921706#c38 -rm -f Tests/test_file_eps.py # jpeg2k tests fail on big endians, see #1100762 %ifarch ppc ppc64 ppc64p7 s390 s390x rm -f Tests/test_file_jpeg2k.py @@ -305,7 +293,6 @@ cp -R $PWD/Tests $PWD/build/%py2_libbuilddir/Tests cp -R $PWD/selftest.py $PWD/build/%py2_libbuilddir/selftest.py pushd build/%py2_libbuilddir PYTHONPATH=$PWD %{__python} selftest.py -PYTHONPATH=$PWD %{__python} Tests/run.py popd %if %{with_python3} @@ -316,7 +303,6 @@ cp -R $PWD/Tests $PWD/build/%py3_libbuilddir/Tests cp -R $PWD/selftest.py $PWD/build/%py3_libbuilddir/selftest.py pushd build/%py3_libbuilddir PYTHONPATH=$PWD %{__python3} selftest.py -PYTHONPATH=$PWD %{__python3} Tests/run.py popd popd %endif @@ -388,6 +374,9 @@ popd %endif %changelog +* Wed Jul 02 2014 Sandro Mani - 2.5.0-1 +- Update to 2.5.0 + * Sat Jun 07 2014 Fedora Release Engineering - 2.4.0-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild diff --git a/python-pillow_openjpeg-2.1.0.patch b/python-pillow_openjpeg-2.1.0.patch deleted file mode 100644 index 66e8e4d..0000000 --- a/python-pillow_openjpeg-2.1.0.patch +++ /dev/null @@ -1,213 +0,0 @@ -diff -rupN python-imaging-Pillow-72de37c/decode.c python-imaging-Pillow-72de37c-new/decode.c ---- python-imaging-Pillow-72de37c/decode.c 2014-04-02 00:31:55.000000000 +0200 -+++ python-imaging-Pillow-72de37c-new/decode.c 2014-05-27 14:12:58.913340062 +0200 -@@ -800,8 +800,9 @@ PyImaging_Jpeg2KDecoderNew(PyObject* sel - int reduce = 0; - int layers = 0; - int fd = -1; -- if (!PyArg_ParseTuple(args, "ss|iii", &mode, &format, -- &reduce, &layers, &fd)) -+ PY_LONG_LONG length = -1; -+ if (!PyArg_ParseTuple(args, "ss|iiiL", &mode, &format, -+ &reduce, &layers, &fd, &length)) - return NULL; - - if (strcmp(format, "j2k") == 0) -@@ -824,6 +825,7 @@ PyImaging_Jpeg2KDecoderNew(PyObject* sel - context = (JPEG2KDECODESTATE *)decoder->state.context; - - context->fd = fd; -+ context->length = (off_t)length; - context->format = codec_format; - context->reduce = reduce; - context->layers = layers; -diff -rupN python-imaging-Pillow-72de37c/libImaging/Jpeg2KDecode.c python-imaging-Pillow-72de37c-new/libImaging/Jpeg2KDecode.c ---- python-imaging-Pillow-72de37c/libImaging/Jpeg2KDecode.c 2014-04-02 00:31:55.000000000 +0200 -+++ python-imaging-Pillow-72de37c-new/libImaging/Jpeg2KDecode.c 2014-05-27 14:14:02.756806143 +0200 -@@ -517,7 +517,21 @@ j2k_decode_entry(Imaging im, ImagingCode - opj_stream_set_read_function(stream, j2k_read); - opj_stream_set_skip_function(stream, j2k_skip); - -+/* OpenJPEG 2.0 doesn't have OPJ_VERSION_MAJOR */ -+#ifndef OPJ_VERSION_MAJOR - opj_stream_set_user_data(stream, decoder); -+#else -+ opj_stream_set_user_data(stream, decoder, NULL); -+ -+ /* Hack: if we don't know the length, the largest file we can -+ possibly support is 4GB. We can't go larger than this, because -+ OpenJPEG truncates this value for the final box in the file, and -+ the box lengths in OpenJPEG are currently 32 bit. */ -+ if (context->length < 0) -+ opj_stream_set_user_data_length(stream, 0xffffffff); -+ else -+ opj_stream_set_user_data_length(stream, context->length); -+#endif - - /* Setup decompression context */ - context->error_msg = NULL; -diff -rupN python-imaging-Pillow-72de37c/libImaging/Jpeg2KEncode.c python-imaging-Pillow-72de37c-new/libImaging/Jpeg2KEncode.c ---- python-imaging-Pillow-72de37c/libImaging/Jpeg2KEncode.c 2014-04-02 00:31:55.000000000 +0200 -+++ python-imaging-Pillow-72de37c-new/libImaging/Jpeg2KEncode.c 2014-05-27 14:12:58.915340109 +0200 -@@ -259,7 +259,11 @@ j2k_encode_entry(Imaging im, ImagingCode - opj_stream_set_skip_function(stream, j2k_skip); - opj_stream_set_seek_function(stream, j2k_seek); - -+#if OPJ_VERSION_MAJOR == 2 && OPJ_VERSION_MINOR == 0 - opj_stream_set_user_data(stream, encoder); -+#else -+ opj_stream_set_user_data(stream, encoder, NULL); -+#endif - - /* Setup an opj_image */ - if (strcmp (im->mode, "L") == 0) { -diff -rupN python-imaging-Pillow-72de37c/libImaging/Jpeg2K.h python-imaging-Pillow-72de37c-new/libImaging/Jpeg2K.h ---- python-imaging-Pillow-72de37c/libImaging/Jpeg2K.h 2014-04-02 00:31:55.000000000 +0200 -+++ python-imaging-Pillow-72de37c-new/libImaging/Jpeg2K.h 2014-05-27 14:12:58.913340062 +0200 -@@ -8,7 +8,7 @@ - * Copyright (c) 2014 by Alastair Houghton - */ - --#include -+#include - - /* -------------------------------------------------------------------- */ - /* Decoder */ -@@ -20,6 +20,9 @@ typedef struct { - /* File descriptor, if available; otherwise, -1 */ - int fd; - -+ /* Length of data, if available; otherwise, -1 */ -+ off_t length; -+ - /* Specify the desired format */ - OPJ_CODEC_FORMAT format; - -diff -rupN python-imaging-Pillow-72de37c/PIL/Jpeg2KImagePlugin.py python-imaging-Pillow-72de37c-new/PIL/Jpeg2KImagePlugin.py ---- python-imaging-Pillow-72de37c/PIL/Jpeg2KImagePlugin.py 2014-04-02 00:31:55.000000000 +0200 -+++ python-imaging-Pillow-72de37c-new/PIL/Jpeg2KImagePlugin.py 2014-05-27 14:12:58.912340040 +0200 -@@ -155,15 +155,25 @@ class Jpeg2KImageFile(ImageFile.ImageFil - self.layers = 0 - - fd = -1 -+ length = -1 - - if hasattr(self.fp, "fileno"): - try: - fd = self.fp.fileno() -+ length = os.fstat(fd).st_size - except: - fd = -1 -- -+ elif hasattr(self.fp, "seek"): -+ try: -+ pos = f.tell() -+ f.seek(0, 2) -+ length = f.tell() -+ f.seek(pos, 0) -+ except: -+ length = -1 -+ - self.tile = [('jpeg2k', (0, 0) + self.size, 0, -- (self.codec, self.reduce, self.layers, fd))] -+ (self.codec, self.reduce, self.layers, fd, length))] - - def load(self): - if self.reduce: -@@ -175,7 +185,7 @@ class Jpeg2KImageFile(ImageFile.ImageFil - if self.tile: - # Update the reduce and layers settings - t = self.tile[0] -- t3 = (t[3][0], self.reduce, self.layers, t[3][3]) -+ t3 = (t[3][0], self.reduce, self.layers, t[3][3], t[3][4]) - self.tile = [(t[0], (0, 0) + self.size, t[2], t3)] - - ImageFile.ImageFile.load(self) -diff -rupN python-imaging-Pillow-72de37c/setup.py python-imaging-Pillow-72de37c-new/setup.py ---- python-imaging-Pillow-72de37c/setup.py 2014-04-02 00:31:55.000000000 +0200 -+++ python-imaging-Pillow-72de37c-new/setup.py 2014-05-27 14:12:58.916340132 +0200 -@@ -331,14 +331,23 @@ class pil_build_ext(build_ext): - _add_directory(include_dirs, "/usr/include") - - # on Windows, look for the OpenJPEG libraries in the location that -- # the official installed puts them -+ # the official installer puts them - if sys.platform == "win32": -- _add_directory(library_dirs, -- os.path.join(os.environ.get("ProgramFiles", ""), -- "OpenJPEG 2.0", "lib")) -- _add_directory(include_dirs, -- os.path.join(os.environ.get("ProgramFiles", ""), -- "OpenJPEG 2.0", "include")) -+ program_files = os.environ.get('ProgramFiles', '') -+ best_version = (0, 0) -+ best_path = None -+ for name in os.listdir(program_files): -+ if name.startswith('OpenJPEG '): -+ version = tuple([int(x) for x in name[9:].strip().split('.')]) -+ if version > best_version: -+ best_version = version -+ best_path = os.path.join(program_files, name) -+ -+ if best_path: -+ _add_directory(library_dirs, -+ os.path.join(best_path, 'lib')) -+ _add_directory(include_dirs, -+ os.path.join(best_path, 'include')) - - # - # insert new dirs *before* default libs, to avoid conflicts -@@ -369,10 +378,28 @@ class pil_build_ext(build_ext): - feature.jpeg = "libjpeg" # alternative name - - if feature.want('jpeg2000'): -- if _find_include_file(self, "openjpeg-2.0/openjpeg.h"): -- if _find_library_file(self, "openjp2"): -- feature.jpeg2000 = "openjp2" -- -+ best_version = None -+ best_path = None -+ -+ # Find the best version -+ for directory in self.compiler.include_dirs: -+ for name in os.listdir(directory): -+ if name.startswith('openjpeg-') and \ -+ os.path.isfile(os.path.join(directory, name, -+ 'openjpeg.h')): -+ version = tuple([int(x) for x in name[9:].split('.')]) -+ if best_version is None or version > best_version: -+ best_version = version -+ best_path = os.path.join(directory, name) -+ -+ if best_version and _find_library_file(self, 'openjp2'): -+ # Add the directory to the include path so we can include -+ # rather than having to cope with the versioned -+ # include path -+ _add_directory(self.compiler.include_dirs, best_path, 0) -+ feature.jpeg2000 = 'openjp2' -+ feature.openjpeg_version = '.'.join([str(x) for x in best_version]) -+ - if feature.want('tiff'): - if _find_library_file(self, "tiff"): - feature.tiff = "tiff" -@@ -566,7 +593,7 @@ class pil_build_ext(build_ext): - options = [ - (feature.tcl and feature.tk, "TKINTER"), - (feature.jpeg, "JPEG"), -- (feature.jpeg2000, "OPENJPEG (JPEG2000)"), -+ (feature.jpeg2000, "OPENJPEG (JPEG2000)", feature.openjpeg_version), - (feature.zlib, "ZLIB (PNG/ZIP)"), - (feature.tiff, "LIBTIFF"), - (feature.freetype, "FREETYPE2"), -@@ -577,7 +604,10 @@ class pil_build_ext(build_ext): - all = 1 - for option in options: - if option[0]: -- print("--- %s support available" % option[1]) -+ version = '' -+ if len(option) >= 3: -+ version = ' (%s)' % option[2] -+ print("--- %s support available%s" % (option[1], version)) - else: - print("*** %s support not available" % option[1]) - if option[1] == "TKINTER" and _tkinter: diff --git a/python-pillow_tmpsuffix.patch b/python-pillow_tmpsuffix.patch deleted file mode 100644 index b4c3d64..0000000 --- a/python-pillow_tmpsuffix.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -rupN python-imaging-Pillow-72de37c/PIL/Image.py python-imaging-Pillow-72de37c-new/PIL/Image.py ---- python-imaging-Pillow-72de37c/PIL/Image.py 2014-04-02 00:31:55.000000000 +0200 -+++ python-imaging-Pillow-72de37c-new/PIL/Image.py 2014-04-22 13:52:20.469372348 +0200 -@@ -505,8 +505,11 @@ class Image: - - def _dump(self, file=None, format=None): - import tempfile, os -+ suffix = '' -+ if format: -+ suffix = '.' + format - if not file: -- f, file = tempfile.mkstemp(format or '') -+ f, file = tempfile.mkstemp(suffix) - os.close(f) - - self.load() diff --git a/sources b/sources index c25ab4a..c70913f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3a33d124d7c25d39ee8b002a8e75ad09 python-imaging-Pillow-2.4.0-0-g72de37c.tar.gz +2c14210e5e2b4ddbebde81a002bb37e6 python-pillow-Pillow-2.5.0-0-g80d6137.tar.gz