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