+#
+# todo:
+# - zope adapter
+# - lib64 patch
+#
-%include /usr/lib/rpm/macros.python
-%define module psycopg
+%define module psycopg2
Summary: psycopg is a PostgreSQL database adapter for Python
Summary(pl): psycopg jest przeznaczonym dla Pythona interfejsem do bazy PostgreSQL
Name: python-%{module}
-Version: 1.1.10
+Version: 2.0.3
Release: 1
License: GPL
Group: Libraries/Python
-Source0: http://initd.org/pub/software/%{module}/%{module}-%{version}.tar.gz
-# Source0-md5: 2279a6aaddf8a8fbec44f782e5cdaa02
-Patch0: %{name}-dumb-ac-fix.patch
+Source0: http://initd.org/pub/software/psycopg/%{module}-%{version}.tar.gz
+# Source0-md5: 74219613b9f5b187f4e476264e2c966c
+#Patch0: %{name}-lib64.patch
URL: http://www.initd.org/software/psycopg/
+BuildRequires: autoconf
BuildRequires: postgresql-backend-devel
+BuildRequires: postgresql-devel
BuildRequires: python-devel
-BuildRequires: python-mx-DateTime-devel
+BuildRequires: rpm-pythonprov
Requires: postgresql-libs
%pyrequires_eq python-modules
-Requires: python-mx-DateTime
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define prod_name ZPsycopgDA
-%define zope_dir %{_libdir}/zope
-%define zope_productsdir %{zope_dir}/Products
-%define python_compile_opt python -O -c "import compileall; compileall.compile_dir('.')"
-%define python_compile python -c "import compileall; compileall.compile_dir('.')"
-
+%define zope_subname ZPsycopgDA
%description
psycopg is a PostgreSQL database adapter for the Python programming
psycopg jest, ¿e w jest pe³ni zgodny z standardem DBAPI-2.0 i jest
'thread safe' na poziomie 2.
-%package -n Zope-%{prod_name}
+%package -n Zope-%{zope_subname}
Summary: Zope PostgreSQL database adapter
Summary(pl): Interfejs bazy danych PostgreSQL do Zope
Group: Development/Languages/Python
+Requires: %{name} = %{version}-%{release}
Requires: Zope
-Requires: %{name} = %{version}
-BuildArch: noarch
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%description -n Zope-%{prod_name}
+%description -n Zope-%{zope_subname}
Zope PostgreSQL database adapter.
-%description -n Zope-%{prod_name} -l pl
+%description -n Zope-%{zope_subname} -l pl
Interfejs bazy danych PostgreSQL do Zope.
%prep
%setup -q -n %{module}-%{version}
-%patch0 -p1
+#%if "%{_lib}" == "lib64"
+#%patch0 -p1
+#%endif
%build
-%{__autoconf}
-
-%configure \
- --with-python=%{_bindir}/python \
- --with-mxdatetime-includes=%{py_incdir}/mx \
- --with-postgres-includes=%{_includedir}/postgresql/server
-%{__make}
-
-cd %{prod_name}
-%{python_compile}
-%{python_compile_opt}
-cd ..
+python setup.py build
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{py_sitedir},%{zope_productsdir}/%{prod_name}}
-install psycopgmodule.so $RPM_BUILD_ROOT%{py_sitedir}
+python setup.py install --optimize=2 --root=$RPM_BUILD_ROOT
+
+find $RPM_BUILD_ROOT%{py_libdir} -type f -name "*.py" | xargs rm
-cp -ar %{prod_name}/* $RPM_BUILD_ROOT%{zope_productsdir}/%{prod_name}
-rm -f $RPM_BUILD_ROOT%{zope_productsdir}/%{prod_name}/*.py
+#install -d $RPM_BUILD_ROOT%{_datadir}/Zope-%{zope_subname}
+
+#cp -ar %{zope_subname}/* $RPM_BUILD_ROOT%{_datadir}/Zope-%{zope_subname}
+#%py_comp $RPM_BUILD_ROOT%{_datadir}/Zope-%{zope_subname}
+#%py_ocomp $RPM_BUILD_ROOT%{_datadir}/Zope-%{zope_subname}
+#rm -f $RPM_BUILD_ROOT%{_datadir}/Zope-%{zope_subname}/*.py
%clean
rm -rf $RPM_BUILD_ROOT
-%files
-%defattr(644,root,root,755)
-%doc AUTHORS CREDITS FAQ NEWS README RELEASE-1.0 SUCCESS TODO doc
-%attr(755,root,root) %{py_sitedir}/*.so
+#%post -n Zope-%{zope_subname}
+#/usr/sbin/installzopeproduct %{_datadir}/Zope-%{zope_subname} %{zope_subname}
+#if [ -f /var/lock/subsys/zope ]; then
+# /etc/rc.d/init.d/zope restart >&2
+#fi
-%files -n Zope-%{prod_name}
+#%postun -n Zope-%{zope_subname}
+#if [ "$1" = "0" ]; then
+# /usr/sbin/installzopeproduct -d %{zope_subname}
+# if [ -f /var/lock/subsys/zope ]; then
+# /etc/rc.d/init.d/zope restart >&2
+# fi
+#fi
+
+%files
%defattr(644,root,root,755)
-%{zope_productsdir}/%{prod_name}
+%doc ChangeLog AUTHORS README doc/HACKING doc/SUCCESS doc/TODO
+%dir %{py_sitedir}/%{module}
+%attr(755,root,root) %{py_sitedir}/%{module}/*.so
+%{py_sitedir}/%{module}/*.py[co]
+
+#%files -n Zope-%{zope_subname}
+#%defattr(644,root,root,755)
+#%{_datadir}/Zope-%{zope_subname}