File python-gobject.spec of Package python-gobject

#
# spec file for package python-gobject
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           python-gobject
%define _name pygobject
Summary:        Python bindings for GObject
Version:        2.26.0
Release:        2
# NOTE: on upgrade to a new upstream version (after 2.26.0), change the various Obsoletes from <= to <
License:        LGPLv2.1+
Group:          Development/Libraries/Python
Url:            http://ftp.gnome.org/pub/GNOME/sources/pygobject/
Source:         %{_name}-%{version}.tar.bz2
# conditionally use the new Capsule API instead of PyCObject, bnc#669802
Patch0:         pygobject-2.26.0-capsule.patch
BuildRequires:  fdupes
BuildRequires:  glib2-devel
BuildRequires:  gobject-introspection-devel
BuildRequires:  python-cairo-devel
# our libffi package doesn't have a pkg-config file
# BuildRequires:  libffi-devel
BuildRequires:  python-devel
Provides:       python-gobject2 = %{version}
# Note: we keep <= (and a rpmlint warning...) until we get a version higher than 2.26.0 (when this provides/obsoletes was introduced)
Obsoletes:      python-gobject2 <= %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{py_requires}

%description
Pygobjects is an extension module for python that gives you access to
GLib's GObjects.

%package cairo
License:        LGPLv2.1+
Summary:        Python bindings for GObject -- Cairo bindings
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
Provides:       python-gobject2-cairo = %{version}
# Note: we keep <= (and a rpmlint warning...) until we get a version higher than 2.26.0 (when this provides/obsoletes was introduced)
Obsoletes:      python-gobject2-cairo <= %{version}
%define cairo_real_package %(rpm -q --qf '%{NAME}' --whatprovides cairo)
Supplements:    packageand(%{name}:%{cairo_real_package})

%description cairo
Pygobjects is an extension module for python that gives you access to
GLib's GObjects.

This package contains the Python Cairo bindings for GObject.

%package devel
License:        LGPLv2.1+
Summary:        Python bindings for GObject
Group:          Development/Libraries/Python
Requires:       %{name} = %{version} glib2-devel
Provides:       python-gobject2-devel = %{version}
# Note: we keep <= (and a rpmlint warning...) until we get a version higher than 2.26.0 (when this provides/obsoletes was introduced)
Obsoletes:      python-gobject2-devel <= %{version}
Provides:       python-gobject2-doc = %{version}
Obsoletes:      python-gobject2-doc < %{version}

%description devel
This package contains files required to build wrappers for gobject
addon libraries such as pygtk.

%prep
%setup -q -n %{_name}-%{version}
%patch0 -p1

%build
%configure
make %{?jobs:-j%jobs}

%install
%makeinstall
find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
rm examples/Makefile*
%fdupes $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS NEWS README ChangeLog examples
%dir %{py_sitedir}/gtk-2.0
%{py_sitedir}/gtk-2.0/gi/
%{py_sitedir}/gtk-2.0/gio/
%{py_sitedir}/gtk-2.0/glib/
%{py_sitedir}/gtk-2.0/gobject/
%{py_sitedir}/gtk-2.0/dsextras.py*
%{py_sitedir}/pygtk.*
%{_libdir}/*.so.*
# Live in cairo subpackage
%exclude %{py_sitedir}/gtk-2.0/gi/_gi_cairo.so

%files cairo
%defattr(-,root,root)
%{py_sitedir}/gtk-2.0/gi/_gi_cairo.so

%files devel
%defattr(-,root,root)
%{_includedir}/pygtk-2.0/
%{_libdir}/*.so
%{_libdir}/pkgconfig/pygobject-2.0.pc
## codegen
%{_bindir}/pygobject-codegen-2.0
# we explicitly list the directories here to be sure we don't include something
# that should live in the main package
%dir %{_datadir}/%{_name}
%dir %{_datadir}/%{_name}/2.0
%{_datadir}/%{_name}/2.0/codegen/
%{_datadir}/%{_name}/2.0/defs/
%{_datadir}/%{_name}/xsl/
## doc: we need the files there since building API docs for other python
## bindings require some files from here
# Own these repositories to not depend on gtk-doc while building:
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%{_datadir}/gtk-doc/html/pygobject/

%changelog
openSUSE Build Service is sponsored by