2 # bootstrap building docs (pillow is required by docutils, docutils are
3 # required by sphinx; pillow build-requires sphinx)
5 # - python3: missing python3-PyQt4
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)
15 Summary: Python image processing library
16 Name: python-%{module}
19 # License: see http://www.pythonware.com/products/pil/license.htm
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
37 BuildRequires: python-PyQt4
38 BuildRequires: python-cffi
39 BuildRequires: python-devel
40 BuildRequires: python-numpy
41 BuildRequires: python-setuptools
42 BuildRequires: python-tkinter
45 BuildRequires: python-Sphinx
46 BuildRequires: python-sphinx_rtd_theme
49 BuildRequires: python3-PyQt4
50 BuildRequires: python3-cffi
51 BuildRequires: python3-devel
52 BuildRequires: python3-numpy
53 BuildRequires: python3-setuptools
54 BuildRequires: python3-tkinter
56 BuildRequires: python3-sphinx
57 BuildRequires: python3-sphinx_rtd_theme
60 # For EpsImagePlugin.py
62 Provides: python-PIL = %{version}-%{release}
63 Provides: pythonegg(pil) = %{version}
64 Obsoletes: python-PIL < 1:1.1.8
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))')
72 Python image processing library, fork of the Python Imaging Library
75 This library provides extensive file format support, an efficient
76 internal representation, and powerful image processing capabilities.
78 There are five subpackages:
80 - qt (PIL image wrapper for Qt),
82 - sane (scanning devices interface),
84 - devel (development),
85 - doc (documentation).
88 Summary: Development files for %{name}
89 Group: Development/Libraries
90 Requires: %{name} = %{version}-%{release}
91 Requires: libjpeg-devel
92 Requires: python-devel
94 Provides: python-PIL-devel = %{version}-%{release}
95 Obsoletes: python-PIL-devel < 1:1.1.8
98 Development files for %{name}.
101 Summary: Documentation for %{name}
103 Requires: %{name} = %{version}-%{release}
104 %if "%{_rpmversion}" >= "5"
109 Documentation for %{name}.
112 Summary: Python module for using scanners
114 Requires: %{name} = %{version}-%{release}
115 Provides: python-PIL-sane = %{version}-%{release}
116 Obsoletes: python-PIL-sane < 1:1.1.8
119 This package contains the sane module for Python which provides access
120 to various raster scanning devices such as flatbed scanners and
124 Summary: Tk interface for %{name}
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
132 Tk interface for %{name}.
135 Summary: PIL image wrapper for Qt
137 Requires: %{name} = %{version}-%{release}
138 Requires: python-PyQt4
139 Provides: python-PIL-qt = %{version}-%{release}
142 PIL image wrapper for Qt.
144 %package -n python3-%{module}
145 Summary: Python 3 image processing library
146 Provides: python3-PIL = %{version}-%{release}
148 %description -n python3-%{module}
149 Python image processing library, fork of the Python Imaging Library
152 This library provides extensive file format support, an efficient
153 internal representation, and powerful image processing capabilities.
155 There are five subpackages:
157 - qt (PIL image wrapper for Qt),
159 - sane (scanning devices interface),
161 - devel (development),
162 - doc (documentation).
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
172 %description -n python3-%{module}-devel
173 Development files for python3-%{module}.
175 %package -n python3-%{module}-doc
176 Summary: Documentation for python3-%{module}
178 Requires: python3-%{module} = %{version}-%{release}
179 %if "%{_rpmversion}" >= "5"
183 %description -n python3-%{module}-doc
184 Documentation for python3-%{module}.
186 %package -n python3-%{module}-sane
187 Summary: Python module for using scanners
189 Requires: python3-%{module} = %{version}-%{release}
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
196 %package -n python3-%{module}-tk
197 Summary: Tk interface for python3-%{module}
199 Requires: python-tkinter
200 Requires: python3-%{module} = %{version}-%{release}
202 %description -n python3-%{module}-tk
203 Tk interface for python3-%{module}.
205 %package -n python3-%{module}-qt
206 Summary: PIL image wrapper for Qt
208 Requires: python3-%{module} = %{version}-%{release}
209 Requires: python3-PyQt4
210 Obsoletes: python3-%{module} <= 2.0.0-5.git93a488e8
212 %description -n python3-%{module}-qt
213 PIL image wrapper for Qt.
216 %setup -q -n Pillow-%{version}
218 # Strip shebang on non-executable file
219 sed -i 1d PIL/OleFileIO.py
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
226 # Make sample scripts non-executable
227 chmod -x Scripts/diffcover-run.sh
228 chmod -x Scripts/diffcover-install.sh
231 # Create Python 3 source tree
237 # Build Python 2 modules
238 find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python}|'
239 CFLAGS="%{rpmcflags}" %{__python} setup.py build
243 CFLAGS="%{rpmcflags}" %{__python} setup.py build
249 PYTHONPATH=$PWD/../build/%py2_libbuilddir %{__make} html
250 rm -f _build/html/.buildinfo
255 # Build Python 3 modules
257 find -name '*.py' | xargs sed -i '1s|^#!.*python|#!%{__python3}|'
258 CFLAGS="%{rpmcflags}" %{__python3} setup.py build
262 CFLAGS="%{rpmcflags}" %{__python3} setup.py build
268 PYTHONPATH=$PWD/../build/%py3_libbuilddir make html SPHINXBUILD=sphinx-build-%python3_version
269 rm -f _build/html/.buildinfo
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
285 # Check Python 3 modules
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
297 rm -rf $RPM_BUILD_ROOT
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 \
304 --root=$RPM_BUILD_ROOT
308 %{__python} setup.py install --skip-build \
310 --root=$RPM_BUILD_ROOT
317 # Fix non-standard-executable-perm
318 chmod +x $RPM_BUILD_ROOT%{py_sitedir}/PIL/*.so
320 chmod +x $RPM_BUILD_ROOT%{py_sitedir}/*.so
324 # Install Python 3 modules
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 \
330 --root=$RPM_BUILD_ROOT
334 %{__python3} setup.py install --skip-build \
336 --root=$RPM_BUILD_ROOT
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
345 # The scripts are packaged in %doc
346 rm -rf $RPM_BUILD_ROOT%{_bindir}
349 rm -rf $RPM_BUILD_ROOT
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
360 # These are in subpackages
362 %exclude %{py_sitedir}/*sane*
364 %exclude %{py_sitedir}/PIL/_imagingtk*
365 %exclude %{py_sitedir}/PIL/ImageTk*
366 %exclude %{py_sitedir}/PIL/SpiderImagePlugin*
367 %exclude %{py_sitedir}/PIL/ImageQt*
370 %defattr(644,root,root,755)
371 %{py2_incdir}/Imaging
374 %defattr(644,root,root,755)
377 %doc docs/_build/html
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
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]
396 %defattr(644,root,root,755)
397 %{py_sitedir}/PIL/ImageQt.py[co]
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
406 %exclude %{python3_sitearch}/*sane*
408 %exclude %{python3_sitearch}/PIL/_imagingtk*
409 %exclude %{python3_sitearch}/PIL/ImageTk*
410 %exclude %{python3_sitearch}/PIL/SpiderImagePlugin*
411 %exclude %{python3_sitearch}/PIL/ImageQt*
413 %files -n python3-%{module}-devel
414 %defattr(644,root,root,755)
415 %{py3_incdir}/Imaging
417 %files -n python3-%{module}-doc
418 %defattr(644,root,root,755)
421 %doc docs/_build/html
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*
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*
437 %files -n python3-%{module}-qt
438 %defattr(644,root,root,755)
439 %{python3_sitearch}/PIL/ImageQt*