File python-gnome-extras.spec of Package python-gnome-extras

#
# spec file for package python-gnome-extras
#
# 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

%define build_gdl 0
%define build_gtkmozembed 0

%if 0%{suse_version} > 1130
%define xulrunner_version 20
%else
%if 0%{suse_version} > 1120
%define xulrunner_version 192
%else
%if 0%{suse_version} > 1110
%define xulrunner_version 191
%else
%define xulrunner_version 190
%endif
%endif
%endif

Name:           python-gnome-extras
%define _name   gnome-python-extras
Version:        2.25.3
Release:        0
Summary:        Python bindings for GNOME
License:        GPL-2.0+ ; LGPL-2.1+
Group:          Development/Libraries/Python
Url:            ftp://ftp.gnome.org/pub/gnome/sources/gnome-python-extras
Source:         %{_name}-%{version}.tar.bz2
Source1:        README.openSUSE
# PATCH-FIX-UPSTREAM xulrunner19.patch bgo532856 bnc480992 wr@opensuse.org -- Make gtkembedmoz work with xulrunner 1.9
Patch0:         xulrunner19.patch
# PATCH-FIX-UPSTREAM python-gnome-extras-gdl.patch vuntz@opensuse.org -- Taken from git, to fix build of gdl bindings
Patch1:         python-gnome-extras-gdl.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libtool
%if %{build_gdl}
BuildRequires:  gdl-devel
%endif
BuildRequires:  gtk-doc
BuildRequires:  gtk2-devel
BuildRequires:  gtkspell-devel
BuildRequires:  libgnomeui-devel
%if %{build_gtkmozembed}
BuildRequires:  mozilla-xulrunner%{xulrunner_version}-devel
%endif
BuildRequires:  python-devel
BuildRequires:  python-gnome-devel
%if %suse_version <= 1130
# Needed for the documentation to build:
BuildRequires:  python-gobject2-doc
%endif
# Explicitly require all subpackages, so packages depending on
# python-gnome-extras get all modules.
Requires:       python-egg
%if %{build_gdl}
Requires:       python-gdl
%endif
%if %{build_gtkmozembed}
Requires:       python-gtkmozembed
%endif
Requires:       python-gtkspell
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
GNOME-python-extras is an extension module for python that gives you
access to more GNOME libraries.  This means you have access to more
widgets, simple configuration interface, metadata support and many
other features.

%package -n python-egg
Summary:        Python bindings for libegg widgets
License:        GPL-2.0+ ; LGPL-2.1+
Group:          Development/Libraries/Python
Requires:       python-bonobo
Requires:       python-gtk
%py_requires

%description -n python-egg
This package contains Python bindings for some libegg widgets.

Note that libegg use is generally not advised.

%if %{build_gdl}

%package -n python-gdl
Summary:        Python bindings for GDL
License:        LGPL-2.1+
Group:          Development/Libraries/Python
Requires:       python-gtk
%py_requires

%description -n python-gdl
This package contains Python bindings for GDL.
%endif

%if %{build_gtkmozembed}

%package -n python-gtkmozembed
Summary:        Python bindings for GtkMozEmbed
License:        LGPL-2.1+
Group:          Development/Libraries/Python
Requires:       mozilla-xulrunner%{xulrunner_version}
Requires:       python-gtk
%py_requires

%description -n python-gtkmozembed
This package contains Python bindings for GtkMozEmbed.
%endif

%package -n python-gtkspell
Summary:        Python bindings for GtkSpell
License:        GPL-2.0+
Group:          Development/Libraries/Python
Requires:       python-gtk
%py_requires

%description -n python-gtkspell
This package contains Python bindings for GtkSpell.

%package devel
License:        GPL-2.0+ ; LGPL-2.1+
Summary:        Python bindings for GNOME
Group:          Development/Libraries/Python
# This will bring in all subpackages
Requires:       %{name} = %{version}
Requires:       python-gobject2-devel
Provides:       python-gnome-extras-doc = 2.25.2
Obsoletes:      python-gnome-extras-doc < 2.25.2

%description devel
GNOME-python-extras is an extension module for python that gives you
access to more GNOME libraries.  This means you have access to more
widgets, simple configuration interface, metadata support and many
other features.

%prep
%setup -q -n %{_name}-%{version}
cp -a %{S:1} .
%patch0 -p1
%patch1 -p1

%build
autoreconf -i -f
# We don't care about gtkhtml2 anymore.
%configure --enable-docs \
        --disable-gtkhtml2
make %{?jobs:-j%jobs}

%install
%makeinstall
for dir in %{py_sitedir} ; do
    find %{buildroot}/$dir \( -name '*.py[co]' -o -name '*.la' \) -print0 | xargs -0 rm
    python %{_libdir}/python%{py_ver}/compileall.py -d $dir %{buildroot}/$dir
done
# Remove examples for bindings we don't ship
rm -r examples/{gksu2,gtkhtml2}
%fdupes %{buildroot}%{_datadir}

%files
%defattr(-,root,root)
%doc AUTHORS COPYING COPYING.GPL COPYING.LGPL ChangeLog NEWS README README.openSUSE
# Please list modules explicitly, do not use wildcards!

%files -n python-egg
%defattr(-, root, root)
%doc COPYING.GPL COPYING.LGPL
%dir %{py_sitedir}/gtk-2.0/egg
%{py_sitedir}/gtk-2.0/egg/__init__.py*
%{py_sitedir}/gtk-2.0/egg/recent.so
%{py_sitedir}/gtk-2.0/egg/trayicon.so

%if %{build_gdl}

%files -n python-gdl
%defattr(-, root, root)
%doc COPYING.LGPL
%{py_sitedir}/gtk-2.0/gdl.so
%endif

%if %{build_gtkmozembed}

%files -n python-gtkmozembed
%defattr(-, root, root)
%doc COPYING.LGPL
%{py_sitedir}/gtk-2.0/gtkmozembed.so
%endif

%files -n python-gtkspell
%defattr(-, root, root)
%doc COPYING.GPL
%{py_sitedir}/gtk-2.0/gtkspell.so

%files devel
%defattr(-, root, root)
%doc examples/
%{_libdir}/pkgconfig/gnome-python-extras-2.0.pc
# we explicitly list the directories here to be sure we don't include something
# that should live in the main package
%dir %{_datadir}/pygtk
%dir %{_datadir}/pygtk/2.0
%{_datadir}/pygtk/2.0/defs/
# Own these repositories to not depend on gtk-doc while building:
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%if %{build_gtkmozembed}
%{_datadir}/gtk-doc/html/pygtkmozembed/
%endif
%{_datadir}/gtk-doc/html/pygtkspell/

%changelog