%{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
%define pygresql PyGreSQL
%define install_dir %{_libdir}/python%{pyver}/site-packages/%{pygresql}

Summary: A Python interface for PostgreSQL database.
Summary(ja): PostgreSQL DB にアクセスするための Python モジュール
Name: python-%{pygresql}
Version: 4.0
Release: 3%{?_dist_release}
License: BSD
Group: Applications/Databases
URL: http://www.druid.net/pygresql/
Source: ftp://ftp.pygresql.org/pub/distrib/PyGreSQL-%{version}.tgz
Buildroot: %{_tmppath}/%{pygresql}-%{version}-root
BuildPrereq: python python-devel postgresql-devel
Requires: postgresql
Obsoletes: postgresql-python
Requires: python >= %{pyver}
Requires: mxDateTime

%description
PyGreSQL package includes a module for developers to use when writing
Python code for accessing a PostgreSQL database.

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

%build
python setup.py build --build-lib lib

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{install_dir}
install -m 755 lib/_pg.so $RPM_BUILD_ROOT%{install_dir}
install -m 644 lib/*.py $RPM_BUILD_ROOT%{install_dir}
touch $RPM_BUILD_ROOT%{install_dir}/__init__.py

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc docs
%dir %{_libdir}/python?.?/site-packages/%{pygresql}
%{_libdir}/python?.?/site-packages/%{pygresql}/_pg.so
%{_libdir}/python?.?/site-packages/%{pygresql}/*.py

%changelog
* Wed Feb 17 2010 Shu KONNO <owa@bg.wakwak.com> 4.0-3
- rebuilt with postgresql-8.4.1

* Wed Jul 08 2009 Shu KONNO <owa@bg.wakwak.com> 4.0-2
- rebuilt with postgresql-8.4.0

* Mon May 04 2009 Shu KONNO <owa@bg.wakwak.com> 4.0-1vl5
- updated to 4.0

* Sun Jul 20 2008 Shu KONNO <owa@bg.wakwak.com> 3.8.1-2vl5
- rebuilt with python-2.5.2

* Sat Jul 05 2008 Shu KONNO <owa@bg.wakwak.com> 3.8.1-1vl5
- applied new versioning policy, and spec in utf-8
- rebuilt with postgresql-8.3.3

* Sun Jan 27 2008 Shu KONNO <owa@bg.wakwak.com> 3.8.1-0vl5
- rebuilt

* Tue Jan 08 2008 Shu KONNO <owa@bg.wakwak.com> 3.8.1-0vl4
- rebuilt with postgresql-8.2.6

* Sat Dec 01 2007 Shu KONNO <owa@bg.wakwak.com> 3.8.1-0vl3
- changed source url

* Wed Oct 24 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.8.1-0vl2
- rebuilt with postgresql 8.2.5

* Thu Jun 02 2005 Shu KONNO <owa@bg.wakwak.com> 3.8.1-0vl1
- changed url
- updated PyGreSQL to 3.8.1
- rebuilt for x86_64 architecture support

* Thu Jun 02 2005 Shu KONNO <owa@bg.wakwak.com> 3.6.2-0vl3
- dropped "Provides: postgresql-python"
- added Distribution and Vendor lines

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

* Sun Mar 20 2005 Shu KONNO <owa@bg.wakwak.com> 3.6.2-0vl1
- created new