]> git.pld-linux.org Git - packages/python-pillow.git/blame - python-pillow.spec
Version 3.2.0.
[packages/python-pillow.git] / python-pillow.spec
CommitLineData
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
13Summary: Python image processing library
14Name: python-%{module}
98a34571 15Version: 3.2.0
6a785986 16Release: 1
2672936f
ER
17# License: see http://www.pythonware.com/products/pil/license.htm
18License: MIT
19Group: Libraries/Python
98a34571
MK
20Source0: https://pypi.python.org/packages/e2/af/0a3981fffc5cd43078eb8b1057702e0dd2d5771e5aaa36cbd140e32f8473/Pillow-3.2.0.tar.gz#md5=7cfd093c11205d9e2ebe3c51dfcad510
21# Source0-md5: 7cfd093c11205d9e2ebe3c51dfcad510
c023b5ed 22Patch0: x32.patch
2672936f
ER
23URL: http://python-pillow.github.io/
24BuildRequires: freetype-devel
25BuildRequires: ghostscript
26BuildRequires: lcms2-devel
27BuildRequires: libjpeg-devel
1bbcb99c 28BuildRequires: libtiff-devel
2672936f
ER
29BuildRequires: libwebp-devel
30BuildRequires: openjpeg2-devel
2453682c 31BuildRequires: rpmbuild(macros) >= 1.710
1bbcb99c 32%{?with_sane:BuildRequires: sane-backends-devel}
2672936f
ER
33BuildRequires: tk-devel
34BuildRequires: zlib-devel
35%if %{with python2}
36BuildRequires: python-PyQt4
37BuildRequires: python-cffi
38BuildRequires: python-devel
39BuildRequires: python-numpy
40BuildRequires: python-setuptools
41BuildRequires: python-tkinter
42%endif
43%if %{with doc}
44BuildRequires: python-Sphinx
1bbcb99c 45BuildRequires: python-sphinx_rtd_theme
2672936f
ER
46%endif
47%if %{with python3}
48BuildRequires: python3-PyQt4
49BuildRequires: python3-cffi
50BuildRequires: python3-devel
51BuildRequires: python3-numpy
52BuildRequires: python3-setuptools
53BuildRequires: python3-tkinter
54%if %{with doc}
55BuildRequires: python3-sphinx
1bbcb99c 56BuildRequires: python3-sphinx_rtd_theme
2672936f
ER
57%endif
58%endif
59# For EpsImagePlugin.py
60Requires: ghostscript
61Provides: python-PIL = %{version}-%{release}
04966afa 62Provides: pythonegg(pil) = %{version}
bd0427cb 63Obsoletes: 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
71Python image processing library, fork of the Python Imaging Library
72(PIL)
73
74This library provides extensive file format support, an efficient
75internal representation, and powerful image processing capabilities.
76
1bbcb99c
ER
77There 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
87Summary: Development files for %{name}
88Group: Development/Libraries
89Requires: %{name} = %{version}-%{release}
90Requires: libjpeg-devel
91Requires: python-devel
92Requires: zlib-devel
93Provides: python-PIL-devel = %{version}-%{release}
bd0427cb 94Obsoletes: python-PIL-devel < 1:1.1.8
2672936f
ER
95
96%description devel
97Development files for %{name}.
98
99%package doc
100Summary: Documentation for %{name}
101Group: Documentation
102Requires: %{name} = %{version}-%{release}
103%if "%{_rpmversion}" >= "5"
104BuildArch: noarch
105%endif
106
107%description doc
108Documentation for %{name}.
109
110%package sane
111Summary: Python module for using scanners
112Group: Libraries
113Requires: %{name} = %{version}-%{release}
114Provides: python-PIL-sane = %{version}-%{release}
bd0427cb 115Obsoletes: python-PIL-sane < 1:1.1.8
2672936f
ER
116
117%description sane
118This package contains the sane module for Python which provides access
119to various raster scanning devices such as flatbed scanners and
120digital cameras.
121
122%package tk
123Summary: Tk interface for %{name}
124Group: Libraries
125Requires: %{name} = %{version}-%{release}
126Requires: python-tkinter
127Provides: python-PIL-tk = %{version}-%{release}
bd0427cb 128Obsoletes: python-PIL-tk < 1:1.1.8
2672936f
ER
129
130%description tk
131Tk interface for %{name}.
132
133%package qt
134Summary: PIL image wrapper for Qt
135Group: Libraries
136Requires: %{name} = %{version}-%{release}
137Requires: python-PyQt4
138Provides: python-PIL-qt = %{version}-%{release}
139
140%description qt
141PIL image wrapper for Qt.
142
143%package -n python3-%{module}
144Summary: Python 3 image processing library
145Provides: python3-PIL = %{version}-%{release}
146
147%description -n python3-%{module}
148Python image processing library, fork of the Python Imaging Library
149(PIL)
150
151This library provides extensive file format support, an efficient
152internal representation, and powerful image processing capabilities.
153
1bbcb99c
ER
154There 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
164Summary: Development files for python3-%{module}
165Group: Development/Libraries
166Requires: libjpeg-devel
167Requires: python3-%{module} = %{version}-%{release}
168Requires: python3-devel
169Requires: zlib-devel
170
171%description -n python3-%{module}-devel
172Development files for python3-%{module}.
173
174%package -n python3-%{module}-doc
175Summary: Documentation for python3-%{module}
176Group: Documentation
177Requires: python3-%{module} = %{version}-%{release}
178%if "%{_rpmversion}" >= "5"
179BuildArch: noarch
180%endif
181
182%description -n python3-%{module}-doc
183Documentation for python3-%{module}.
184
185%package -n python3-%{module}-sane
186Summary: Python module for using scanners
187Group: Libraries
188Requires: python3-%{module} = %{version}-%{release}
189
190%description -n python3-%{module}-sane
191This package contains the sane module for Python which provides access
192to various raster scanning devices such as flatbed scanners and
193digital cameras.
194
195%package -n python3-%{module}-tk
196Summary: Tk interface for python3-%{module}
197Group: Libraries
198Requires: python-tkinter
199Requires: python3-%{module} = %{version}-%{release}
200
201%description -n python3-%{module}-tk
202Tk interface for python3-%{module}.
203
204%package -n python3-%{module}-qt
205Summary: PIL image wrapper for Qt
206Group: Libraries
207Requires: python3-%{module} = %{version}-%{release}
208Requires: python3-PyQt4
209Obsoletes: python3-%{module} <= 2.0.0-5.git93a488e8
210
211%description -n python3-%{module}-qt
212PIL 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
222sed -i 1d PIL/OleFileIO.py
223
224# Fix file encoding
225iconv --from=ISO-8859-1 --to=UTF-8 PIL/WalImageFile.py > PIL/WalImageFile.py.new && \
226touch -r PIL/WalImageFile.py PIL/WalImageFile.py.new && \
227mv PIL/WalImageFile.py.new PIL/WalImageFile.py
228
1bbcb99c 229# Make sample scripts non-executable
98a34571 230chmod -x Scripts/pilprint.py
1bbcb99c 231
2672936f 232%build
e58ddac6 233CFLAGS="%{rpmcflags}" %py_build
2672936f 234
1bbcb99c 235%if %{with sane}
2672936f 236cd Sane
e58ddac6 237CFLAGS="%{rpmcflags}" %py_build
2672936f 238cd ..
1bbcb99c 239%endif
2672936f
ER
240
241%if %{with doc}
242cd docs
6a785986 243PYTHONPATH=$PWD/../build-2/%py2_libbuilddir %{__make} html
2672936f
ER
244rm -f _build/html/.buildinfo
245cd ..
246%endif
247
248%if %{with python3}
e58ddac6 249CFLAGS="%{rpmcflags}" %py3_build
2672936f 250
1bbcb99c 251%if %{with sane}
2672936f 252cd Sane
e58ddac6 253CFLAGS="%{rpmcflags}" %py3_build
2672936f 254cd ..
1bbcb99c 255%endif
2672936f
ER
256
257%if %{with doc}
258cd docs
6a785986 259PYTHONPATH=$PWD/../build-3/%py3_libbuilddir make html SPHINXBUILD=sphinx-build-%python3_version
2672936f
ER
260rm -f _build/html/.buildinfo
261cd ..
262%endif
2672936f
ER
263%endif
264
265%if %{with tests}
266# Check Python 2 modules
6a785986
JK
267ln -s $PWD/Images $PWD/build-2/%py2_libbuilddir/Images
268cp -R $PWD/Tests $PWD/build-2/%py2_libbuilddir/Tests
269cp -R $PWD/selftest.py $PWD/build-2/%py2_libbuilddir/selftest.py
270cd build-2/%py2_libbuilddir
2672936f
ER
271PYTHONPATH=$PWD %{__python} selftest.py
272cd ..
273
274%if %{with python3}
275# Check Python 3 modules
6a785986
JK
276ln -s $PWD/Images $PWD/build-3/%py3_libbuilddir/Images
277cp -R $PWD/Tests $PWD/build-3/%py3_libbuilddir/Tests
278cp -R $PWD/selftest.py $PWD/build-3/%py3_libbuilddir/selftest.py
279cd build-3/%py3_libbuilddir
2672936f 280PYTHONPATH=$PWD %{__python3} selftest.py
2672936f
ER
281%endif
282%endif
283
284%install
285rm -rf $RPM_BUILD_ROOT
286%if %{with python2}
287# Install Python 2 modules
288install -d $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
289cp -p libImaging/*.h $RPM_BUILD_ROOT/%{py2_incdir}/Imaging
e58ddac6 290%py_install
1bbcb99c
ER
291
292%if %{with sane}
2672936f 293cd Sane
e58ddac6 294%py_install
2672936f 295cd ..
1bbcb99c 296%endif
2672936f
ER
297
298%py_postclean
299%endif
300
301# Fix non-standard-executable-perm
302chmod +x $RPM_BUILD_ROOT%{py_sitedir}/PIL/*.so
1bbcb99c 303%if %{with sane}
2672936f 304chmod +x $RPM_BUILD_ROOT%{py_sitedir}/*.so
1bbcb99c 305%endif
2672936f
ER
306
307%if %{with python3}
308# Install Python 3 modules
2672936f
ER
309install -d $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
310cp -p libImaging/*.h $RPM_BUILD_ROOT/%{py3_incdir}/Imaging
e58ddac6 311%py3_install
1bbcb99c
ER
312
313%if %{with sane}
2672936f 314cd Sane
e58ddac6 315%py3_install
6a785986 316cd ..
1bbcb99c 317%endif
2672936f
ER
318
319# Fix non-standard-executable-perm
6a785986
JK
320chmod +x $RPM_BUILD_ROOT%{py3_sitedir}/PIL/*.so
321%if %{with sane}
322chmod +x $RPM_BUILD_ROOT%{py3_sitedir}/*.so
323%endif
2672936f
ER
324%endif
325
326# The scripts are packaged in %doc
327rm -rf $RPM_BUILD_ROOT%{_bindir}
328
329%clean
330rm -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
This page took 0.192576 seconds and 4 git commands to generate.