Gentoo Archives: gentoo-commits

From: Virgil Dupras <vdupras@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pillow/files/, dev-python/pillow/
Date: Sat, 04 Aug 2018 19:12:11
Message-Id: 1533409892.482a89fd8f11d1d04e5a1b49dacb92c53c11ca4b.vdupras@gentoo
1 commit: 482a89fd8f11d1d04e5a1b49dacb92c53c11ca4b
2 Author: Virgil Dupras <vdupras <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 4 19:10:23 2018 +0000
4 Commit: Virgil Dupras <vdupras <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 4 19:11:32 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=482a89fd
7
8 dev-python/pillow: add qt5 USE flag
9
10 Pillow has a Qt compatibility layer that is enabled depending on whether
11 PyQt is installed or not. Letting this happen can lead to unexpected
12 problems, so we add support for the qt5 flag to explicitly enable Qt
13 support. When the flag is disabled, we forcibly disable Qt support
14 through patching.
15
16 Bug: https://bugs.gentoo.org/662236
17 Package-Manager: Portage-2.3.44, Repoman-2.3.10
18
19 dev-python/pillow/files/pillow-4.3.0-no-qt.patch | 30 +++++++
20 dev-python/pillow/pillow-4.3.0-r3.ebuild | 106 +++++++++++++++++++++++
21 2 files changed, 136 insertions(+)
22
23 diff --git a/dev-python/pillow/files/pillow-4.3.0-no-qt.patch b/dev-python/pillow/files/pillow-4.3.0-no-qt.patch
24 new file mode 100644
25 index 00000000000..231c605b834
26 --- /dev/null
27 +++ b/dev-python/pillow/files/pillow-4.3.0-no-qt.patch
28 @@ -0,0 +1,30 @@
29 +diff --git a/PIL/ImageQt.py b/PIL/ImageQt.py
30 +index 36b4e1eb..ddde2cd9 100644
31 +--- a/PIL/ImageQt.py
32 ++++ b/PIL/ImageQt.py
33 +@@ -20,24 +20,7 @@ from . import Image
34 + from ._util import isPath
35 + from io import BytesIO
36 +
37 +-qt_is_installed = True
38 +-qt_version = None
39 +-try:
40 +- from PyQt5.QtGui import QImage, qRgba, QPixmap
41 +- from PyQt5.QtCore import QBuffer, QIODevice
42 +- qt_version = '5'
43 +-except (ImportError, RuntimeError):
44 +- try:
45 +- from PyQt4.QtGui import QImage, qRgba, QPixmap
46 +- from PyQt4.QtCore import QBuffer, QIODevice
47 +- qt_version = '4'
48 +- except (ImportError, RuntimeError):
49 +- try:
50 +- from PySide.QtGui import QImage, qRgba, QPixmap
51 +- from PySide.QtCore import QBuffer, QIODevice
52 +- qt_version = 'side'
53 +- except ImportError:
54 +- qt_is_installed = False
55 ++qt_is_installed = False
56 +
57 +
58 + def rgb(r, g, b, a=255):
59
60 diff --git a/dev-python/pillow/pillow-4.3.0-r3.ebuild b/dev-python/pillow/pillow-4.3.0-r3.ebuild
61 new file mode 100644
62 index 00000000000..a799e79a1d3
63 --- /dev/null
64 +++ b/dev-python/pillow/pillow-4.3.0-r3.ebuild
65 @@ -0,0 +1,106 @@
66 +# Copyright 1999-2018 Gentoo Foundation
67 +# Distributed under the terms of the GNU General Public License v2
68 +
69 +EAPI=6
70 +
71 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
72 +PYTHON_REQ_USE='tk?,threads(+)'
73 +
74 +inherit distutils-r1 eutils virtualx
75 +
76 +MY_PN=Pillow
77 +MY_P=${MY_PN}-${PV}
78 +
79 +DESCRIPTION="Python Imaging Library (fork)"
80 +HOMEPAGE="https://python-pillow.org/"
81 +SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
82 +
83 +LICENSE="HPND"
84 +SLOT="0"
85 +KEYWORDS="~amd64 ~arm64 ~x86 ~amd64-linux ~x86-linux"
86 +IUSE="doc examples imagequant jpeg jpeg2k lcms qt5 test tiff tk truetype webp zlib"
87 +
88 +REQUIRED_USE="test? ( jpeg tiff )"
89 +
90 +RDEPEND="
91 + dev-python/olefile[${PYTHON_USEDEP}]
92 + imagequant? ( media-gfx/libimagequant:0 )
93 + jpeg? ( virtual/jpeg:0 )
94 + jpeg2k? ( media-libs/openjpeg:2= )
95 + lcms? ( media-libs/lcms:2= )
96 + qt5? ( dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}] )
97 + tiff? ( media-libs/tiff:0=[jpeg,zlib] )
98 + truetype? ( media-libs/freetype:2= )
99 + webp? ( media-libs/libwebp:0= )
100 + zlib? ( sys-libs/zlib:0= )"
101 +DEPEND="${RDEPEND}
102 + dev-python/setuptools[${PYTHON_USEDEP}]
103 + doc? (
104 + dev-python/sphinx[${PYTHON_USEDEP}]
105 + dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
106 + )
107 + test? (
108 + dev-python/nose[${PYTHON_USEDEP}]
109 + media-gfx/imagemagick[png]
110 + )
111 +"
112 +
113 +S="${WORKDIR}/${MY_P}"
114 +
115 +PATCHES=(
116 + "${FILESDIR}"/pillow-4.3.0-no-scripts.patch
117 + # can be removed at v5, patch already uptream. See bug 593816.
118 + "${FILESDIR}"/pillow-4.3.0-freetype2.9-test-metrics.patch
119 +)
120 +
121 +src_prepare() {
122 + if ! use qt5; then
123 + # When we don't use qt5, we want to forcibly disable it by patching it
124 + # out. Otherwise, we might encounter unexpected problems like in
125 + # bug #662236
126 + eapply "${FILESDIR}/${PN}-4.3.0-no-qt.patch"
127 + fi
128 + eapply_user
129 +}
130 +
131 +python_configure_all() {
132 + # It's important that these flags are also passed during the install phase
133 + # as well. Make sure of that if you change the lines below. See bug 661308.
134 + mydistutilsargs=(
135 + build_ext
136 + --disable-platform-guessing
137 + $(use_enable truetype freetype)
138 + $(use_enable jpeg)
139 + $(use_enable jpeg2k jpeg2000)
140 + $(use_enable lcms)
141 + $(use_enable tiff)
142 + $(use_enable imagequant)
143 + $(use_enable webp)
144 + $(use_enable webp webpmux)
145 + $(use_enable zlib)
146 + )
147 +}
148 +
149 +python_compile_all() {
150 + use doc && emake -C docs html
151 +}
152 +
153 +python_test() {
154 + "${PYTHON}" selftest.py --installed || die "selftest failed with ${EPYTHON}"
155 + virtx nosetests -vx Tests/test_*.py
156 +}
157 +
158 +python_install() {
159 + python_doheader libImaging/*.h
160 + distutils-r1_python_install
161 +}
162 +
163 +python_install_all() {
164 + use doc && local HTML_DOCS=( docs/_build/html/. )
165 + if use examples ; then
166 + docinto examples
167 + dodoc Scripts/*
168 + docompress -x /usr/share/doc/${PF}/examples
169 + fi
170 + distutils-r1_python_install_all
171 +}