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

%define buildglade %(pkg-config libglade-2.0 && echo 1 || echo 0)
%define pyver %(python -c 'import sys;print(sys.version[0:3])')

Summary: Python bindings for the GTK+ widget set.
Summary(ja): GTK+ ウィジットセットの Python 実装
Name: pygtk2
Version: 2.24.0
Release: 3%{?_dist_release}

Group: Development/Languages
License: LGPLv2
Source: ftp://ftp.gnome.org/pub/GNOME/sources/pygtk/2.24/pygtk-%{version}.tar.bz2

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

Buildrequires: python-devel >= 2.5
Buildrequires: libglade2-devel >= 2.5.0
BuildRequires: gtk2-devel >= 2.16.0
BuildRequires: pygobject-devel >= 2.16.0
BuildRequires: pycairo-devel >= 1.8.2
BuildRequires: python-numeric
BuildRequires: docbook-style-xsl
BuildRequires: libxslt
Buildrequires: automake >= 1.6.3-5

Requires: pygobject
Requires: pycairo
Requires: python-numeric

Obsoletes: pygtk

Vendor: Project Vine
Distribution: Vine Linux

%description
PyGTK is an extension module for python that gives you access to the GTK+
widget set.  Just about anything you can write in C with GTK+ you can write
in python with PyGTK (within reason), but with all the benefits of python.

%description -l ja
PyGTK は GTK+ ウィジットセットへアクセス可能にする python の拡張モジュール
です。 C で GTK+ を使用して書けることは、大概 python で PyGTK を利用して書
けます。 python のおかげでもあります。

%package libglade
Summary: A wrapper for the libglade library for use with PyGTK
Summary(ja): PyGTK を利用するための libglade ライブラリのラッパ
Group: Development/Libraries
Requires: pygtk2 = %{version}

%description libglade
This module contains a wrapper for the libglade library.  Libglade allows
a program to construct its user interface from an XML description, which
allows the programmer to keep the UI and program logic separate.

%description -l ja libglade
このモジュールは libglade ライブラリのためのラッパを含んでいます。libglade は
プログラムのユーザインタフェースを XML 記述で構成することを可能にします。この
ためプログラマは、プログラムの UI とロジックを分離させておくことができます。

%package devel
Summary: files needed to build wrappers for GTK+ addon libraries
Summary(ja): GTK+ の追加ライブラリのラッパ作成に必要なファイル
Group: Development/Libraries
Requires: pygtk2 = %{version}
Requires: pygobject-devel >= 2.12.0
Requires: gtk2-devel

%description devel
This package contains files required to build wrappers for GTK+ addon
libraries so that they interoperate with pygtk.

%description -l ja devel
このパッケージには GTK+ の追加ライブラリのラッパを作るために必要なファイルを含
みます。これらは PyGTK との仲介をします。

%prep
%setup -q -n pygtk-%{version}

%build
[ -x /usr/bin/python%{pyver} ] && export PYTHON=/usr/bin/python%{pyver}
#aclocal && automake && autoconf
%configure --enable-thread --enable-numpy
export tagname=CC
make LIBTOOL=/usr/bin/libtool

%install
rm -rf $RPM_BUILD_ROOT
export tagname=CC
make LIBTOOL=/usr/bin/libtool DESTDIR=$RPM_BUILD_ROOT install
find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc AUTHORS NEWS README MAPPING ChangeLog
%doc examples

%defattr(644, root, root, 755)
%dir %{python_sitearch}/gtk-2.0
%dir %{python_sitearch}/gtk-2.0/gtk
%{python_sitearch}/gtk-2.0/gtk/*.py*
%dir %{_libdir}/pygtk
%dir %{_libdir}/pygtk/2.0
%{_libdir}/pygtk/2.0/*

%defattr(755, root, root, 755)
%{_bindir}/pygtk-demo
%{python_sitearch}/gtk-2.0/atk.so
%{python_sitearch}/gtk-2.0/pango.so
%{python_sitearch}/gtk-2.0/gtk/_gtk.so
%{python_sitearch}/gtk-2.0/gtkunixprint.so
%{python_sitearch}/gtk-2.0/pangocairo.so

%if %{buildglade}
%files libglade
%defattr(755, root, root, 755)
%{_libdir}/python?.?/site-packages/gtk-2.0/gtk/glade.so
%endif

%files devel
%defattr(644, root, root, 755)
%dir %{_includedir}/pygtk-2.0
%dir %{_includedir}/pygtk-2.0/pygtk
%{_includedir}/pygtk-2.0/pygtk/*.h
%{_libdir}/pkgconfig/pygtk-2.0.pc
%dir %{_datadir}/pygtk
%dir %{_datadir}/pygtk/2.0
%dir %{_datadir}/pygtk/2.0/defs
%{_datadir}/pygtk/2.0/defs/*.defs
%{_datadir}/pygtk/2.0/defs/pangocairo.override
%{_datadir}/gtk-doc/html/pygtk
%defattr(755, root, root, 755)
%{_bindir}/pygtk-codegen-2.0

%changelog
* Sun Jan 12 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.24.0-3
- rebuild with VineSeed environment

* Wed Feb 15 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.24.0-2
- rebuild with python-2.7.2

* Tue Jun 07 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 2.24.0-1
- new upstream release

* Mon Feb 14 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.22.0-2
- add Requires: gtk2-devel (-devel package)

* Sat Oct 02 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.22.0-1
- new upstream release

* Sat Apr 17 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 2.17.0-1
- new upstream release

* Tue Feb 02 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 2.16.0-1
- new upstream release
- rebuild with python-2.6

* Mon Mar 23 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.14.1-1
- new upstream release

* Fri Jul 18 2008 Shu KONNO <owa@bg.wakwak.com> 2.12.1-2vl5
- rebuilt with python-2.5.2

* Sat Mar 22 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.12.1-1vl5
- rebuilt with python-2.4.5
- used %%{?_dist_release} macro

* Fri Jan 11 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.12.1-0vl1
- new upstream release

* Sun Nov 18 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.12.0-0vl1
- new upstream release

* Sat Jul  7 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.10.5-0vl1
- new upstream release

* Mon Apr 30 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.10.4-0vl2
- added Requires pygobject-devel to devel package

* Thu Apr 26 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.10.4-0vl1
- new upstream release
- add Requires/BuildRequires pygobject,pycairo

* Thu Jun 22 2006 Shu KONNO <owa@bg.wakwak.com> 2.8.6-0vl1
- new upstream release 2.8.6

* Fri Jan 13 2006 Shu KONNO <owa@bg.wakwak.com> 2.8.4-0vl1
- new upstream release 2.8.4
- added japanese summary and description

* Tue Oct 18 2005 Shu KONNO <owa@bg.wakwak.com> 2.8.2-0vl1
- new upstream release 2.8.2

* Sat Oct  8 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.8.1-0vl1
- new upstream release 2.8.1
- added %clean sectioin

* Sat Sep 24 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.8.0-0vl1
- new upstream release 2.8.0

* Mon Apr 04 2005 Shu KONNO <owa@bg.wakwak.com> 2.6.1-0vl1
- new upstream release 2.6.1

* Sun Apr 03 2005 Shu KONNO <owa@bg.wakwak.com> 2.4.1-0vl2
- rebuild with python-2.4.1-0vl1

* Sun Dec 26 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.1-0vl1
- new upstream release

* Sat Jun 12 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.2.0-1vl1
- updated to 2.2.0

* Sat Apr 17 2004 Shu KONNO <owa@bg.wakwak.com> 2.0.0-1vl4
- rebuild with python-2.3.3-0vl1

* Sat Apr 10 2004 Shu KONNO <owa@bg.wakwak.com> 2.0.0-1vl3.1
- rebuild with python-2.3.3-0vl0.3 (for TestPkg)

* Thu Sep 18 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.0.0-1vl3
- added missing %%defattr

* Wed Sep 17 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 2.0.0-1vl2
- added Provides and Obsoletes pygtk

* Tue Sep 16 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0.0-1vl1
- new upstream release (based on Redhat Rawhide 2.0.0-1)
  * Thu Aug  7 2003 Elliot Lee <sopwith@redhat.com> 1.99.16-10
  - Fix libtool
  * Fri Jul 18 2003 Jeremy Katz <katzj@redhat.com> 1.99.16-8
  - part of the fixnew patch wasn't applied upstream, apply it (#99400)

* Thu Jan 16 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 1.99.14-0vl1
- new upstream release
- build for Vine Linux

* Thu Oct 31 2002 Matt Wilson <msw@redhat.com>
- rebuild for multilib
- use %%configure

* Fri Aug 30 2002 Matt Wilson <msw@redhat.com>
- fix pixbuf leaks (#72137)
- five more pixbuf leaks plugged

* Wed Aug 28 2002 Jonathan Blandford <jrb@redhat.com>
- remover Packager tag

* Tue Aug 27 2002 Jonathan Blandford <jrb@redhat.com>
- add binding for gdk_atom_intern

* Mon Jul 29 2002 Matt Wilson <msw@redhat.com>
- 0.99.12

* Wed Jul 17 2002 Matt Wilson <msw@redhat.com>
- new version from CVS

* Thu Jun 27 2002 Tim Waugh <twaugh@redhat.com>
- Fix bug #65770.

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Mon Jun 17 2002 Matt Wilson <msw@redhat.com>
- new version from CVS

* Sun May 26 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Wed May 22 2002 Jeremy Katz <katzj@redhat.com>
- 1.99.10

* Wed Feb 27 2002 Matt Wilson <msw@redhat.com>
- 1.99.8

* Mon Jan 28 2002 Matt Wilson <msw@redhat.com>
- added atkmodule.so to file list

* Thu Oct 18 2001 Matt Wilson <msw@redhat.com>
- fix devel filelist to match new header location

* Mon Oct 15 2001 Matt Wilson <msw@redhat.com>
- get the headers from their new version-specific location

* Thu Oct 11 2001 Matt Wilson <msw@redhat.com>
- fixed typo in devel filelist
- added macro that tests to see if we have libglade2, make the
  filelist a condition of that
- changed name to 'pygtk2' to avoid name conflict with pygtk

