File python3-gobject2.spec of Package python-gobject2

# spec file for package python3-gobject2
# Copyright (c) 2017 SUSE LINUX 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

%define build_for_python3 1

%if %{build_for_python3}
%define local_py_requires Requires: python(abi) = %{py3_ver}
%define local_py_sitedir  %{python3_sitearch}
%define local_py_requires %{py_requires}
%define local_py_sitedir  %{py_sitedir}

Name:           python3-gobject2
%define _name   pygobject
Summary:        Python bindings for GObject
License:        LGPL-2.1+
Group:          Development/Libraries/Python
Version:        2.28.7
Release:        0
BuildRequires:  fdupes
BuildRequires:  glib2-devel
BuildRequires:  libffi-devel
%if %{build_for_python3}
BuildRequires:  python3-cairo-devel
BuildRequires:  python3-devel
BuildRequires:  python-cairo-devel
BuildRequires:  python-devel
Provides:       python2-gobject2 = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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

%package cairo
Summary:        Python bindings for GObject -- Cairo bindings
Group:          Development/Libraries/Python
Requires:       %{name} = %{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
Summary:        Python bindings for GObject
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
%if %{build_for_python3}
# Several files are conflicting between python2 and python3 builds
Conflicts:      python-gobject2-devel
Provides:       python-gobject2-doc = %{version}
Obsoletes:      python-gobject2-doc < %{version}
Provides:       python2-gobject2-devel = %{version}

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

%setup -q -n %{_name}-%{version}

%if %{build_for_python3}
export PYTHON=python3
%configure --disable-static --disable-introspection
make %{?jobs:-j%jobs} V=1

find %{buildroot} -name '*.la' -delete -print
rm examples/Makefile*
%fdupes %{buildroot}

rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%doc AUTHORS NEWS README ChangeLog examples
%dir %{local_py_sitedir}/gtk-2.0

%files devel
%if !%{build_for_python3}
## codegen
# 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
## 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