]>
Commit | Line | Data |
---|---|---|
5b18a5b3 | 1 | # NOTE: -qt supports PyQt5 > PyQt4 > PySide modules (in order of preference) |
2672936f ER |
2 | # |
3 | # bootstrap building docs (pillow is required by docutils, docutils are | |
4 | # required by sphinx; pillow build-requires sphinx) | |
2672936f ER |
5 | |
6 | # Conditional build: | |
58aa25fa JB |
7 | %bcond_with doc # Sphinx documentation (crashes - without DISPLAY?) |
8 | %bcond_without tests # unit tests | |
2672936f | 9 | %bcond_without python2 # CPython 2.x module |
6a785986 | 10 | %bcond_without python3 # CPython 3.x module |
2672936f | 11 | |
0b50aa0e | 12 | %define module pillow |
5b18a5b3 JB |
13 | Summary: Python 2 image processing library |
14 | Summary(pl.UTF-8): Biblioteka do przetwarzania obrazów dla Pythona 2 | |
2672936f | 15 | Name: python-%{module} |
b46ddc56 JB |
16 | # NOTE: keep 6.x in this spec for python 2.x support |
17 | Version: 6.2.2 | |
18 | Release: 1 | |
2672936f ER |
19 | # License: see http://www.pythonware.com/products/pil/license.htm |
20 | License: MIT | |
21 | Group: Libraries/Python | |
58aa25fa JB |
22 | #Source0Download: https://pypi.org/simple/pillow/ |
23 | Source0: https://files.pythonhosted.org/packages/source/P/Pillow/Pillow-%{version}.tar.gz | |
b46ddc56 | 24 | # Source0-md5: 46cad14f0044a5ac4b2d801271528893 |
58aa25fa JB |
25 | Patch0: %{name}-subpackage.patch |
26 | Patch1: x32.patch | |
2672936f | 27 | URL: http://python-pillow.github.io/ |
5b18a5b3 | 28 | BuildRequires: freetype-devel >= 2 |
2672936f | 29 | BuildRequires: ghostscript |
5b18a5b3 JB |
30 | BuildRequires: lcms2-devel >= 2 |
31 | BuildRequires: libimagequant-devel | |
2672936f | 32 | BuildRequires: libjpeg-devel |
5b18a5b3 | 33 | BuildRequires: libraqm-devel |
b46ddc56 | 34 | BuildRequires: libtiff-devel >= 4 |
2672936f | 35 | BuildRequires: libwebp-devel |
5b18a5b3 JB |
36 | BuildRequires: openjpeg2-devel >= 2 |
37 | BuildRequires: pkgconfig | |
b46ddc56 | 38 | BuildRequires: rpmbuild(macros) >= 1.714 |
5b18a5b3 | 39 | BuildRequires: tk-devel |
2672936f ER |
40 | BuildRequires: zlib-devel |
41 | %if %{with python2} | |
2672936f | 42 | BuildRequires: python-cffi |
8f2446a5 | 43 | BuildRequires: python-devel >= 1:2.7 |
2672936f ER |
44 | BuildRequires: python-numpy |
45 | BuildRequires: python-setuptools | |
5b18a5b3 | 46 | BuildRequires: python-tkinter |
2672936f ER |
47 | %endif |
48 | %if %{with doc} | |
1bbcb99c | 49 | BuildRequires: python-sphinx_rtd_theme |
58aa25fa | 50 | BuildRequires: sphinx-pdg-2 |
2672936f ER |
51 | %endif |
52 | %if %{with python3} | |
2672936f | 53 | BuildRequires: python3-cffi |
b46ddc56 | 54 | BuildRequires: python3-devel >= 1:3.5 |
2672936f ER |
55 | BuildRequires: python3-numpy |
56 | BuildRequires: python3-setuptools | |
5b18a5b3 | 57 | BuildRequires: python3-tkinter |
2672936f | 58 | %if %{with doc} |
1bbcb99c | 59 | BuildRequires: python3-sphinx_rtd_theme |
58aa25fa | 60 | BuildRequires: sphinx-pdg-3 |
2672936f ER |
61 | %endif |
62 | %endif | |
63 | # For EpsImagePlugin.py | |
64 | Requires: ghostscript | |
65 | Provides: python-PIL = %{version}-%{release} | |
04966afa | 66 | Provides: pythonegg(pil) = %{version} |
bd0427cb | 67 | Obsoletes: python-PIL < 1:1.1.8 |
f5e41e59 | 68 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
2672936f | 69 | |
2672936f ER |
70 | %define py2_libbuilddir %(python -c 'import sys; import sysconfig; print("lib.{p}-{v[0]}.{v[1]}".format(p=sysconfig.get_platform(), v=sys.version_info))') |
71 | %define py3_libbuilddir %(python3 -c 'import sys; import sysconfig; print("lib.{p}-{v[0]}.{v[1]}".format(p=sysconfig.get_platform(), v=sys.version_info))') | |
72 | ||
73 | %description | |
74 | Python image processing library, fork of the Python Imaging Library | |
5b18a5b3 | 75 | (PIL). |
2672936f ER |
76 | |
77 | This library provides extensive file format support, an efficient | |
78 | internal representation, and powerful image processing capabilities. | |
79 | ||
5b18a5b3 JB |
80 | There are four additional subpackages: |
81 | - tk (Tk interface), | |
1bbcb99c | 82 | - qt (PIL image wrapper for Qt), |
1bbcb99c ER |
83 | - devel (development), |
84 | - doc (documentation). | |
2672936f | 85 | |
5b18a5b3 JB |
86 | %description -l pl.UTF-8 |
87 | Pythonowa biblioteka do przetwarzania obrazów - odgałęzienie projektu | |
88 | PIL (Python Imaging Library). | |
89 | ||
90 | Ta biblioteka zapewnia obsługę wielu formatów plików, wydajną | |
91 | reprezentację wewnętrzną oraz potężne możliwości przetwarzania. | |
92 | ||
93 | Są cztery dodatkowe podpakiety: | |
94 | - tk (interfejs Tk), | |
95 | - qt (obudowanie obrazów PIL dla Qt), | |
96 | - devel (do programowania), | |
97 | - doc (dokumentacja). | |
98 | ||
2672936f | 99 | %package devel |
5b18a5b3 JB |
100 | Summary: Development files for Pillow module |
101 | Summary(pl.UTF-8): Pliki programistyczne modułu Pillow | |
2672936f ER |
102 | Group: Development/Libraries |
103 | Requires: %{name} = %{version}-%{release} | |
104 | Requires: libjpeg-devel | |
8f2446a5 | 105 | Requires: python-devel >= 1:2.7 |
2672936f ER |
106 | Requires: zlib-devel |
107 | Provides: python-PIL-devel = %{version}-%{release} | |
bd0427cb | 108 | Obsoletes: python-PIL-devel < 1:1.1.8 |
2672936f ER |
109 | |
110 | %description devel | |
5b18a5b3 JB |
111 | Development files for Pillow module. |
112 | ||
113 | %description devel -l pl.UTF-8 | |
114 | Pliki programistyczne modułu Pillow. | |
2672936f ER |
115 | |
116 | %package doc | |
5b18a5b3 JB |
117 | Summary: Documentation for Pillow module |
118 | Summary(pl.UTF-8): Dokumentacja do modułu Pillow | |
2672936f ER |
119 | Group: Documentation |
120 | Requires: %{name} = %{version}-%{release} | |
121 | %if "%{_rpmversion}" >= "5" | |
122 | BuildArch: noarch | |
123 | %endif | |
124 | ||
125 | %description doc | |
5b18a5b3 JB |
126 | Documentation for Pillow module. |
127 | ||
128 | %description doc -l pl.UTF-8 | |
129 | Dokumentacja do modułu Pillow. | |
2672936f | 130 | |
2672936f | 131 | %package tk |
5b18a5b3 JB |
132 | Summary: Tk interface for Pillow module |
133 | Summary(pl.UTF-8): Interfejs Tk do modułu Pillow | |
134 | Group: Libraries/Python | |
2672936f ER |
135 | Requires: %{name} = %{version}-%{release} |
136 | Requires: python-tkinter | |
137 | Provides: python-PIL-tk = %{version}-%{release} | |
bd0427cb | 138 | Obsoletes: python-PIL-tk < 1:1.1.8 |
2672936f ER |
139 | |
140 | %description tk | |
5b18a5b3 JB |
141 | Tk interface for Pillow module. |
142 | ||
143 | %description tk -l pl.UTF-8 | |
144 | Interfejs Tk do modułu Pillow. | |
2672936f ER |
145 | |
146 | %package qt | |
147 | Summary: PIL image wrapper for Qt | |
5b18a5b3 JB |
148 | Summary(pl.UTF-8): Obudowanie obrazów PIL dla Qt |
149 | Group: Libraries/Python | |
2672936f ER |
150 | Requires: %{name} = %{version}-%{release} |
151 | Requires: python-PyQt4 | |
152 | Provides: python-PIL-qt = %{version}-%{release} | |
153 | ||
154 | %description qt | |
155 | PIL image wrapper for Qt. | |
156 | ||
5b18a5b3 JB |
157 | %description qt -l pl.UTF-8 |
158 | Obudowanie obrazów PIL dla Qt. | |
159 | ||
2672936f ER |
160 | %package -n python3-%{module} |
161 | Summary: Python 3 image processing library | |
5b18a5b3 JB |
162 | Summary(pl.UTF-8): Biblioteka do przetwarzania obrazów dla Pythona 3 |
163 | Group: Libraries/Python | |
2672936f ER |
164 | Provides: python3-PIL = %{version}-%{release} |
165 | ||
166 | %description -n python3-%{module} | |
167 | Python image processing library, fork of the Python Imaging Library | |
168 | (PIL) | |
169 | ||
170 | This library provides extensive file format support, an efficient | |
171 | internal representation, and powerful image processing capabilities. | |
172 | ||
5b18a5b3 | 173 | There are four additional subpackages: |
1bbcb99c ER |
174 | - tk (tk interface), |
175 | - qt (PIL image wrapper for Qt), | |
1bbcb99c ER |
176 | - devel (development), |
177 | - doc (documentation). | |
2672936f | 178 | |
5b18a5b3 JB |
179 | %description -n python3-%{module} -l pl.UTF-8 |
180 | Pythonowa biblioteka do przetwarzania obrazów - odgałęzienie projektu | |
181 | PIL (Python Imaging Library). | |
182 | ||
183 | Ta biblioteka zapewnia obsługę wielu formatów plików, wydajną | |
184 | reprezentację wewnętrzną oraz potężne możliwości przetwarzania. | |
185 | ||
186 | Są cztery dodatkowe podpakiety: | |
187 | - tk (interfejs Tk), | |
188 | - qt (obudowanie obrazów PIL dla Qt), | |
189 | - devel (do programowania), | |
190 | - doc (dokumentacja). | |
191 | ||
2672936f | 192 | %package -n python3-%{module}-devel |
5b18a5b3 JB |
193 | Summary: Development files for Pillow module |
194 | Summary(pl.UTF-8): Pliki programistyczne modułu Pillow | |
2672936f ER |
195 | Group: Development/Libraries |
196 | Requires: libjpeg-devel | |
197 | Requires: python3-%{module} = %{version}-%{release} | |
8f2446a5 | 198 | Requires: python3-devel >= 1:3.4 |
2672936f ER |
199 | Requires: zlib-devel |
200 | ||
201 | %description -n python3-%{module}-devel | |
5b18a5b3 JB |
202 | Development files for Pillow module. |
203 | ||
204 | %description -n python3-%{module}-devel -l pl.UTF-8 | |
205 | Pliki programistyczne modułu Pillow. | |
2672936f ER |
206 | |
207 | %package -n python3-%{module}-doc | |
5b18a5b3 JB |
208 | Summary: Documentation for Pillow module |
209 | Summary(pl.UTF-8): Dokumentacja do modułu Pillow | |
2672936f ER |
210 | Group: Documentation |
211 | Requires: python3-%{module} = %{version}-%{release} | |
212 | %if "%{_rpmversion}" >= "5" | |
213 | BuildArch: noarch | |
214 | %endif | |
215 | ||
216 | %description -n python3-%{module}-doc | |
5b18a5b3 JB |
217 | Documentation for Pillow module. |
218 | ||
219 | %description -n python3-%{module}-doc -l pl.UTF-8 | |
220 | Dokumentacja do modułu Pillow. | |
2672936f | 221 | |
2672936f | 222 | %package -n python3-%{module}-tk |
5b18a5b3 JB |
223 | Summary: Tk interface for Pillow module |
224 | Summary(pl.UTF-8): Interfejs Tk do modułu Pillow | |
225 | Group: Libraries/Python | |
2672936f ER |
226 | Requires: python-tkinter |
227 | Requires: python3-%{module} = %{version}-%{release} | |
228 | ||
229 | %description -n python3-%{module}-tk | |
5b18a5b3 JB |
230 | Tk interface for Pillow module. |
231 | ||
232 | %description -n python3-%{module}-tk -l pl.UTF-8 | |
233 | Interfejs Tk do modułu Pillow. | |
2672936f ER |
234 | |
235 | %package -n python3-%{module}-qt | |
236 | Summary: PIL image wrapper for Qt | |
5b18a5b3 JB |
237 | Summary(pl.UTF-8): Obudowanie obrazów PIL dla Qt |
238 | Group: Libraries/Python | |
2672936f ER |
239 | Requires: python3-%{module} = %{version}-%{release} |
240 | Requires: python3-PyQt4 | |
241 | Obsoletes: python3-%{module} <= 2.0.0-5.git93a488e8 | |
242 | ||
243 | %description -n python3-%{module}-qt | |
244 | PIL image wrapper for Qt. | |
245 | ||
5b18a5b3 JB |
246 | %description -n python3-%{module}-qt -l pl.UTF-8 |
247 | Obudowanie obrazów PIL dla Qt. | |
248 | ||
2672936f ER |
249 | %prep |
250 | %setup -q -n Pillow-%{version} | |
c023b5ed | 251 | %patch0 -p1 |
58aa25fa JB |
252 | %if "%{_lib}" == "libx32" |
253 | %patch1 -p1 | |
c023b5ed JK |
254 | %endif |
255 | ||
2672936f | 256 | # Strip shebang on non-executable file |
58aa25fa | 257 | #sed -i 1d PIL/OleFileIO.py |
2672936f ER |
258 | |
259 | # Fix file encoding | |
260 | iconv --from=ISO-8859-1 --to=UTF-8 PIL/WalImageFile.py > PIL/WalImageFile.py.new && \ | |
261 | touch -r PIL/WalImageFile.py PIL/WalImageFile.py.new && \ | |
5b18a5b3 | 262 | %{__mv} PIL/WalImageFile.py.new PIL/WalImageFile.py |
2672936f | 263 | |
2672936f | 264 | %build |
0b50aa0e | 265 | %py_build |
2672936f ER |
266 | |
267 | %if %{with doc} | |
58aa25fa JB |
268 | PYTHONPATH=$(pwd)/build-2/%{py2_libbuilddir} \ |
269 | %{__make} -C docs html \ | |
270 | SPHINXBUILD=sphinx-build-2 | |
2672936f ER |
271 | %endif |
272 | ||
273 | %if %{with python3} | |
0b50aa0e | 274 | %py3_build |
2672936f ER |
275 | |
276 | %if %{with doc} | |
58aa25fa JB |
277 | PYTHONPATH=$(pwd)/build-3/%{py3_libbuilddir} \ |
278 | %{__make} -C docs html \ | |
279 | SPHINXBUILD=sphinx-build-3 | |
2672936f | 280 | %endif |
2672936f ER |
281 | %endif |
282 | ||
283 | %if %{with tests} | |
284 | # Check Python 2 modules | |
6a785986 JK |
285 | cp -R $PWD/Tests $PWD/build-2/%py2_libbuilddir/Tests |
286 | cp -R $PWD/selftest.py $PWD/build-2/%py2_libbuilddir/selftest.py | |
287 | cd build-2/%py2_libbuilddir | |
2672936f | 288 | PYTHONPATH=$PWD %{__python} selftest.py |
58aa25fa | 289 | cd ../.. |
2672936f ER |
290 | |
291 | %if %{with python3} | |
292 | # Check Python 3 modules | |
6a785986 JK |
293 | cp -R $PWD/Tests $PWD/build-3/%py3_libbuilddir/Tests |
294 | cp -R $PWD/selftest.py $PWD/build-3/%py3_libbuilddir/selftest.py | |
295 | cd build-3/%py3_libbuilddir | |
2672936f | 296 | PYTHONPATH=$PWD %{__python3} selftest.py |
2672936f ER |
297 | %endif |
298 | %endif | |
299 | ||
300 | %install | |
301 | rm -rf $RPM_BUILD_ROOT | |
58aa25fa | 302 | |
2672936f ER |
303 | %if %{with python2} |
304 | # Install Python 2 modules | |
5b18a5b3 | 305 | install -d $RPM_BUILD_ROOT%{py_incdir}/Imaging |
58aa25fa | 306 | cp -p src/libImaging/*.h $RPM_BUILD_ROOT%{py_incdir}/Imaging |
e58ddac6 | 307 | %py_install |
1bbcb99c | 308 | |
2672936f ER |
309 | # Fix non-standard-executable-perm |
310 | chmod +x $RPM_BUILD_ROOT%{py_sitedir}/PIL/*.so | |
2672936f | 311 | |
58aa25fa JB |
312 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitedir}/{Tests,selftest.py*} |
313 | %py_postclean | |
314 | %endif | |
315 | ||
2672936f ER |
316 | %if %{with python3} |
317 | # Install Python 3 modules | |
5b18a5b3 | 318 | install -d $RPM_BUILD_ROOT%{py3_incdir}/Imaging |
58aa25fa | 319 | cp -p src/libImaging/*.h $RPM_BUILD_ROOT%{py3_incdir}/Imaging |
e58ddac6 | 320 | %py3_install |
1bbcb99c | 321 | |
2672936f | 322 | # Fix non-standard-executable-perm |
6a785986 | 323 | chmod +x $RPM_BUILD_ROOT%{py3_sitedir}/PIL/*.so |
2672936f | 324 | |
58aa25fa JB |
325 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/{Tests,selftest.py,__pycache__/selftest.*} |
326 | %endif | |
2672936f ER |
327 | |
328 | %clean | |
329 | rm -rf $RPM_BUILD_ROOT | |
330 | ||
331 | %files | |
332 | %defattr(644,root,root,755) | |
5b18a5b3 | 333 | %doc CHANGES.rst README.rst docs/COPYING |
2672936f ER |
334 | %dir %{py_sitedir}/PIL |
335 | %{py_sitedir}/PIL/*.py[co] | |
5b18a5b3 JB |
336 | %attr(755,root,root) %{py_sitedir}/PIL/_imaging.so |
337 | %attr(755,root,root) %{py_sitedir}/PIL/_imagingcms.so | |
338 | %attr(755,root,root) %{py_sitedir}/PIL/_imagingft.so | |
339 | %attr(755,root,root) %{py_sitedir}/PIL/_imagingmath.so | |
340 | %attr(755,root,root) %{py_sitedir}/PIL/_imagingmorph.so | |
341 | %attr(755,root,root) %{py_sitedir}/PIL/_webp.so | |
2672936f | 342 | %{py_sitedir}/Pillow-%{version}-py*.egg-info |
2672936f | 343 | # These are in subpackages |
5b18a5b3 JB |
344 | %exclude %{py_sitedir}/PIL/ImageQt.py* |
345 | %exclude %{py_sitedir}/PIL/ImageTk.py* | |
346 | %exclude %{py_sitedir}/PIL/SpiderImagePlugin.py* | |
347 | %exclude %{py_sitedir}/PIL/_tkinter_finder.py* | |
2672936f ER |
348 | |
349 | %files devel | |
350 | %defattr(644,root,root,755) | |
329d7a11 | 351 | %{py_incdir}/Imaging |
2672936f | 352 | |
58aa25fa | 353 | %if %{with doc} |
2672936f ER |
354 | %files doc |
355 | %defattr(644,root,root,755) | |
58aa25fa JB |
356 | %doc docs/_build/html/* |
357 | %endif | |
2672936f | 358 | |
2672936f ER |
359 | %files tk |
360 | %defattr(644,root,root,755) | |
361 | %attr(755,root,root) %{py_sitedir}/PIL/_imagingtk.so | |
362 | %{py_sitedir}/PIL/ImageTk.py[co] | |
363 | %{py_sitedir}/PIL/SpiderImagePlugin.py[co] | |
5b18a5b3 | 364 | %{py_sitedir}/PIL/_tkinter_finder.py[co] |
2672936f ER |
365 | |
366 | %files qt | |
367 | %defattr(644,root,root,755) | |
368 | %{py_sitedir}/PIL/ImageQt.py[co] | |
369 | ||
370 | %if %{with python3} | |
371 | %files -n python3-%{module} | |
372 | %defattr(644,root,root,755) | |
5b18a5b3 JB |
373 | %doc CHANGES.rst README.rst docs/COPYING |
374 | %dir %{py3_sitedir}/PIL | |
375 | %{py3_sitedir}/PIL/*.py | |
376 | %attr(755,root,root) %{py3_sitedir}/PIL/_imaging.cpython-*.so | |
377 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingcms.cpython-*.so | |
378 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingft.cpython-*.so | |
379 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingmath.cpython-*.so | |
380 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingmorph.cpython-*.so | |
381 | %attr(755,root,root) %{py3_sitedir}/PIL/_webp.cpython-*.so | |
382 | %dir %{py3_sitedir}/PIL/__pycache__ | |
383 | %{py3_sitedir}/PIL/__pycache__/*.py[co] | |
384 | %{py3_sitedir}/Pillow-%{version}-py*.egg-info | |
2672936f | 385 | # These are in subpackages |
5b18a5b3 JB |
386 | %exclude %{py3_sitedir}/PIL/ImageQt.py |
387 | %exclude %{py3_sitedir}/PIL/ImageTk.py | |
388 | %exclude %{py3_sitedir}/PIL/SpiderImagePlugin.py | |
389 | %exclude %{py3_sitedir}/PIL/_tkinter_finder.py | |
390 | %exclude %{py3_sitedir}/PIL/__pycache__/ImageQt.cpython-*.py[co] | |
391 | %exclude %{py3_sitedir}/PIL/__pycache__/ImageTk.cpython-*.py[co] | |
392 | %exclude %{py3_sitedir}/PIL/__pycache__/SpiderImagePlugin.cpython-*.py[co] | |
393 | %exclude %{py3_sitedir}/PIL/__pycache__/_tkinter_finder.cpython-*.py[co] | |
2672936f ER |
394 | |
395 | %files -n python3-%{module}-devel | |
396 | %defattr(644,root,root,755) | |
397 | %{py3_incdir}/Imaging | |
398 | ||
58aa25fa | 399 | %if %{with doc} |
2672936f ER |
400 | %files -n python3-%{module}-doc |
401 | %defattr(644,root,root,755) | |
58aa25fa JB |
402 | %doc docs/_build/html |
403 | %endif | |
2672936f | 404 | |
2672936f ER |
405 | %files -n python3-%{module}-tk |
406 | %defattr(644,root,root,755) | |
5b18a5b3 JB |
407 | %{py3_sitedir}/PIL/_imagingtk.cpython-*.so |
408 | %{py3_sitedir}/PIL/ImageTk.py | |
409 | %{py3_sitedir}/PIL/SpiderImagePlugin.py | |
410 | %{py3_sitedir}/PIL/_tkinter_finder.py | |
411 | %{py3_sitedir}/PIL/__pycache__/ImageTk.cpython-*.py[co] | |
412 | %{py3_sitedir}/PIL/__pycache__/SpiderImagePlugin.cpython-*.py[co] | |
413 | %{py3_sitedir}/PIL/__pycache__/_tkinter_finder.cpython-*.py[co] | |
2672936f ER |
414 | |
415 | %files -n python3-%{module}-qt | |
416 | %defattr(644,root,root,755) | |
5b18a5b3 JB |
417 | %{py3_sitedir}/PIL/ImageQt.py |
418 | %{py3_sitedir}/PIL/__pycache__/ImageQt.cpython-*.py[co] | |
1c862ef3 | 419 | %endif |