python-gobject/python-gobject.spec

200 lines
6.2 KiB
RPMSpec

#
# spec file for package python-gobject
#
# 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 http://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
# This figures in an error message
%global __requires_exclude typelib\\(%%namespaces\\)
%global __requires_exclude_from ^%{python2_sitearch}/gi/__init__.py$
%global __requires_exclude_from ^%{python3_sitearch}/gi/__init__.py$
Name: python-gobject
%define _name pygobject
Summary: Python bindings for GObject
License: LGPL-2.1+
Group: Development/Libraries/Python
Version: 3.24.1
Release: 0
Url: https://wiki.gnome.org/Projects/PyGObject/
Source: http://download.gnome.org/sources/pygobject/3.24/%{_name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM pycompile-searchpath.patch jmatejek@suse.com -- Fix build with python 3.4
Patch1: pycompile-searchpath.patch
BuildRequires: %{python_module cairo-devel}
BuildRequires: %{python_module cairo}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: glib2-devel >= 2.38.0
BuildRequires: gnome-common
BuildRequires: gobject-introspection-devel >= 1.46.0
BuildRequires: libffi-devel >= 3.0.0
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(cairo-gobject)
# Trigger an automatic installation of python(3)?-gobject when python and libgirepository are installed.
Supplements: packageand(python:%{gdk_real_package})
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%python_subpackages
%description
Pygobjects is an extension module for python that gives you access to
GLib's GObjects.
%package Gdk
Summary: Python bindings for GObject -- Gdk bindings
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: %{name}-cairo = %{version}
%define gdk_real_package %(rpm -q --qf '%%{NAME}' -f $(readlink %{_libdir}/libgdk-3.so -f))
Supplements: packageand(python-gobject:%{gdk_real_package})
%description Gdk
Pygobjects is an extension module for python that gives you access to
GLib's GObjects.
This package contains the Python Gdk bindings for GObject.
%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(python-gobject:%{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.
# Dummy wrapper file to pull in all Python-version-specific dependencies
%package devel
Summary: Python bindings for GObject -- development files
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: %{name}-Gdk = %{version}
Requires: %{name}-cairo = %{version}
Requires: %{name}-common-devel = %{version}
Requires: python-devel
%description devel
This package contains files required to build wrappers for gobject
addon libraries such as pygtk.
%package -n %{name}-common-devel
Summary: Python bindings for GObject -- shared development files
Group: Development/Libraries/Python
Requires: %{python_module gobject-devel = %{version}}
Requires: glib2-devel >= 2.38.0
Requires: gnome-common
Requires: gobject-introspection-devel >= 1.46.0
Requires: libffi-devel >= 3.0.0
Requires: pkgconfig(cairo)
Requires: pkgconfig(cairo-gobject)
Provides: %{python_module gobject-common-devel = %{version}}
%description -n %{name}-common-devel
This package contains common files required to build wrappers for gobject
addon libraries such as pygtk in both Python2 and Python3.
%prep
%setup -q -n %{_name}-%{version}
%patch1 -p1
%build
autoreconf -fiv
# We want to do an out-of-source build
%define _configure ../configure
%{python_expand mkdir build_%{$python_bin_suffix}
pushd build_%{$python_bin_suffix}
export PYTHON=$python
%configure
make %{?jobs:-j%jobs} V=1
popd
}
%install
%{python_expand pushd build_%{$python_bin_suffix}
%make_install
popd
}
# Drop pygtkcompat layer.it's useless and we lack other stuff for it to work
%python_expand rm %{buildroot}%{$python_sitearch}/gi/pygtkcompat.py*
%python_expand rm -r %{buildroot}%{$python_sitearch}/pygtkcompat/
# Drop GIMarshallingTests - It's test suite remainders that should not be installed
find %{buildroot}%{_prefix} -name GIMarshallingTests.py* -delete -print
rm examples/Makefile*
find %{buildroot} -name '*.la' -or -name '*.a' | xargs rm -f
%fdupes %{buildroot}
%files %{python_files}
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README
%doc examples/
%{python_sitearch}/gi/
%{python_sitearch}/*.egg-info
# Lives in cairo subpackage
%exclude %{python_sitearch}/gi/_gi_cairo*.so
# Lives in Gdk subpackage
%exclude %{python_sitearch}/gi/overrides/Gdk.*
%exclude %{python_sitearch}/gi/overrides/Gtk.*
%exclude %{python_sitearch}/gi/overrides/keysyms.*
%exclude %{python_sitearch}/gi/overrides/Pango.*
%files %{python_files Gdk}
%defattr(-,root,root)
%doc AUTHORS COPYING
%{python_sitearch}/gi/overrides/Gdk.*
%{python_sitearch}/gi/overrides/Gtk.*
%{python_sitearch}/gi/overrides/keysyms.*
%{python_sitearch}/gi/overrides/Pango.*
%files %{python_files cairo}
%defattr(-,root,root)
%doc AUTHORS COPYING
%{python_sitearch}/gi/_gi_cairo*.so
%files %{python_files devel}
%defattr(-,root,root)
%doc AUTHORS COPYING
%files -n %{name}-common-devel
%defattr(-,root,root)
%doc AUTHORS COPYING
%{_includedir}/pygobject-3.0/
%{_libdir}/pkgconfig/pygobject-3.0.pc
%changelog