1 |
commit: bf899db504819b910205d5146ad862df8fae9582 |
2 |
Author: Justin Lecher <jlec <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 25 08:25:24 2015 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 25 09:24:01 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf899db5 |
7 |
|
8 |
dev-python/pillow: Backport fix for tiff image color detection |
9 |
|
10 |
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=563986 |
11 |
|
12 |
Package-Manager: portage-2.2.23 |
13 |
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org> |
14 |
|
15 |
.../pillow-3.0.0-backport-tiff-color-fix.patch | 39 ++++++++ |
16 |
dev-python/pillow/pillow-3.0.0-r1.ebuild | 101 +++++++++++++++++++++ |
17 |
2 files changed, 140 insertions(+) |
18 |
|
19 |
diff --git a/dev-python/pillow/files/pillow-3.0.0-backport-tiff-color-fix.patch b/dev-python/pillow/files/pillow-3.0.0-backport-tiff-color-fix.patch |
20 |
new file mode 100644 |
21 |
index 0000000..b5b5201 |
22 |
--- /dev/null |
23 |
+++ b/dev-python/pillow/files/pillow-3.0.0-backport-tiff-color-fix.patch |
24 |
@@ -0,0 +1,39 @@ |
25 |
+From e0cb8f945e22d4f714f1c1de3aa04b3db39c5679 Mon Sep 17 00:00:00 2001 |
26 |
+From: wiredfool <eric-github@××××××.net> |
27 |
+Date: Sat, 3 Oct 2015 22:46:01 +0100 |
28 |
+Subject: [PATCH] Flatten sampleformat to initial value, fixes #1466 |
29 |
+ |
30 |
+--- |
31 |
+ PIL/TiffImagePlugin.py | 9 +++++++-- |
32 |
+ Tests/images/copyleft.tiff | Bin 0 -> 7926 bytes |
33 |
+ Tests/test_file_tiff.py | 5 +++++ |
34 |
+ 3 files changed, 12 insertions(+), 2 deletions(-) |
35 |
+ create mode 100644 Tests/images/copyleft.tiff |
36 |
+ |
37 |
+diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py |
38 |
+index 1f97422..a84d017 100644 |
39 |
+--- a/PIL/TiffImagePlugin.py |
40 |
++++ b/PIL/TiffImagePlugin.py |
41 |
+@@ -180,8 +180,6 @@ |
42 |
+ (MM, 2, (1,), 1, (8, 8, 8, 8), (2,)): ("RGBA", "RGBA"), |
43 |
+ (II, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10 |
44 |
+ (MM, 2, (1,), 1, (8, 8, 8, 8), (999,)): ("RGBA", "RGBA"), # Corel Draw 10 |
45 |
+- (II, 2, (1, 1, 1, 1), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBA"), # OSX Grab |
46 |
+- (MM, 2, (1, 1, 1, 1), 1, (8, 8, 8, 8), (1,)): ("RGBA", "RGBA"), # OSX Grab |
47 |
+ (II, 3, (1,), 1, (1,), ()): ("P", "P;1"), |
48 |
+ (MM, 3, (1,), 1, (1,), ()): ("P", "P;1"), |
49 |
+ (II, 3, (1,), 2, (1,), ()): ("P", "P;1R"), |
50 |
+@@ -967,6 +965,13 @@ def _setup(self): |
51 |
+ print("- size:", self.size) |
52 |
+ |
53 |
+ format = self.tag_v2.get(SAMPLEFORMAT, (1,)) |
54 |
++ if len(format) > 1 and max(format) == min(format) == 1: |
55 |
++ # SAMPLEFORMAT is properly per band, so an RGB image will |
56 |
++ # be (1,1,1). But, we don't support per band pixel types, |
57 |
++ # and anything more than one band is a uint8. So, just |
58 |
++ # take the first element. Revisit this if adding support |
59 |
++ # for more exotic images. |
60 |
++ format = (1,) |
61 |
+ |
62 |
+ # mode: check photometric interpretation and bits per pixel |
63 |
+ key = ( |
64 |
|
65 |
diff --git a/dev-python/pillow/pillow-3.0.0-r1.ebuild b/dev-python/pillow/pillow-3.0.0-r1.ebuild |
66 |
new file mode 100644 |
67 |
index 0000000..4d53a59 |
68 |
--- /dev/null |
69 |
+++ b/dev-python/pillow/pillow-3.0.0-r1.ebuild |
70 |
@@ -0,0 +1,101 @@ |
71 |
+# Copyright 1999-2015 Gentoo Foundation |
72 |
+# Distributed under the terms of the GNU General Public License v2 |
73 |
+# $Id$ |
74 |
+ |
75 |
+EAPI=5 |
76 |
+ |
77 |
+PYTHON_COMPAT=( python2_7 python3_{3,4,5} pypy ) |
78 |
+PYTHON_REQ_USE='tk?' |
79 |
+ |
80 |
+inherit distutils-r1 eutils virtualx |
81 |
+ |
82 |
+MY_PN=Pillow |
83 |
+MY_P=${MY_PN}-${PV} |
84 |
+ |
85 |
+DESCRIPTION="Python Imaging Library (fork)" |
86 |
+HOMEPAGE="https://github.com/python-imaging/Pillow https://pypi.python.org/pypi/Pillow" |
87 |
+SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.zip" |
88 |
+ |
89 |
+LICENSE="HPND" |
90 |
+SLOT="0" |
91 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris" |
92 |
+IUSE="doc examples jpeg jpeg2k lcms test tiff tk truetype webp zlib" |
93 |
+ |
94 |
+REQUIRED_USE="test? ( jpeg tiff )" |
95 |
+ |
96 |
+RDEPEND=" |
97 |
+ jpeg? ( virtual/jpeg:0 ) |
98 |
+ jpeg2k? ( media-libs/openjpeg:2= ) |
99 |
+ lcms? ( media-libs/lcms:2= ) |
100 |
+ tiff? ( media-libs/tiff:0= ) |
101 |
+ truetype? ( media-libs/freetype:2= ) |
102 |
+ webp? ( media-libs/libwebp:0= ) |
103 |
+ zlib? ( sys-libs/zlib:0= )" |
104 |
+DEPEND="${RDEPEND} |
105 |
+ app-arch/unzip |
106 |
+ dev-python/setuptools[${PYTHON_USEDEP}] |
107 |
+ doc? ( |
108 |
+ dev-python/sphinx[${PYTHON_USEDEP}] |
109 |
+ dev-python/sphinx-better-theme[${PYTHON_USEDEP}] |
110 |
+ >=dev-python/sphinx_rtd_theme-0.1[${PYTHON_USEDEP}] |
111 |
+ <dev-python/sphinx_rtd_theme-0.2[${PYTHON_USEDEP}] |
112 |
+ ) |
113 |
+ test? ( dev-python/nose[${PYTHON_USEDEP}] ) |
114 |
+ " |
115 |
+RDEPEND+=" !dev-python/imaging" |
116 |
+ |
117 |
+S="${WORKDIR}/${MY_P}" |
118 |
+ |
119 |
+# See _render and _clean in Tests/test_imagefont.py |
120 |
+DISTUTILS_IN_SOURCE_BUILD=1 |
121 |
+ |
122 |
+PATCHES=( |
123 |
+ "${FILESDIR}"/${P}-tests.patch |
124 |
+ "${FILESDIR}"/${P}-backport-tiff-color-fix.patch |
125 |
+ ) |
126 |
+ |
127 |
+python_prepare_all() { |
128 |
+ # Disable all the stuff we don't want. |
129 |
+ local f |
130 |
+ for f in jpeg lcms tiff tk webp zlib; do |
131 |
+ if ! use ${f}; then |
132 |
+ sed -i -e "s:feature.${f} =:& None #:" setup.py || die |
133 |
+ fi |
134 |
+ done |
135 |
+ if ! use truetype; then |
136 |
+ sed -i -e 's:feature.freetype =:& None #:' setup.py || die |
137 |
+ fi |
138 |
+ if ! use jpeg2k; then |
139 |
+ sed -i -e 's:feature.jpeg2000 =:& None #:' setup.py || die |
140 |
+ fi |
141 |
+ |
142 |
+ sed \ |
143 |
+ -e "/required/s:=.*:= set():g" \ |
144 |
+ -e "/if feature in/s:'jpeg', 'libz'::g" \ |
145 |
+ -i setup.py || die |
146 |
+ |
147 |
+ distutils-r1_python_prepare_all |
148 |
+} |
149 |
+ |
150 |
+python_compile_all() { |
151 |
+ use doc && emake -C docs html |
152 |
+} |
153 |
+ |
154 |
+python_test() { |
155 |
+ "${PYTHON}" selftest.py --installed || die "selftest failed with ${EPYTHON}" |
156 |
+ VIRTUALX_COMMAND=nosetests |
157 |
+ virtualmake -vx Tests/test_*.py || die "Testing failed with ${EPYTHON}" |
158 |
+} |
159 |
+ |
160 |
+python_install() { |
161 |
+ python_doheader libImaging/{Imaging.h,ImPlatform.h} |
162 |
+ |
163 |
+ distutils-r1_python_install |
164 |
+} |
165 |
+ |
166 |
+python_install_all() { |
167 |
+ use doc && local HTML_DOCS=( docs/_build/html/. ) |
168 |
+ use examples && local EXAMPLES=( Scripts/. ) |
169 |
+ |
170 |
+ distutils-r1_python_install_all |
171 |
+} |