%define zope_product ZPsycopgDA
%define zope_instance %{_libdir}/zope/lib/python/Products

Summary: psycopg2 is a PostgreSQL database adapter for Python
Summary(ja): psycopg2 は Python の PostgreSQL 用データベースアダプタです
Name: python-psycopg2
Group: Applications/Databases
Version: 2.0.13
Release: 1%{?_dist_release}
License: GNU GPL2
Source: http://initd.org/pub/software/psycopg/psycopg2-%{version}.tar.gz
Distribution: Vine Linux
Vendor: Project Vine
BuildRoot: %{_tmppath}/psycopg-%{version}-root
BuildRequires: python-devel postgresql-devel python-egenix-mx-base
Requires: python postgresql-libs

%description
psycopg is a PostgreSQL database adapter for the Python programming
language. This is version 2, a complete rewrite of the original code to
provide new-style classes for connection and cursor objects and other
sweet candies. Like the original, psycopg 2 was written with the aim of
being very small and fast, and stable as a rock.

%package doc
Summary: Documentation for psycopg python PostgreSQL database adapter
Group: Applications/Databases
%description doc
Documenation and example files for the psycopg python PostgreSQL
database adapter.

%package ZPsycopgDA
Summary: ZPsycopgDA is a PostgreSQL database adapter product for Zope
Group: Development/Web Applications
Requires: %{name} == %{version}
Requires: Zope-zserver >= 2.9
conflicts: Zope-ZPsycopgDA
%description ZPsycopgDA
ZPsycopgDA is a PostgreSQL database adapter product for Zope.


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

%build
python setup.py build


%install
python setup.py install --root $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{zope_instance}
find %{zope_product} -name CVS | xargs rm -fr
cp -pR %{zope_product} $RPM_BUILD_ROOT%{zope_instance}

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -d /var/lib/zope/Products/%{zope_product} ]; then
	rm -rf /var/lib/zope/Products/%{zope_product}
fi

%files
%defattr(-,root,root)
%{python_sitearch}/psycopg2
%{python_sitearch}/psycopg2-%{version}-py%{pyver}.egg-info

%files doc
%defattr(-,root,root)
%doc AUTHORS INSTALL README doc

%files ZPsycopgDA
%defattr(-,zope,zope)
%{zope_instance}/%{zope_product}

%changelog
* Wed Feb 17 2010 Shu KONNO <owa@bg.wakwak.com> 2.0.13-1
- updated psycopg2 to 2.0.13

* Tue Feb 02 2010 Shu KONNO <owa@bg.wakwak.com> 2.0.11-2
- rebuild with python-2.6

* Wed Jul 08 2009 Shu KONNO <owa@bg.wakwak.com> 2.0.11-1
- updated psycopg2 to 2.0.11
- built with postgresql-8.4.0

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

* Wed Dec 31 2008 Shu KONNO <owa@bg.wakwak.com> python-psycopg2-2.0.8-1vl5
- updated psycopg2 to 2.0.8

* Thu Jul 17 2008 Shu KONNO <owa@bg.wakwak.com> python-psycopg2-2.0.7-1vl5
- packaged new

