- from PLD, fixed python2 files
[packages/python-pygobject.git] / python-pygobject.spec
1 #
2 # Conditional build:
3 %bcond_without  python2         # Python 2.x module
4 %bcond_without  python3         # Python 3.x module
5
6 %define         module  pygobject
7 Summary:        Python bindings for GObject library
8 Summary(pl.UTF-8):      Wiązania Pythona do biblioteki GObject
9 Name:           python-%{module}
10 Version:        2.28.6
11 Release:        16
12 License:        LGPL v2+
13 Group:          Libraries/Python
14 Source0:        http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/%{module}-%{version}.tar.xz
15 # Source0-md5:  9415cb7f2b3a847f2310ccea258b101e
16 Patch0:         %{name}-pc.patch
17 Patch1:         %{name}-pyc.patch
18 Patch2:         gio.patch
19 Patch3:         %{name}-pycairo.patch
20 URL:            http://www.pygtk.org/
21 BuildRequires:  autoconf >= 2.52
22 BuildRequires:  automake >= 1:1.12.5
23 BuildRequires:  glib2-devel >= 1:2.24.0
24 BuildRequires:  gobject-introspection-devel >= 0.10.2
25 BuildRequires:  libffi-devel >= 3.0
26 BuildRequires:  libtool
27 BuildRequires:  libxslt-progs >= 1.1.22
28 BuildRequires:  pkgconfig
29 BuildRequires:  rpm-pythonprov
30 BuildRequires:  tar >= 1:1.22
31 BuildRequires:  xz
32 %if %{with python2}
33 BuildRequires:  python-devel >= 1:2.5.2
34 BuildRequires:  python-pycairo-devel >= 1.2.0
35 Requires:       python-modules
36 %endif
37 %if %{with python3}
38 BuildRequires:  python3
39 BuildRequires:  python3-devel
40 BuildRequires:  python3-modules
41 BuildRequires:  python3-pycairo-devel >= 1.8.10
42 %endif
43 Requires:       glib2 >= 1:2.24.0
44 Requires:       gobject-introspection >= 0.9.5
45 Provides:       python-pygtk-gobject
46 Obsoletes:      python-pygtk-glarea
47 Obsoletes:      python-pygtk-gobject
48 Conflicts:      python-pygtk < 1:1.0
49 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
50
51 # python provides Py* and _Py* symbols at runtime
52 %define         skip_post_check_so      libpyglib-2.0-python[23]?.so.*
53
54 %description
55 Python bindings for GObject library.
56
57 %description -l pl.UTF-8
58 Wiązania Pythona do biblioteki GObject.
59
60 %package devel
61 Summary:        Python bindings for GObject library
62 Summary(pl.UTF-8):      Wiązania Pythona do biblioteki GObject
63 Group:          Development/Languages/Python
64 Requires:       %{name} = %{version}-%{release}
65 Requires:       glib2-devel >= 1:2.24.0
66 Requires:       libffi-devel >= 3.0
67 Requires:       python-devel >= 1:2.5.2
68
69 %description devel
70 This package contains files required to build wrappers for GObject
71 addon libraries so that they interoperate with Python bindings.
72
73 %description devel -l pl.UTF-8
74 Pakiet zawiera pliki wymagane do zbudowania funkcji do biblioteki
75 GObject, tak by mogły te biblioteki kooperować z wiązaniami Pythona.
76
77 %package -n python3-pygobject
78 Summary:        Python 3.x bindings for GObject library
79 Summary(pl.UTF-8):      Wiązania Pythona 3.x do biblioteki GObject
80 Group:          Libraries/Python
81
82 %description -n python3-pygobject
83 Python 3.x bindings for GObject library.
84
85 %description -n python3-pygobject -l pl.UTF-8
86 Wiązania Pythona 3.x do biblioteki GObject.
87
88 %package -n python3-pygobject-devel
89 Summary:        Python bindings for GObject library
90 Summary(pl.UTF-8):      Wiązania Pythona do biblioteki GObject
91 Group:          Development/Languages/Python
92 Requires:       glib2-devel >= 1:2.24.0
93 Requires:       libffi-devel >= 3.0
94 Requires:       python3-devel
95 Requires:       python3-pygobject = %{version}-%{release}
96
97 %description -n python3-pygobject-devel
98 This package contains files required to build wrappers for GObject
99 addon libraries so that they interoperate with Python bindings.
100
101 %description -n python3-pygobject-devel -l pl.UTF-8
102 Pakiet zawiera pliki wymagane do zbudowania funkcji do biblioteki
103 GObject, tak by mogły te biblioteki kooperować z wiązaniami Pythona.
104
105 %package examples
106 Summary:        Example programs for GObject library
107 Summary(pl.UTF-8):      Programy przykładowe dla biblioteki GObject
108 Group:          Development/Languages/Python
109 Requires:       %{name}-devel = %{version}-%{release}
110 Obsoletes:      python-pygtk
111
112 %description examples
113 This package contains example programs for GObject library.
114
115 %description examples -l pl.UTF-8
116 Ten pakiet zawiera przykładowe programy dla biblioteki GObject.
117
118 %package apidocs
119 Summary:        pygobject API documentation
120 Summary(pl.UTF-8):      Dokumentacja API pygobject
121 Group:          Documentation
122 Requires:       gtk-doc-common
123 %if "%{_rpmversion}" >= "5"
124 BuildArch:      noarch
125 %endif
126
127 %description apidocs
128 pygobject API documentation.
129
130 %description apidocs -l pl.UTF-8
131 Dokumentacja API pygobject.
132
133 %prep
134 %setup -q -n %{module}-%{version}
135 %patch0 -p1
136 %patch1 -p1
137 %patch2 -p1
138 %patch3 -p1
139
140 %build
141 %{__libtoolize}
142 %{__aclocal} -I m4
143 %{__autoconf}
144 %{__autoheader}
145 %{__automake}
146 %if %{with python3}
147 mkdir py3
148 cd py3
149 ../%configure \
150         PYTHON=/usr/bin/python3 \
151         --disable-introspection \
152         --disable-silent-rules
153 %{__make}
154 cd ..
155 %endif
156 %if %{with python2}
157 mkdir py2
158 cd py2
159 ../%configure \
160         PYTHON=%{__python} \
161         --disable-introspection \
162         --disable-silent-rules
163 %{__make}
164 cd ..
165 %endif
166
167 %install
168 rm -rf $RPM_BUILD_ROOT
169 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
170
171 %if %{with python3}
172 %{__make} -C py3 -j 1 install \
173         DESTDIR=$RPM_BUILD_ROOT \
174         TARGET_DIR=%{_gtkdocdir}/%{module}
175
176 # only python2 codegen is packaged
177 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/pygobject/2.0/codegen
178 %endif
179
180 %if %{with python2}
181 %{__make} -C py2 -j 1 install \
182         DESTDIR=$RPM_BUILD_ROOT \
183         TARGET_DIR=%{_gtkdocdir}/%{module}
184 %endif
185
186 cp -a examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
187
188 %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
189
190 %if %{with python2}
191 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/{gtk-2.0/,}*/*.la
192 %py_comp $RPM_BUILD_ROOT%{_datadir}/%{module}/2.0/codegen
193 %py_ocomp $RPM_BUILD_ROOT%{_datadir}/%{module}/2.0/codegen
194 %py_postclean %{_datadir}/%{module}/2.0/codegen
195 %endif
196 %if %{with python3}
197 %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/*/*.la
198 %endif
199
200 %clean
201 rm -rf $RPM_BUILD_ROOT
202
203 %post   -p /sbin/ldconfig
204 %postun -p /sbin/ldconfig
205
206 %if %{with python2}
207 %files
208 %defattr(644,root,root,755)
209 %doc AUTHORS ChangeLog NEWS README
210 %attr(755,root,root) %{_libdir}/libpyglib-2.0-python.so.*.*.*
211 %attr(755,root,root) %ghost %{_libdir}/libpyglib-2.0-python.so.0
212 %dir %{py_sitedir}/gtk-2.0
213 %dir %{py_sitedir}/gtk-2.0/gio
214 %attr(755,root,root) %{py_sitedir}/gtk-2.0/gio/_gio.so
215 %attr(755,root,root) %{py_sitedir}/gtk-2.0/gio/unix.so
216 %{py_sitedir}/gtk-2.0/gio/*.py[co]
217 %dir %{py_sitedir}/glib
218 %attr(755,root,root) %{py_sitedir}/glib/_glib.so
219 %{py_sitedir}/glib/*.py[co]
220 %dir %{py_sitedir}/gobject
221 %attr(755,root,root) %{py_sitedir}/gobject/_gobject.so
222 %{py_sitedir}/gobject/*.py[co]
223 %{py_sitedir}/gtk-2.0/*.py[co]
224 %{py_sitedir}/pygtk.py[co]
225 %{py_sitedir}/pygtk.pth
226 %dir %{_datadir}/%{module}
227 %dir %{_datadir}/%{module}/xsl
228
229 %files devel
230 %defattr(644,root,root,755)
231 %attr(755,root,root) %{_bindir}/pygobject-codegen-2.0
232 %attr(755,root,root) %{_libdir}/libpyglib-2.0-python.so
233 %{_includedir}/pygtk-2.0
234 %{_pkgconfigdir}/pygobject-2.0.pc
235 %dir %{_datadir}/%{module}/2.0
236 %dir %{_datadir}/%{module}/2.0/codegen
237 %{_datadir}/%{module}/2.0/codegen/*.py[co]
238 %dir %{_datadir}/%{module}/2.0/defs
239 %{_datadir}/%{module}/2.0/defs/*.defs
240 %{_datadir}/%{module}/2.0/defs/*.override
241 %{_datadir}/%{module}/xsl/*.py
242 %{_datadir}/%{module}/xsl/*.xsl
243 %endif
244
245 %if %{with python3}
246 %files -n python3-pygobject
247 %defattr(644,root,root,755)
248 %doc AUTHORS ChangeLog NEWS README
249 %attr(755,root,root) %{_libdir}/libpyglib-2.0-python3.so.*.*.*
250 %attr(755,root,root) %ghost %{_libdir}/libpyglib-2.0-python3.so.0
251 %dir %{py3_sitedir}/gtk-2.0
252 %dir %{py3_sitedir}/gtk-2.0/gio
253 %{py3_sitedir}/gtk-2.0/gio/*.py
254 %{py3_sitedir}/gtk-2.0/gio/__pycache__
255 %dir %{py3_sitedir}/glib
256 %attr(755,root,root) %{py3_sitedir}/glib/_glib.*so
257 %{py3_sitedir}/glib/*.py
258 %{py3_sitedir}/glib/__pycache__
259 %dir %{py3_sitedir}/gobject
260 %attr(755,root,root) %{py3_sitedir}/gobject/_gobject.*so
261 %{py3_sitedir}/gobject/*.py
262 %{py3_sitedir}/gobject/__pycache__
263 %{py3_sitedir}/gtk-2.0/*.py
264 %{py3_sitedir}/gtk-2.0/__pycache__
265 %{py3_sitedir}/pygtk.py
266 %{py3_sitedir}/pygtk.pth
267 %{py3_sitedir}/__pycache__
268
269 %files -n python3-pygobject-devel
270 %defattr(644,root,root,755)
271 %attr(755,root,root) %{_libdir}/libpyglib-2.0-python3.so
272 %endif
273
274 %files examples
275 %defattr(644,root,root,755)
276 %{_examplesdir}/%{name}-%{version}
277
278 %files apidocs
279 %defattr(644,root,root,755)
280 %{_gtkdocdir}/%{module}