%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

Name:           pypoppler
Version:        0.12.1
Release:        3%{?_dist_release}
Summary:        Python bindings for the Poppler PDF rendering library
Summary(ja):    Poppler PDF レンダリングライブラリの Python バインディング

Group:          Applications/Publishing
License:        GPLv2+
URL:            https://launchpad.net/poppler-python

Source0:        http://launchpad.net/poppler-python/trunk/development/+download/%{name}-%{version}.tar.gz

# Release the GIL on blocking functions like rendering pages and getting
# thumbnails, see bug #504240 reported by BenjaminBerg.
# bzr rev 75
Patch0:		75_74.diff

# Manually wrap poppler_page_render_to_pixbuf and
# poppler_page_render_to_pixbuf_for_printing returning the Pixbuf
# bzr rev 76
Patch1:		76_75.diff

# Fix a few leaks by using the right functions while freeing the returned lists
# bzr 79
Patch2:		79_78.diff

# Changes for poppler 1.5
Patch3:		pypoppler-0.12.1-poppler0.15.0-changes.patch


BuildRoot:      %{_tmppath}/%{name}-%{version}-root

BuildRequires:  pygtk2-devel
BuildRequires:  atk-devel
BuildRequires:  poppler-devel
BuildRequires:  pycairo-devel
#BuildRequires:  poppler-glib-devel >= 0.10.5


%description
Python bindings for the Poppler PDF rendering library. It is needed to
run programs written in Python and using Poppler set.


%prep
%setup -q
%patch0 -p0 -b .bzr75
%patch1 -p0 -b .bzr76
%patch2 -p0 -b .bzr79
%patch3 -p1 -b .poppler15


%build
%configure --disable-static
make %{?_smp_mflags}


%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} INSTALL="install -p"
find %{buildroot} -type f -name "*.la" -exec rm -f {} ';'


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS
%{python_sitearch}/poppler*


%changelog
* Sat Mar 12 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.12.1-3
- rebuilt with poppler-0.16.3
- added Patch0-3 from Fedora

* Wed Oct 06 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 0.12.1-2
- rebuild with poppler-0.14.2

* Thu Feb 11 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.12.1-1
- initail build for VineSeed

* Thu Nov 19 2009 Fabian Affolter <fabian@bernewireless.net> - 0.12.1-1
- Updated to new upstream version 0.12.1

* Thu Sep 17 2009 Fabian Affolter <fabian@bernewireless.net> - 0.10.1-1
- Updated to new upstream version 0.10.1

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat Apr 25 2009 Fabian Affolter <fabian@bernewireless.net> - 0.10.0-1
- Initial package for Fedora
