]>
Commit | Line | Data |
---|---|---|
764150ae JB |
1 | # NOTE: -qt supports PyQt5 > PySide2 modules (in order of preference) |
2 | # | |
3 | # bootstrap building docs (pillow is required by docutils, docutils are | |
4 | # required by sphinx; pillow build-requires sphinx) | |
5 | ||
6 | # Conditional build: | |
7 | %bcond_with doc # Sphinx documentation (crashes - without DISPLAY?) | |
8 | %bcond_without tests # unit tests | |
9 | ||
10 | %define module pillow | |
11 | Summary: Python 3 image processing library | |
12 | Summary(pl.UTF-8): Biblioteka do przetwarzania obrazów dla Pythona 3 | |
13 | Name: python3-%{module} | |
fad6cf98 | 14 | Version: 8.1.0 |
3df88cac | 15 | Release: 2 |
764150ae JB |
16 | # License: see http://www.pythonware.com/products/pil/license.htm |
17 | License: MIT | |
18 | Group: Libraries/Python | |
19 | #Source0Download: https://pypi.org/simple/pillow/ | |
20 | Source0: https://files.pythonhosted.org/packages/source/P/Pillow/Pillow-%{version}.tar.gz | |
fad6cf98 | 21 | # Source0-md5: 9e3ab8e9b30993099ae9fee73ff92276 |
764150ae JB |
22 | Patch0: %{name}-subpackage.patch |
23 | Patch1: x32.patch | |
24 | URL: https://python-pillow.org/ | |
25 | BuildRequires: freetype-devel >= 2 | |
26 | BuildRequires: ghostscript | |
27 | BuildRequires: lcms2-devel >= 2 | |
28 | BuildRequires: libimagequant-devel | |
29 | BuildRequires: libjpeg-devel | |
30 | BuildRequires: libraqm-devel | |
fad6cf98 | 31 | BuildRequires: libtiff-devel >= 4 |
764150ae | 32 | BuildRequires: libwebp-devel |
fad6cf98 | 33 | BuildRequires: libxcb-devel |
764150ae JB |
34 | BuildRequires: openjpeg2-devel >= 2 |
35 | BuildRequires: pkgconfig | |
36 | BuildRequires: python3-cffi | |
fad6cf98 | 37 | BuildRequires: python3-devel >= 1:3.6 |
764150ae JB |
38 | BuildRequires: python3-numpy |
39 | BuildRequires: python3-setuptools | |
40 | BuildRequires: python3-tkinter | |
fad6cf98 | 41 | BuildRequires: rpmbuild(macros) >= 1.752 |
764150ae JB |
42 | BuildRequires: tk-devel |
43 | BuildRequires: zlib-devel | |
fad6cf98 JB |
44 | %if %{with tests} |
45 | BuildRequires: python3-olefile | |
46 | %endif | |
764150ae | 47 | %if %{with doc} |
fad6cf98 JB |
48 | BuildRequires: python3-sphinx_issues |
49 | BuildRequires: python3-sphinx_removed_in | |
764150ae | 50 | BuildRequires: python3-sphinx_rtd_theme |
fad6cf98 | 51 | BuildRequires: sphinx-pdg-3 >= 2.4 |
764150ae JB |
52 | %endif |
53 | # For EpsImagePlugin.py | |
54 | Requires: ghostscript | |
55 | Provides: python3-PIL = %{version}-%{release} | |
56 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
57 | ||
58 | %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))') | |
59 | ||
60 | %description | |
61 | Python image processing library, fork of the Python Imaging Library | |
62 | (PIL). | |
63 | ||
64 | This library provides extensive file format support, an efficient | |
65 | internal representation, and powerful image processing capabilities. | |
66 | ||
67 | There are four additional subpackages: | |
68 | - tk (Tk interface), | |
69 | - qt (PIL image wrapper for Qt), | |
70 | - devel (development), | |
71 | - doc (documentation). | |
72 | ||
73 | %description -l pl.UTF-8 | |
74 | Pythonowa biblioteka do przetwarzania obrazów - odgałęzienie projektu | |
75 | PIL (Python Imaging Library). | |
76 | ||
77 | Ta biblioteka zapewnia obsługę wielu formatów plików, wydajną | |
78 | reprezentację wewnętrzną oraz potężne możliwości przetwarzania. | |
79 | ||
80 | Są cztery dodatkowe podpakiety: | |
81 | - tk (interfejs Tk), | |
82 | - qt (obudowanie obrazów PIL dla Qt), | |
83 | - devel (do programowania), | |
84 | - doc (dokumentacja). | |
85 | ||
86 | %package devel | |
87 | Summary: Development files for Pillow module | |
88 | Summary(pl.UTF-8): Pliki programistyczne modułu Pillow | |
89 | Group: Development/Libraries | |
90 | Requires: %{name} = %{version}-%{release} | |
91 | Requires: libjpeg-devel | |
92 | Requires: python3-devel >= 1:3.5 | |
93 | Requires: zlib-devel | |
94 | ||
95 | %description devel | |
96 | Development files for Pillow module. | |
97 | ||
98 | %description devel -l pl.UTF-8 | |
99 | Pliki programistyczne modułu Pillow. | |
100 | ||
101 | %package doc | |
102 | Summary: Documentation for Pillow module | |
103 | Summary(pl.UTF-8): Dokumentacja do modułu Pillow | |
104 | Group: Documentation | |
105 | Requires: %{name} = %{version}-%{release} | |
9c4e31b2 | 106 | BuildArch: noarch |
764150ae JB |
107 | |
108 | %description doc | |
109 | Documentation for Pillow module. | |
110 | ||
111 | %description doc -l pl.UTF-8 | |
112 | Dokumentacja do modułu Pillow. | |
113 | ||
114 | %package tk | |
115 | Summary: Tk interface for Pillow module | |
116 | Summary(pl.UTF-8): Interfejs Tk do modułu Pillow | |
117 | Group: Libraries/Python | |
118 | Requires: %{name} = %{version}-%{release} | |
119 | Requires: python3-tkinter >= 1:3.5 | |
120 | ||
121 | %description tk | |
122 | Tk interface for Pillow module. | |
123 | ||
124 | %description tk -l pl.UTF-8 | |
125 | Interfejs Tk do modułu Pillow. | |
126 | ||
127 | %package qt | |
128 | Summary: PIL image wrapper for Qt | |
129 | Summary(pl.UTF-8): Obudowanie obrazów PIL dla Qt | |
130 | Group: Libraries/Python | |
131 | Requires: %{name} = %{version}-%{release} | |
132 | Requires: python3-PyQt5 >= 5 | |
133 | ||
134 | %description qt | |
135 | PIL image wrapper for Qt. | |
136 | ||
137 | %description qt -l pl.UTF-8 | |
138 | Obudowanie obrazów PIL dla Qt. | |
139 | ||
140 | %prep | |
141 | %setup -q -n Pillow-%{version} | |
142 | %patch0 -p1 | |
143 | %if "%{_lib}" == "libx32" | |
144 | %patch1 -p1 | |
145 | %endif | |
146 | ||
147 | %build | |
148 | %py3_build | |
149 | ||
150 | %if %{with doc} | |
151 | PYTHONPATH=$(pwd)/build-3/%{py3_libbuilddir} \ | |
152 | %{__make} -C docs html \ | |
153 | SPHINXBUILD=sphinx-build-3 | |
154 | %endif | |
155 | ||
156 | %if %{with tests} | |
157 | # Check Python 3 modules | |
158 | cp -R $PWD/Tests $PWD/build-3/%py3_libbuilddir/Tests | |
159 | cp -R $PWD/selftest.py $PWD/build-3/%py3_libbuilddir/selftest.py | |
160 | cd build-3/%py3_libbuilddir | |
fad6cf98 JB |
161 | PYTHONPATH=$PWD \ |
162 | %{__python3} selftest.py | |
163 | cd ../.. | |
164 | # qt test crashes without DISPLAY | |
165 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
166 | PYTHONPATH=$PWD/build-3/%py3_libbuilddir \ | |
167 | %{__python3} -m pytest Tests -k 'not test_qt_image_qapplication' | |
764150ae JB |
168 | %endif |
169 | ||
170 | %install | |
171 | rm -rf $RPM_BUILD_ROOT | |
172 | ||
173 | # Install Python 3 modules | |
174 | install -d $RPM_BUILD_ROOT%{py3_incdir}/Imaging | |
175 | cp -p src/libImaging/*.h $RPM_BUILD_ROOT%{py3_incdir}/Imaging | |
176 | %py3_install | |
177 | ||
178 | # Fix non-standard-executable-perm | |
fad6cf98 | 179 | chmod 755 $RPM_BUILD_ROOT%{py3_sitedir}/PIL/*.so |
764150ae | 180 | |
c5fd99f2 | 181 | %if %{with tests} |
764150ae | 182 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/{Tests,selftest.py,__pycache__/selftest.*} |
c5fd99f2 | 183 | %endif |
764150ae JB |
184 | |
185 | %clean | |
186 | rm -rf $RPM_BUILD_ROOT | |
187 | ||
188 | %files | |
189 | %defattr(644,root,root,755) | |
fad6cf98 | 190 | %doc CHANGES.rst LICENSE README.md |
764150ae JB |
191 | %dir %{py3_sitedir}/PIL |
192 | %{py3_sitedir}/PIL/*.py | |
193 | %attr(755,root,root) %{py3_sitedir}/PIL/_imaging.cpython-*.so | |
194 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingcms.cpython-*.so | |
195 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingft.cpython-*.so | |
196 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingmath.cpython-*.so | |
197 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingmorph.cpython-*.so | |
198 | %attr(755,root,root) %{py3_sitedir}/PIL/_webp.cpython-*.so | |
199 | %dir %{py3_sitedir}/PIL/__pycache__ | |
200 | %{py3_sitedir}/PIL/__pycache__/*.py[co] | |
201 | %{py3_sitedir}/Pillow-%{version}-py*.egg-info | |
202 | # These are in subpackages | |
203 | %exclude %{py3_sitedir}/PIL/ImageQt.py | |
204 | %exclude %{py3_sitedir}/PIL/ImageTk.py | |
205 | %exclude %{py3_sitedir}/PIL/SpiderImagePlugin.py | |
206 | %exclude %{py3_sitedir}/PIL/_tkinter_finder.py | |
207 | %exclude %{py3_sitedir}/PIL/__pycache__/ImageQt.cpython-*.py[co] | |
208 | %exclude %{py3_sitedir}/PIL/__pycache__/ImageTk.cpython-*.py[co] | |
209 | %exclude %{py3_sitedir}/PIL/__pycache__/SpiderImagePlugin.cpython-*.py[co] | |
210 | %exclude %{py3_sitedir}/PIL/__pycache__/_tkinter_finder.cpython-*.py[co] | |
211 | ||
212 | %files devel | |
213 | %defattr(644,root,root,755) | |
214 | %{py3_incdir}/Imaging | |
215 | ||
216 | %if %{with doc} | |
217 | %files doc | |
218 | %defattr(644,root,root,755) | |
219 | %doc docs/_build/html | |
220 | %endif | |
221 | ||
222 | %files tk | |
223 | %defattr(644,root,root,755) | |
224 | %attr(755,root,root) %{py3_sitedir}/PIL/_imagingtk.cpython-*.so | |
225 | %{py3_sitedir}/PIL/ImageTk.py | |
226 | %{py3_sitedir}/PIL/SpiderImagePlugin.py | |
227 | %{py3_sitedir}/PIL/_tkinter_finder.py | |
228 | %{py3_sitedir}/PIL/__pycache__/ImageTk.cpython-*.py[co] | |
229 | %{py3_sitedir}/PIL/__pycache__/SpiderImagePlugin.cpython-*.py[co] | |
230 | %{py3_sitedir}/PIL/__pycache__/_tkinter_finder.cpython-*.py[co] | |
231 | ||
232 | %files qt | |
233 | %defattr(644,root,root,755) | |
234 | %{py3_sitedir}/PIL/ImageQt.py | |
235 | %{py3_sitedir}/PIL/__pycache__/ImageQt.cpython-*.py[co] |