Blob Blame History Raw
# Last updated for version 2.21.0
%define glib2_version                  2.22.4
%define gobject_introspection_version  0.10.8
%define python2_version                2.3.5

%if 0%{?fedora} > 12
%global with_python3 1
%define python3_version                3.1
%endif

%if 1
  # Verbose build
  %global verbosity V=1
%else
  # Quiet build
  %global verbosity %{nil}
%endif

%global with_check 1

### Abstract ###

Name: pygobject3
Version: 3.2.2
Release: 6%{?dist}
License: LGPLv2+ and MIT
Group: Development/Languages
Summary: Python 2 bindings for GObject Introspection
URL: https://live.gnome.org/PyGObject
#VCS: git:git://git.gnome.org/pygobject
Source: http://ftp.gnome.org/pub/GNOME/sources/pygobject/3.2/pygobject-%{version}.tar.xz

### Patches ###
Patch0: lm.patch

# Mark some tests as known to fail; currently:
#
# Intermittently:
#  ======================================================================
#  FAIL: test_python_calls_sync (test_gdbus.TestGDBusClient)
#  ----------------------------------------------------------------------
#  Traceback (most recent call last):
#    File "/builddir/build/BUILD/pygobject-3.3.4/tests/test_gdbus.py", line 140, in test_python_calls_sync
#      self.assertTrue('Timeout' in str(e), str(e))
#  AssertionError: GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Could not get PID of name '1': no such name
#  ----------------------------------------------------------------------
#
# Not yet sent upstream
Patch2: pygobject-3.2.2-known-failures.patch

# Fix various endianness issues that broke things on big-endian 64 bit boxes
# (rhbz#841596; attachment 603367):
Patch3: endianness-fixes.patch

# Cherrypick fix from upstream (in 3.3.5 onwards; rhbz#842880):
Patch4: fix-list-marshalling-on-big-endian-machines.patch

# Add regression test for rhbz#842880
# Not yet sent upstream:
Patch5: test-list-marshalling.patch

# Fix endianness issue in _pygi_argument_to_array (rhbz#841596;
# backport of attachment 603634):
Patch6: fix-argument-to-array.patch


### Build Dependencies ###

BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
BuildRequires: python2-devel >= %{python2_version}
%if 0%{?with_python3}
BuildRequires: python3-devel >= %{python3_version}
BuildRequires: python3-cairo-devel
%endif # if with_python3

BuildRequires: pycairo-devel
BuildRequires: automake, autoconf, libtool

# Required by the upstream selftest suite:
%if %{with_check}
BuildRequires: cairo-gobject-devel
## for the Gdk and Gtk typelibs, used during the test suite:
BuildRequires: gtk3
## for xvfb-run:
BuildRequires: xorg-x11-server-Xvfb
BuildRequires: dejavu-sans-fonts
BuildRequires: dejavu-sans-mono-fonts
BuildRequires: dejavu-serif-fonts
## for dbus-launch, used by test_gdbus:
BuildRequires: dbus-x11
%endif # with_check

# The cairo override module depends on this
Requires: pycairo

Requires: gobject-introspection >= %{gobject_introspection_version}

%description
The %{name} package provides a convenient wrapper for the GObject library
for use in Python programs.

%package devel
Summary: Development files for embedding PyGObject introspection support
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: glib2-devel
Requires: gobject-introspection-devel
Requires: pkgconfig

%description devel
This package contains files required to embed PyGObject

%if 0%{?with_python3}
%package -n python3-gobject
Summary: Python 3 bindings for GObject Introspection
Group: Development/Languages

# The cairo override module depends on this
Requires: python3-cairo
Requires: gobject-introspection >= %{gobject_introspection_version}

%description -n python3-gobject
The python3-gobject package provides a convenient wrapper for the GObject 
library and and other libraries that are compatible with GObject Introspection, 
for use in Python 3 programs.

%endif # with_python3

%prep
%setup -q -n pygobject-%{version}
%patch0 -p1 -b .lm
%patch2 -p1 -b .known-failures

# Patch 3 now partly undoes part of patch 4, so they're in reverse order:
%patch4 -p1 -b .fix-list-marshalling-on-big-endian-machines
%patch3 -p1 -b .endianness-fixes

%patch5 -p1 -b .test-list-marshalling
%patch6 -p1 -b .fix-argument-to-array

autoreconf

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'

%build
PYTHON=%{__python} 
export PYTHON
%configure
make %{?_smp_mflags} %{verbosity}

%if 0%{?with_python3}
pushd %{py3dir}
PYTHON=%{__python3}
export PYTHON
%configure
make %{_smp_mflags} %{verbosity}
popd
%endif # with_python3

%install
rm -rf $RPM_BUILD_ROOT

%if 0%{?with_python3}
pushd %{py3dir}
PYTHON=%{__python3}
export PYTHON
make DESTDIR=$RPM_BUILD_ROOT install %{verbosity}
popd

%endif # with_python3

make DESTDIR=$RPM_BUILD_ROOT install %{verbosity}
find $RPM_BUILD_ROOT -name '*.la' -delete
find $RPM_BUILD_ROOT -name '*.a' -delete

%check

%if %{with_check}
# Run the selftests under a temporary xvfb X server (so that they can
# initialize Gdk etc):

# FIXME: disabled for python3
# Currently this fails with python3 with:
#  File "/builddir/build/BUILD/python3-pygobject3-3.3.4-4.fc19/gi/__init__.py", line 23, in <module>
#    from ._gi import _API, Repository
#ValueError: level must be >= 0
# Reported upstream as http://bugs.python.org/issue15610
%if 0
pushd %{py3dir}
PYTHON=%{__python3}
export PYTHON
xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}
popd
%endif # with_python3

xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity}

%endif # with_check

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(644, root, root, 755)
%doc AUTHORS NEWS README COPYING
%doc examples

%{_libdir}/libpyglib-gi-2.0-python.so*
%dir %{python_sitearch}/gi
%{python_sitearch}/gi/*

%files devel
%defattr(644, root, root, 755)
%dir %{_includedir}/pygobject-3.0/
%{_includedir}/pygobject-3.0/pygobject.h
%{_libdir}/pkgconfig/pygobject-3.0.pc

%if 0%{?with_python3}
%files -n python3-gobject
%defattr(644, root, root, 755)
%doc AUTHORS NEWS README COPYING
%doc examples

%{_libdir}/libpyglib-gi-2.0-python3.so*
%dir %{python3_sitearch}/gi

%{python3_sitearch}/gi/*

%endif # with_python3

%changelog
* Mon Aug 13 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.2-6
- rebuild

* Mon Aug 13 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.2-5
- add endianness patch (rhbz#841596; backport of attachment 603634)

* Mon Aug 13 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.2-4
- update endianness patch for rhbz#841596 (to attachment 603367)

* Mon Aug 13 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.2-3
- fix issues on big-endian 64-bit machines (rhbz#841596, rhbz#842880)

* Thu Aug  9 2012 David Malcolm <dmalcolm@redhat.com> - 3.2.2-2
- add a %%check check using xvfb-run; add V=1 to all make invocations

* Tue May 15 2012 Kalev Lember <kalevlember@gmail.com> - 3.2.2-1
- Update to 3.2.2

* Sat May 12 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 3.2.1-1
- Update to 3.2.1

* Tue Mar 27 2012 Kalev Lember <kalevlember@gmail.com> - 3.2.0-1
- Update to 3.2.0

* Thu Mar 22 2012 Matthias Clasen <mclasen@redhat.com> - 3.1.93-1
- Update to 3.1.93

* Wed Mar 21 2012 Kalev Lember <kalevlember@gmail.com> - 3.1.92-1
- Update to 3.1.92

* Sun Feb 26 2012 Matthias Clasen <mclasen@redhat.com> - 3.1.1-1
- Update to 3.1.1

* Tue Feb  7 2012 Matthias Clasen <mclasen@redhat.com> - 3.1.0-1
- Update to 3.1.0

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Dec 20 2011 Ignacio Casal Quinteiro <icq@gnome.org> - 3.0.3-1
- udpate to 3.0.3

* Sat Oct 22 2011 Ignacio Casal Quinteiro <icq@gnome.org> - 3.0.2-1
- udpate to 3.0.2

* Fri Sep 30 2011 Ignacio Casal Quinteiro <icq@gnome.org> - 3.0.1-1
- udpate to 3.0.1

* Tue Sep 20 2011 Matthias Clasen <mclasen@redhat.com> - 3.0.0-1
- Update to 3.0.0

* Thu Sep 15 2011 John (J5) Palmieri <johnp@gnome.org> - 2.90.4-1
- update to 2.90.4
- get rid of packaging cruft that is taken care of by upstream now

* Wed Aug 31 2011 Ignacio Casal Quinteiro <icq@gnome.org> - 2.90.3-1
- udpate to 2.90.3

* Thu Aug 22 2011 John (J5) Palmieri <johnp@redhat.com> - 2.90.2-3
- remove some old requires

* Thu Aug 19 2011 John (J5) Palmieri <johnp@redhat.com> - 2.90.2-2
- fix up issues uncovered during package review
- disable docs because they still reference the static bindings 
  and upstream is working on new documentation

* Thu Aug 18 2011 John (J5) Palmieri <johnp@redhat.com> - 2.90.2-1
- Initial package