]>
Commit | Line | Data |
---|---|---|
2672936f ER |
1 | # |
2 | # bootstrap building docs (pillow is required by docutils, docutils are | |
3 | # required by sphinx; pillow build-requires sphinx) | |
2672936f ER |
4 | |
5 | # Conditional build: | |
6a785986 | 6 | %bcond_with doc # don't build doc |
2672936f ER |
7 | %bcond_with tests # do not perform "make test" |
8 | %bcond_without python2 # CPython 2.x module | |
6a785986 | 9 | %bcond_without python3 # CPython 3.x module |
1bbcb99c | 10 | %bcond_with sane # SANE scanning devices interface (use python-sane instead) |
2672936f ER |
11 | |
12 | %define module pillow | |
13 | Summary: Python image processing library | |
14 | Name: python-%{module} | |
98a34571 | 15 | Version: 3.2.0 |
6a785986 | 16 | Release: 1 |
2672936f ER |
17 | # License: see http://www.pythonware.com/products/pil/license.htm |
18 | License: MIT | |
19 | Group: Libraries/Python | |
98a34571 MK |
20 | Source0: https://pypi.python.org/packages/e2/af/0a3981fffc5cd43078eb8b1057702e0dd2d5771e5aaa36cbd140e32f8473/Pillow-3.2.0.tar.gz#md5=7cfd093c11205d9e2ebe3c51dfcad510 |
21 | # Source0-md5: 7cfd093c11205d9e2ebe3c51dfcad510 | |
c023b5ed | 22 | Patch0: x32.patch |
2672936f ER |
23 | URL: http://python-pillow.github.io/ |
24 | BuildRequires: freetype-devel | |
25 | BuildRequires: ghostscript | |
26 | BuildRequires: lcms2-devel | |
27 | BuildRequires: libjpeg-devel | |
1bbcb99c | 28 | BuildRequires: libtiff-devel |
2672936f ER |
29 | BuildRequires: libwebp-devel |
30 | BuildRequires: openjpeg2-devel | |
2453682c | 31 | BuildRequires: rpmbuild(macros) >= 1.710 |
1bbcb99c | 32 | %{?with_sane:BuildRequires: sane-backends-devel} |
2672936f ER |
33 | BuildRequires: tk-devel |
34 | BuildRequires: zlib-devel | |
35 | %if %{with python2} | |
36 | BuildRequires: python-PyQt4 | |
37 | BuildRequires: python-cffi | |
38 | BuildRequires: python-devel | |
39 | BuildRequires: python-numpy | |
40 | BuildRequires: python-setuptools | |
41 | BuildRequires: python-tkinter | |
42 | %endif | |
43 | %if %{with doc} | |
44 | BuildRequires: python-Sphinx | |
1bbcb99c | 45 | BuildRequires: python-sphinx_rtd_theme |
2672936f ER |
46 | %endif |
47 | %if %{with python3} | |
48 | BuildRequires: python3-PyQt4 | |
49 | BuildRequires: python3-cffi | |
50 | BuildRequires: python3-devel | |
51 | BuildRequires: python3-numpy | |
52 | BuildRequires: python3-setuptools | |
53 | BuildRequires: python3-tkinter | |
54 | %if %{with doc} | |
55 | BuildRequires: python3-sphinx | |
1bbcb99c | 56 | BuildRequires: python3-sphinx_rtd_theme |
2672936f ER |
57 | %endif |
58 | %endif | |
59 | # For EpsImagePlugin.py | |
60 | Requires: ghostscript | |
61 | Provides: python-PIL = %{version}-%{release} | |
04966afa | 62 | Provides: pythonegg(pil) = %{version} |
bd0427cb | 63 | Obsoletes: python-PIL < 1:1.1.8 |
2672936f ER |
64 | |
65 | %define py2_incdir %{_includedir}/python%{python_version} | |
66 | %define py3_incdir %{_includedir}/python%{python3_version} | |
67 | %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))') | |
68 | %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))') | |
69 | ||
70 | %description | |
71 | Python image processing library, fork of the Python Imaging Library | |
72 | (PIL) | |
73 | ||
74 | This library provides extensive file format support, an efficient | |
75 | internal representation, and powerful image processing capabilities. | |
76 | ||
1bbcb99c ER |
77 | There are five subpackages: |
78 | - tk (tk interface), | |
79 | - qt (PIL image wrapper for Qt), | |
80 | %if %{with sane} | |
81 | - sane (scanning devices interface), | |
82 | %endif | |
83 | - devel (development), | |
84 | - doc (documentation). | |
2672936f ER |
85 | |
86 | %package devel | |
87 | Summary: Development files for %{name} | |
88 | Group: Development/Libraries | |
89 | Requires: %{name} = %{version}-%{release} | |
90 | Requires: libjpeg-devel | |
91 | Requires: python-devel | |
92 | Requires: zlib-devel | |
93 | Provides: python-PIL-devel = %{version}-%{release} | |
bd0427cb | 94 | Obsoletes: python-PIL-devel < 1:1.1.8 |
2672936f ER |
95 | |
96 | %description devel | |
97 | Development files for %{name}. | |
98 | ||
99 | %package doc | |
100 | Summary: Documentation for %{name} | |
101 | Group: Documentation | |
102 | Requires: %{name} = %{version}-%{release} | |
103 | %if "%{_rpmversion}" >= "5" | |
104 | BuildArch: noarch | |
105 | %endif | |
106 | ||
107 | %description doc | |
108 | Documentation for %{name}. | |
109 | ||
110 | %package sane | |
111 | Summary: Python module for using scanners | |
112 | Group: Libraries | |
113 | Requires: %{name} = %{version}-%{release} | |
114 | Provides: python-PIL-sane = %{version}-%{release} | |
bd0427cb | 115 | Obsoletes: python-PIL-sane < 1:1.1.8 |
2672936f ER |
116 | |
117 | %description sane | |
118 | This package contains the sane module for Python which provides access | |
119 | to various raster scanning devices such as flatbed scanners and | |
120 | digital cameras. | |
121 | ||
122 | %package tk | |
123 | Summary: Tk interface for %{name} | |
124 | Group: Libraries | |
125 | Requires: %{name} = %{version}-%{release} | |
126 | Requires: python-tkinter | |
127 | Provides: python-PIL-tk = %{version}-%{release} | |
bd0427cb | 128 | Obsoletes: python-PIL-tk < 1:1.1.8 |
2672936f ER |
129 | |
130 | %description tk | |
131 | Tk interface for %{name}. | |
132 | ||
133 | %package qt | |
134 | Summary: PIL image wrapper for Qt | |
135 | Group: Libraries | |
136 | Requires: %{name} = %{version}-%{release} | |
137 | Requires: python-PyQt4 | |
138 | Provides: python-PIL-qt = %{version}-%{release} | |
139 | ||
140 | %description qt | |
141 | PIL image wrapper for Qt. | |
142 | ||
143 | %package -n python3-%{module} | |
144 | Summary: Python 3 image processing library | |
145 | Provides: python3-PIL = %{version}-%{release} | |
146 | ||
147 | %description -n python3-%{module} | |
148 | Python image processing library, fork of the Python Imaging Library | |
149 | (PIL) | |
150 | ||
151 | This library provides extensive file format support, an efficient | |
152 | internal representation, and powerful image processing capabilities. | |
153 | ||
1bbcb99c ER |
154 | There are five subpackages: |
155 | - tk (tk interface), | |
156 | - qt (PIL image wrapper for Qt), | |
157 | %if %{with sane} | |
158 | - sane (scanning devices interface), | |
159 | %endif | |
160 | - devel (development), | |
161 | - doc (documentation). | |
2672936f ER |
162 | |
163 | %package -n python3-%{module}-devel | |
164 | Summary: Development files for python3-%{module} | |
165 | Group: Development/Libraries | |
166 | Requires: libjpeg-devel | |
167 | Requires: python3-%{module} = %{version}-%{release} | |
168 | Requires: python3-devel | |
169 | Requires: zlib-devel | |
170 | ||
171 | %description -n python3-%{module}-devel | |
172 | Development files for python3-%{module}. | |
173 | ||
174 | %package -n python3-%{module}-doc | |
175 | Summary: Documentation for python3-%{module} | |
176 | Group: Documentation | |
177 | Requires: python3-%{module} = %{version}-%{release} | |
178 | %if "%{_rpmversion}" >= "5" | |
179 | BuildArch: noarch | |
180 | %endif | |
181 | ||
182 | %description -n python3-%{module}-doc | |
183 | Documentation for python3-%{module}. | |
184 | ||
185 | %package -n python3-%{module}-sane | |
186 | Summary: Python module for using scanners | |
187 | Group: Libraries | |
188 | Requires: python3-%{module} = %{version}-%{release} | |
189 | ||
190 | %description -n python3-%{module}-sane | |
191 | This package contains the sane module for Python which provides access | |
192 | to various raster scanning devices such as flatbed scanners and | |
193 | digital cameras. | |
194 | ||
195 | %package -n python3-%{module}-tk | |
196 | Summary: Tk interface for python3-%{module} | |
197 | Group: Libraries | |
198 | Requires: python-tkinter | |
199 | Requires: python3-%{module} = %{version}-%{release} | |
200 | ||
201 | %description -n python3-%{module}-tk | |
202 | Tk interface for python3-%{module}. | |
203 | ||
204 | %package -n python3-%{module}-qt | |
205 | Summary: PIL image wrapper for Qt | |
206 | Group: Libraries | |
207 | Requires: python3-%{module} = %{version}-%{release} | |
208 | Requires: python3-PyQt4 | |
209 | Obsoletes: python3-%{module} <= 2.0.0-5.git93a488e8 | |
210 | ||
211 | %description -n python3-%{module}-qt | |
212 | PIL image wrapper for Qt. | |
213 | ||
214 | %prep | |
215 | %setup -q -n Pillow-%{version} | |
216 | ||
c023b5ed JK |
217 | %if "%{_lib}" == "libx32" |
218 | %patch0 -p1 | |
219 | %endif | |
220 | ||
2672936f ER |
221 | # Strip shebang on non-executable file |
222 | sed -i 1d PIL/OleFileIO.py | |
223 | ||
224 | # Fix file encoding | |
225 | iconv --from=ISO-8859-1 --to=UTF-8 PIL/WalImageFile.py > PIL/WalImageFile.py.new && \ | |
226 | touch -r PIL/WalImageFile.py PIL/WalImageFile.py.new && \ | |
227 | mv PIL/WalImageFile.py.new PIL/WalImageFile.py | |
228 | ||
1bbcb99c | 229 | # Make sample scripts non-executable |
98a34571 | 230 | chmod -x Scripts/pilprint.py |
1bbcb99c | 231 | |
2672936f | 232 | %build |
e58ddac6 | 233 | CFLAGS="%{rpmcflags}" %py_build |
2672936f | 234 | |
1bbcb99c | 235 | %if %{with sane} |
2672936f | 236 | cd Sane |
e58ddac6 | 237 | CFLAGS="%{rpmcflags}" %py_build |
2672936f | 238 | cd .. |
1bbcb99c | 239 | %endif |
2672936f ER |
240 | |
241 | %if %{with doc} | |
242 | cd docs | |
6a785986 | 243 | PYTHONPATH=$PWD/../build-2/%py2_libbuilddir %{__make} html |
2672936f ER |
244 | rm -f _build/html/.buildinfo |
245 | cd .. | |
246 | %endif | |
247 | ||
248 | %if %{with python3} | |
e58ddac6 | 249 | CFLAGS="%{rpmcflags}" %py3_build |
2672936f | 250 | |
1bbcb99c | 251 | %if %{with sane} |
2672936f | 252 | cd Sane |
e58ddac6 | 253 | CFLAGS="%{rpmcflags}" %py3_build |
2672936f | 254 | cd .. |
1bbcb99c | 255 | %endif |
2672936f ER |
256 | |
257 | %if %{with doc} | |
258 | cd docs | |
6a785986 | 259 | PYTHONPATH=$PWD/../build-3/%py3_libbuilddir make html SPHINXBUILD=sphinx-build-%python3_version |
2672936f ER |
260 | rm -f _build/html/.buildinfo |
261 | cd .. | |
262 | %endif | |
2672936f ER |
263 | %endif |
264 | ||
265 | %if %{with tests} | |
266 | # Check Python 2 modules | |
6a785986 JK |
267 | ln -s $PWD/Images $PWD/build-2/%py2_libbuilddir/Images |
268 | cp -R $PWD/Tests $PWD/build-2/%py2_libbuilddir/Tests | |
269 | cp -R $PWD/selftest.py $PWD/build-2/%py2_libbuilddir/selftest.py | |
270 | cd build-2/%py2_libbuilddir | |
2672936f ER |
271 | PYTHONPATH=$PWD %{__python} selftest.py |
272 | cd .. | |
273 | ||
274 | %if %{with python3} | |
275 | # Check Python 3 modules | |
6a785986 JK |
276 | ln -s $PWD/Images $PWD/build-3/%py3_libbuilddir/Images |
277 | cp -R $PWD/Tests $PWD/build-3/%py3_libbuilddir/Tests | |
278 | cp -R $PWD/selftest.py $PWD/build-3/%py3_libbuilddir/selftest.py | |
279 | cd build-3/%py3_libbuilddir | |
2672936f | 280 | PYTHONPATH=$PWD %{__python3} selftest.py |
2672936f ER |
281 | %endif |
282 | %endif | |
283 | ||
284 | %install | |
285 | rm -rf $RPM_BUILD_ROOT | |
286 | %if %{with python2} | |
287 | # Install Python 2 modules | |
288 | install -d $RPM_BUILD_ROOT/%{py2_incdir}/Imaging | |
289 | cp -p libImaging/*.h $RPM_BUILD_ROOT/%{py2_incdir}/Imaging | |
e58ddac6 | 290 | %py_install |
1bbcb99c ER |
291 | |
292 | %if %{with sane} | |
2672936f | 293 | cd Sane |
e58ddac6 | 294 | %py_install |
2672936f | 295 | cd .. |
1bbcb99c | 296 | %endif |
2672936f ER |
297 | |
298 | %py_postclean | |
299 | %endif | |
300 | ||
301 | # Fix non-standard-executable-perm | |
302 | chmod +x $RPM_BUILD_ROOT%{py_sitedir}/PIL/*.so | |
1bbcb99c | 303 | %if %{with sane} |
2672936f | 304 | chmod +x $RPM_BUILD_ROOT%{py_sitedir}/*.so |
1bbcb99c | 305 | %endif |
2672936f ER |
306 | |
307 | %if %{with python3} | |
308 | # Install Python 3 modules | |
2672936f ER |
309 | install -d $RPM_BUILD_ROOT/%{py3_incdir}/Imaging |
310 | cp -p libImaging/*.h $RPM_BUILD_ROOT/%{py3_incdir}/Imaging | |
e58ddac6 | 311 | %py3_install |
1bbcb99c ER |
312 | |
313 | %if %{with sane} | |
2672936f | 314 | cd Sane |
e58ddac6 | 315 | %py3_install |
6a785986 | 316 | cd .. |
1bbcb99c | 317 | %endif |
2672936f ER |
318 | |
319 | # Fix non-standard-executable-perm | |
6a785986 JK |
320 | chmod +x $RPM_BUILD_ROOT%{py3_sitedir}/PIL/*.so |
321 | %if %{with sane} | |
322 | chmod +x $RPM_BUILD_ROOT%{py3_sitedir}/*.so | |
323 | %endif | |
2672936f ER |
324 | %endif |
325 | ||
326 | # The scripts are packaged in %doc | |
327 | rm -rf $RPM_BUILD_ROOT%{_bindir} | |
328 | ||
329 | %clean | |
330 | rm -rf $RPM_BUILD_ROOT | |
331 | ||
332 | %files | |
333 | %defattr(644,root,root,755) | |
334 | %doc README.rst CHANGES.rst docs/COPYING | |
335 | %dir %{py_sitedir}/PIL | |
336 | %{py_sitedir}/PIL/*.py[co] | |
337 | %{py_sitedir}/PIL/OleFileIO-README.md | |
338 | %attr(755,root,root) %{py_sitedir}/PIL/_*.so | |
339 | %{py_sitedir}/Pillow-%{version}-py*.egg-info | |
340 | ||
341 | # These are in subpackages | |
1bbcb99c | 342 | %if %{with sane} |
2672936f | 343 | %exclude %{py_sitedir}/*sane* |
1bbcb99c | 344 | %endif |
2672936f ER |
345 | %exclude %{py_sitedir}/PIL/_imagingtk* |
346 | %exclude %{py_sitedir}/PIL/ImageTk* | |
347 | %exclude %{py_sitedir}/PIL/SpiderImagePlugin* | |
348 | %exclude %{py_sitedir}/PIL/ImageQt* | |
349 | ||
350 | %files devel | |
351 | %defattr(644,root,root,755) | |
352 | %{py2_incdir}/Imaging | |
353 | ||
354 | %files doc | |
355 | %defattr(644,root,root,755) | |
356 | %doc Scripts | |
357 | %if %{with doc} | |
358 | %doc docs/_build/html | |
359 | %endif | |
360 | ||
1bbcb99c | 361 | %if %{with sane} |
2672936f ER |
362 | %files sane |
363 | %defattr(644,root,root,755) | |
364 | %doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt | |
365 | %attr(755,root,root) %{py_sitedir}/_sane.so | |
366 | %{py_sitedir}/sane.py[co] | |
367 | %{py_sitedir}/pysane-2.0-py*.egg-info | |
1bbcb99c | 368 | %endif |
2672936f ER |
369 | |
370 | %files tk | |
371 | %defattr(644,root,root,755) | |
372 | %attr(755,root,root) %{py_sitedir}/PIL/_imagingtk.so | |
373 | %{py_sitedir}/PIL/ImageTk.py[co] | |
374 | %{py_sitedir}/PIL/SpiderImagePlugin.py[co] | |
375 | ||
376 | %files qt | |
377 | %defattr(644,root,root,755) | |
378 | %{py_sitedir}/PIL/ImageQt.py[co] | |
379 | ||
380 | %if %{with python3} | |
381 | %files -n python3-%{module} | |
382 | %defattr(644,root,root,755) | |
383 | %doc README.rst CHANGES.rst docs/COPYING | |
6a785986 | 384 | %{py3_sitedir}/* |
2672936f | 385 | # These are in subpackages |
1bbcb99c | 386 | %if %{with sane} |
6a785986 | 387 | %exclude %{py3_sitedir}/*sane* |
1bbcb99c | 388 | %endif |
6a785986 JK |
389 | %exclude %{py3_sitedir}/PIL/_imagingtk* |
390 | %exclude %{py3_sitedir}/PIL/ImageTk* | |
391 | %exclude %{py3_sitedir}/PIL/SpiderImagePlugin* | |
392 | %exclude %{py3_sitedir}/PIL/ImageQt* | |
2672936f ER |
393 | |
394 | %files -n python3-%{module}-devel | |
395 | %defattr(644,root,root,755) | |
396 | %{py3_incdir}/Imaging | |
397 | ||
398 | %files -n python3-%{module}-doc | |
399 | %defattr(644,root,root,755) | |
400 | %doc Scripts | |
401 | %if %{with doc} | |
402 | %doc docs/_build/html | |
403 | %endif | |
404 | ||
1bbcb99c | 405 | %if %{with sane} |
2672936f ER |
406 | %files -n python3-%{module}-sane |
407 | %defattr(644,root,root,755) | |
408 | %doc Sane/CHANGES Sane/demo*.py Sane/sanedoc.txt | |
6a785986 | 409 | %{py3_sitedir}/*sane* |
1bbcb99c | 410 | %endif |
2672936f ER |
411 | |
412 | %files -n python3-%{module}-tk | |
413 | %defattr(644,root,root,755) | |
6a785986 JK |
414 | %{py3_sitedir}/PIL/_imagingtk* |
415 | %{py3_sitedir}/PIL/ImageTk* | |
416 | %{py3_sitedir}/PIL/SpiderImagePlugin* | |
2672936f ER |
417 | |
418 | %files -n python3-%{module}-qt | |
419 | %defattr(644,root,root,755) | |
6a785986 | 420 | %{py3_sitedir}/PIL/ImageQt* |
2672936f | 421 | %endif |