]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | %bcond_without doc # Sphinx documentation | |
6 | %bcond_without tests # unit tests | |
7 | ||
8 | %define module pycairo | |
9 | Summary: Python 2 Cairo bindings | |
10 | Summary(pl.UTF-8): Dowiązania Pythona 2 dla Cairo | |
11 | Name: python-%{module} | |
12 | Version: 1.16.3 | |
13 | Release: 5 | |
14 | License: LGPL v2.1 or MPL v1.1 | |
15 | Group: Libraries/Python | |
16 | Source0: https://github.com/pygobject/pycairo/releases/download/v%{version}/%{module}-%{version}.tar.gz | |
17 | # Source0-md5: d2a115037ccd128219f43d5ed3df7926 | |
18 | Patch0: python3.8.patch | |
19 | URL: http://cairographics.org/ | |
20 | BuildRequires: cairo-devel >= 1.13.1 | |
21 | BuildRequires: pkgconfig | |
22 | %if %{with python2} | |
23 | BuildRequires: python >= 1:2.7 | |
24 | BuildRequires: python-devel >= 1:2.7 | |
25 | # python2 only for now | |
26 | BuildRequires: python-xpyb-devel >= 1.3 | |
27 | %if %{with tests} | |
28 | BuildRequires: python-hypothesis | |
29 | BuildRequires: python-numpy | |
30 | BuildRequires: python-pytest | |
31 | %endif | |
32 | %endif | |
33 | %if %{with python3} | |
34 | BuildRequires: python3 >= 1:3.3 | |
35 | BuildRequires: python3-devel >= 1:3.3 | |
36 | %if %{with tests} | |
37 | BuildRequires: python3-hypothesis | |
38 | BuildRequires: python3-numpy | |
39 | BuildRequires: python3-pytest | |
40 | %endif | |
41 | %endif | |
42 | BuildRequires: rpm-pythonprov | |
43 | BuildRequires: rpmbuild(macros) >= 1.714 | |
44 | %if %{with doc} | |
45 | BuildRequires: python-Sphinx | |
46 | %endif | |
47 | Requires: python-libs >= 1:2.7 | |
48 | Requires: cairo >= 1.13.1 | |
49 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
50 | ||
51 | %description | |
52 | Python 2 Cairo bindings. | |
53 | ||
54 | %description -l pl.UTF-8 | |
55 | Dowiązania Pythona 2 dla Cairo. | |
56 | ||
57 | %package devel | |
58 | Summary: Development files for Python 2 pycairo | |
59 | Summary(pl.UTF-8): Pliki programistyczne pycairo dla Pythona 2 | |
60 | Group: Development/Libraries | |
61 | Requires: %{name} = %{version}-%{release} | |
62 | Requires: cairo-devel >= 1.13.1 | |
63 | Requires: python-devel >= 1:2.7 | |
64 | ||
65 | %description devel | |
66 | Development files for Python 2 pycairo. | |
67 | ||
68 | %description devel -l pl.UTF-8 | |
69 | Pliki programistyczne pycairo dla Pythona 2. | |
70 | ||
71 | %package -n python3-%{module} | |
72 | Summary: Python 3 Cairo bindings | |
73 | Summary(pl.UTF-8): Dowiązania Pythona 3 dla Cairo | |
74 | Group: Libraries/Python | |
75 | Requires: cairo >= 1.13.1 | |
76 | Requires: python3-libs >= 1:3.3 | |
77 | ||
78 | %description -n python3-%{module} | |
79 | Python 3 Cairo bindings. | |
80 | ||
81 | %description -n python3-%{module} -l pl.UTF-8 | |
82 | Dowiązania Pythona 3 dla Cairo. | |
83 | ||
84 | %package -n python3-%{module}-devel | |
85 | Summary: Development files for Python 3 pycairo | |
86 | Summary(pl.UTF-8): Pliki programistyczne pycairo dla Pythona 3 | |
87 | Group: Development/Libraries | |
88 | Requires: cairo-devel >= 1.13.1 | |
89 | Requires: python3-%{module} = %{version}-%{release} | |
90 | Requires: python3-devel >= 1:3.3 | |
91 | ||
92 | %description -n python3-%{module}-devel | |
93 | Development files for Python 3 pycairo. | |
94 | ||
95 | %description -n python3-%{module}-devel -l pl.UTF-8 | |
96 | Pliki programistyczne pycairo dla Pythona 3. | |
97 | ||
98 | %package apidocs | |
99 | Summary: API documentation for Python Cairo bindings | |
100 | Summary(pl.UTF-8): Dokumentacja API dla wiązań Pythona do Cairo | |
101 | Group: Documentation | |
102 | %if "%{_rpmversion}" >= "5" | |
103 | BuildArch: noarch | |
104 | %endif | |
105 | ||
106 | %description apidocs | |
107 | API documentation for Python Cairo bindings. | |
108 | ||
109 | %description apidocs -l pl.UTF-8 | |
110 | Dokumentacja API dla wiązań Pythona do Cairo. | |
111 | ||
112 | %package examples | |
113 | Summary: Example programs using Python Cairo bindings | |
114 | Summary(pl.UTF-8): Przykładowe programy w Pythonie używające Cairo | |
115 | Group: Libraries/Python | |
116 | Obsoletes: python3-pycairo-devel | |
117 | %if "%{_rpmversion}" >= "5" | |
118 | BuildArch: noarch | |
119 | %endif | |
120 | ||
121 | %description examples | |
122 | Example programs using Python Cairo bindings. | |
123 | ||
124 | %description examples -l pl.UTF-8 | |
125 | Przykładowe programy w Pythonie używające Cairo. | |
126 | ||
127 | %prep | |
128 | %setup -q -n pycairo-%{version} | |
129 | %patch0 -p1 | |
130 | ||
131 | %build | |
132 | %if %{with python2} | |
133 | %py_build %{?with_tests:test} \ | |
134 | --enable-xpyb | |
135 | %endif | |
136 | ||
137 | %if %{with python3} | |
138 | %py3_build %{?with_tests:test} | |
139 | %endif | |
140 | ||
141 | %if %{with doc} | |
142 | %{__make} -C docs | |
143 | %endif | |
144 | ||
145 | %install | |
146 | rm -rf $RPM_BUILD_ROOT | |
147 | install -d $RPM_BUILD_ROOT%{_examplesdir} | |
148 | ||
149 | %if %{with python2} | |
150 | %py_install | |
151 | ||
152 | %py_postclean | |
153 | %endif | |
154 | ||
155 | %if %{with python3} | |
156 | %py3_install | |
157 | %endif | |
158 | ||
159 | cp -a examples $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
160 | ||
161 | %clean | |
162 | rm -rf $RPM_BUILD_ROOT | |
163 | ||
164 | %if %{with python2} | |
165 | %files | |
166 | %defattr(644,root,root,755) | |
167 | %doc COPYING NEWS README.rst | |
168 | %dir %{py_sitedir}/cairo | |
169 | %attr(755,root,root) %{py_sitedir}/cairo/_cairo.so | |
170 | %{py_sitedir}/cairo/__init__.py[co] | |
171 | %{py_sitedir}/cairo/__init__.pyi | |
172 | %{py_sitedir}/cairo/include | |
173 | %{py_sitedir}/pycairo-%{version}-py*.egg-info | |
174 | ||
175 | %files devel | |
176 | %defattr(644,root,root,755) | |
177 | %dir %{_includedir}/pycairo | |
178 | %{_includedir}/pycairo/pycairo.h | |
179 | %{_pkgconfigdir}/pycairo.pc | |
180 | %endif | |
181 | ||
182 | %if %{with python3} | |
183 | %files -n python3-%{module} | |
184 | %defattr(644,root,root,755) | |
185 | %doc COPYING NEWS README.rst | |
186 | %dir %{py3_sitedir}/cairo | |
187 | %attr(755,root,root) %{py3_sitedir}/cairo/_cairo.cpython-*.so | |
188 | %{py3_sitedir}/cairo/__init__.py | |
189 | %{py3_sitedir}/cairo/__init__.pyi | |
190 | %{py3_sitedir}/cairo/__pycache__ | |
191 | %{py3_sitedir}/cairo/include | |
192 | %{py3_sitedir}/pycairo-%{version}-py*.egg-info | |
193 | ||
194 | %files -n python3-%{module}-devel | |
195 | %defattr(644,root,root,755) | |
196 | %dir %{_includedir}/pycairo | |
197 | %{_includedir}/pycairo/py3cairo.h | |
198 | %{_pkgconfigdir}/py3cairo.pc | |
199 | %endif | |
200 | ||
201 | %if %{with doc} | |
202 | %files apidocs | |
203 | %defattr(644,root,root,755) | |
204 | %doc docs/_build/{_images,_static,reference,*.html,*.js} | |
205 | %endif | |
206 | ||
207 | %files examples | |
208 | %defattr(644,root,root,755) | |
209 | %{_examplesdir}/%{name}-%{version} |