Enable jpg2k support, enable webp on s390x, fix ghostscript detection
This commit is contained in:
parent
038654736e
commit
9f4ae1ef99
89
python-imaging-Pillow_ghostscript.patch
Normal file
89
python-imaging-Pillow_ghostscript.patch
Normal file
@ -0,0 +1,89 @@
|
||||
From 82d7524add60d020a339503efe0559a11f89e238 Mon Sep 17 00:00:00 2001
|
||||
From: wiredfool <eric-github@soroos.net>
|
||||
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
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
Name: python-pillow
|
||||
Version: 2.4.0
|
||||
Release: 1%{?snap}%{?dist}
|
||||
Release: 2%{?snap}%{?dist}
|
||||
Summary: Python image processing library
|
||||
|
||||
# License: see http://www.pythonware.com/products/pil/license.htm
|
||||
@ -36,6 +36,8 @@ URL: http://python-imaging.github.com/Pillow/
|
||||
# wget --content-disposition https://github.com/python-imaging/Pillow/tarball/$commit
|
||||
Source0: https://github.com/python-imaging/Pillow/tarball/%{commit}/python-imaging-Pillow-%{version}-%{ahead}-g%{shortcommit}.tar.gz
|
||||
|
||||
# Fix ghostscript detection (upstream commit 82d7524add60d020a339503efe0559a11f89e238)
|
||||
Patch0: python-imaging-Pillow_ghostscript.patch
|
||||
|
||||
BuildRequires: tk-devel
|
||||
BuildRequires: libjpeg-devel
|
||||
@ -43,11 +45,9 @@ BuildRequires: zlib-devel
|
||||
BuildRequires: freetype-devel
|
||||
BuildRequires: lcms2-devel
|
||||
BuildRequires: sane-backends-devel
|
||||
BuildRequires: ghostscript
|
||||
# Don't build with webp support on s390* archs, see bug #962091 (s390*)
|
||||
%ifnarch s390 s390x
|
||||
# BuildRequires: ghostscript # Running test fails, see #921706#c38
|
||||
BuildRequires: openjpeg2-devel
|
||||
BuildRequires: libwebp-devel
|
||||
%endif
|
||||
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python-setuptools
|
||||
@ -56,6 +56,7 @@ BuildRequires: PyQt4
|
||||
BuildRequires: numpy
|
||||
BuildRequires: python-sphinx
|
||||
BuildRequires: python-sphinx-theme-better
|
||||
BuildRequires: python-cffi
|
||||
|
||||
%if %{with_python3}
|
||||
BuildRequires: python3-devel
|
||||
@ -65,6 +66,7 @@ BuildRequires: python3-PyQt4
|
||||
BuildRequires: python3-numpy
|
||||
BuildRequires: python3-sphinx
|
||||
BuildRequires: python3-sphinx-theme-better
|
||||
BuildRequires: python3-cffi
|
||||
%endif
|
||||
|
||||
# For EpsImagePlugin.py
|
||||
@ -206,6 +208,7 @@ PIL image wrapper for Qt.
|
||||
|
||||
%prep
|
||||
%setup -q -n python-imaging-Pillow-%{shortcommit}
|
||||
%patch0 -p1
|
||||
|
||||
%if %{with_python3}
|
||||
# Create Python 3 source tree
|
||||
@ -279,8 +282,8 @@ ln -s $PWD/Images $PWD/build/%py2_libbuilddir/Images
|
||||
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/build/%py2_libbuilddir %{__python} selftest.py
|
||||
PYTHONPATH=$PWD/build/%py2_libbuilddir %{__python} Tests/run.py
|
||||
PYTHONPATH=$PWD %{__python} selftest.py
|
||||
PYTHONPATH=$PWD %{__python} Tests/run.py
|
||||
popd
|
||||
|
||||
%if %{with_python3}
|
||||
@ -290,8 +293,8 @@ ln -s $PWD/Images $PWD/build/%py3_libbuilddir/Images
|
||||
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/build/%py3_libbuilddir %{__python3} selftest.py
|
||||
PYTHONPATH=$PWD/build/%py3_libbuilddir %{__python3} Tests/run.py
|
||||
PYTHONPATH=$PWD %{__python3} selftest.py
|
||||
PYTHONPATH=$PWD %{__python3} Tests/run.py
|
||||
popd
|
||||
popd
|
||||
%endif
|
||||
@ -357,6 +360,11 @@ popd
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Apr 17 2014 Sandro Mani <manisandro@gmail.com> - 2.4.0-2
|
||||
- Enable Jpeg2000 support
|
||||
- Enable webp support also on s390* archs, bug #962091 is now fixed
|
||||
- Add upstream patch for ghostscript detection
|
||||
|
||||
* Wed Apr 02 2014 Sandro Mani <manisandro@gmail.com> - 2.4.0-1
|
||||
- Update to 2.4.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user