python-gobject/python-gobject.spec
Dominique Leuenberger 0f8a196ef6 Accepting request 479793 from home:TheBlackCat:branches:GNOME:Factory
Add python2- provides for the subpackages.  This package is currently blocking a large number of packages from being ported to the new single-spec python macros (including jupyter/ipython and most scientific python packages).  

This is a compromise stop-gap measure to let the porting continue while GNOME package maintainers prepare for GNOME 3.24.  A more comprehensive port to the new macros is complete and will come to GNOME:Factory after GNOME 3.24 is in openSUSE:Factory.

OBS-URL: https://build.opensuse.org/request/show/479793
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/python-gobject?expand=0&rev=73
2017-03-15 19:53:02 +00:00

187 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/
#
# This figures in an error message
%global __requires_exclude typelib\\(%%namespaces\\)
%global __requires_exclude_from ^%{local_py_sitedir}/gi/__init__.py$
%define build_for_python3 0
%if %{build_for_python3}
%define local_py_requires Requires: python(abi) = %py3_ver
%define local_py_sitedir %{python3_sitearch}
%define local_py_suffix 3
%define local_py_pkg python3
%define local_lib_ver 3-0
%else
%define local_py_requires %{py_requires}
%define local_py_sitedir %{py_sitedir}
%define local_py_suffix 2
%define local_py_pkg python
%define local_lib_ver 2-0
%endif
Name: python-gobject
%define _name pygobject
Summary: Python bindings for GObject
License: LGPL-2.1+
Group: Development/Libraries/Python
Version: 3.22.0
Release: 0
Url: https://wiki.gnome.org/Projects/PyGObject/
Source: http://download.gnome.org/sources/pygobject/3.22/%{_name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM pycompile-searchpath.patch jmatejek@suse.com -- Fix build with python 3.4
Patch1: pycompile-searchpath.patch
# PATCH-FIX-UPSTREAM python-gobject-missing-prototypes.patch bgo#777534 dimstar@opensuse.org -- Disable -Werror=missing-prototypes, taken from git commit d005df
Patch2: python-gobject-missing-prototypes.patch
BuildRequires: fdupes
BuildRequires: glib2-devel >= 2.38.0
BuildRequires: gnome-common
BuildRequires: gobject-introspection-devel >= 1.46.0
BuildRequires: libffi-devel >= 3.0.0
%if %{build_for_python3}
BuildRequires: python3-cairo-devel
BuildRequires: python3-devel
%else
BuildRequires: python-cairo-devel
BuildRequires: python-devel
%endif
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(cairo-gobject)
# Trigger an automatic installation of python(3)?-gobject when python and libgirepository are installed.
Supplements: packageand(%{local_py_pkg}:libgirepository-1_0-1)
Provides: python2-gobject = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{local_py_requires}
%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}
Provides: python2-gobject-Gdk = %{version}
%define gdk_real_package %(rpm -q --qf '%%{NAME}' -f $(readlink /usr/lib64/libgdk-3.so -f))
Supplements: packageand(%{name}:%{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}
Provides: python2-gobject-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.
%if ! %{build_for_python3}
%package devel
Summary: Python bindings for GObject
Group: Development/Libraries/Python
Requires: %{name} = %{version}
Requires: python3-gobject = %{version}
# Until version 3.11.5, the -devel package contained python2 / python3 specifiecs
# AS this was cleared and the package no longer depends on the python version, the
# python3-gobject-devel package is no longer being built. In order to ease upgrades
# and remove the obsolete package, we obsolete/provide it here.
Obsoletes: python3-gobject-devel < 3.11.5
Provides: python3-gobject-devel = %{version}
Provides: python2-gobject-devel = %{version}
%description devel
This package contains files required to build wrappers for gobject
addon libraries such as pygtk.
%endif
%prep
%setup -q -n %{_name}-%{version}
%patch1 -p1
%patch2 -p1
%build
autoreconf -fiv
%if %{build_for_python3}
export PYTHON=python3
%else
export PYTHON=python2
%endif
%configure \
%if %{build_for_python3}
--without-common
%endif
make %{?jobs:-j%jobs} V=1
%install
%makeinstall
find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
# Drop pygtkcompat layer.it's useless and we lack other stuff for it to work
rm %{buildroot}%{local_py_sitedir}/gi/pygtkcompat.py
rm -r %{buildroot}%{local_py_sitedir}/pygtkcompat/
# Drop GIMarshallingTests - It's test suite remainders that should not be installed
find %{buildroot}%{local_py_sitedir}/gi -name GIMarshallingTests.py* -delete -print
rm examples/Makefile*
%fdupes $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS NEWS README ChangeLog examples
%{local_py_sitedir}/gi/
%{local_py_sitedir}/*.egg-info
# Lives in cairo subpackage
%exclude %{local_py_sitedir}/gi/_gi_cairo*.so
%exclude %{local_py_sitedir}/gi/overrides/Gdk.*
%exclude %{local_py_sitedir}/gi/overrides/Gtk.*
%exclude %{local_py_sitedir}/gi/overrides/keysyms.*
%exclude %{local_py_sitedir}/gi/overrides/Pango.py
%files Gdk
%defattr(-,root,root)
%{local_py_sitedir}/gi/overrides/Gdk.*
%{local_py_sitedir}/gi/overrides/Gtk.*
%{local_py_sitedir}/gi/overrides/keysyms.*
%{local_py_sitedir}/gi/overrides/Pango.py
%files cairo
%defattr(-,root,root)
%{local_py_sitedir}/gi/_gi_cairo*.so
%if ! %{build_for_python3}
%files devel
%defattr(-,root,root)
%{_includedir}/pygobject-3.0/
%{_libdir}/pkgconfig/pygobject-3.0.pc
%endif
%changelog