b571ee
%if 0%{?fedora} > 12
b571ee
%global with_python3 1
b571ee
%endif
b571ee
b571ee
%if 0%{?with_python3}
b571ee
%global python_runtimes  python python-debug python3 python3-debug
b571ee
%else
b571ee
%global python_runtimes  python python-debug
b571ee
%endif # with_python3
b571ee
b571ee
# Python major version.
b571ee
%{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
b571ee
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
b571ee
b571ee
%if 0%{?with_python3}
b571ee
%{expand: %%define py3ver %(python3 -c 'import sys;print(sys.version[0:3])')}
b571ee
%endif # with_python3
b571ee
b571ee
b571ee
# Python 2.5+ is not supported by Zope, so it does not exist in
b571ee
# recent Fedora releases. That's why zope subpackage is disabled.
b571ee
%global zope 0
b571ee
%if %zope
b571ee
%global ZPsycopgDAdir %{_localstatedir}/lib/zope/Products/ZPsycopgDA
b571ee
%endif
b571ee
b571ee
b571ee
Summary:	A PostgreSQL database adapter for Python
b571ee
Name:		python-psycopg2
b571ee
Version:	2.5.1
b571ee
Release:	1%{?dist}
b571ee
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
b571ee
License:	LGPLv3+ with exceptions
b571ee
Group:		Applications/Databases
b571ee
Url:		http://www.psycopg.org/psycopg/
b571ee
b571ee
Source0:	http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-5/psycopg2-%{version}.tar.gz
b571ee
b571ee
BuildRequires:	postgresql-devel
b571ee
BuildRequires:	python-devel
b571ee
BuildRequires:	python-debug
b571ee
%if 0%{?with_python3}
b571ee
BuildRequires:	python3-devel
b571ee
BuildRequires:	python3-debug
b571ee
%endif # with_python3
b571ee
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
b571ee
b571ee
Conflicts:	python-psycopg2-zope < %{version}
b571ee
b571ee
%description
b571ee
Psycopg is the most popular PostgreSQL adapter for the Python
b571ee
programming language. At its core it fully implements the Python DB
b571ee
API 2.0 specifications. Several extensions allow access to many of the
b571ee
features offered by PostgreSQL.
b571ee
b571ee
%package debug
b571ee
Summary: A PostgreSQL database adapter for Python 2 (debug build)
b571ee
# Require the base package, as we're sharing .py/.pyc files:
b571ee
Requires:	%{name} = %{version}-%{release}
b571ee
b571ee
%description debug
b571ee
This is a build of the psycopg PostgreSQL database adapter for the debug
b571ee
build of Python 2.
b571ee
b571ee
%if 0%{?with_python3}
b571ee
%package -n python3-psycopg2
b571ee
Summary: A PostgreSQL database adapter for Python 3
b571ee
b571ee
%description  -n python3-psycopg2
b571ee
This is a build of the psycopg PostgreSQL database adapter for Python 3.
b571ee
b571ee
%package -n python3-psycopg2-debug
b571ee
Summary: A PostgreSQL database adapter for Python 3 (debug build)
b571ee
# Require base python 3 package, as we're sharing .py/.pyc files:
b571ee
Requires:	python3-psycopg2 = %{version}-%{release}
b571ee
b571ee
%description -n python3-psycopg2-debug
b571ee
This is a build of the psycopg PostgreSQL database adapter for the debug
b571ee
build of Python 3.
b571ee
%endif # with_python3
b571ee
b571ee
%package doc
b571ee
Summary:	Documentation for psycopg python PostgreSQL database adapter
b571ee
Group:		Documentation
b571ee
Requires:	%{name} = %{version}-%{release}
b571ee
b571ee
%description doc
b571ee
Documentation and example files for the psycopg python PostgreSQL
b571ee
database adapter.
b571ee
b571ee
%if %zope
b571ee
%package zope
b571ee
Summary:	Zope Database Adapter ZPsycopgDA
b571ee
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
b571ee
License:	GPLv2+ with exceptions or ZPLv1.0
b571ee
Group:		Applications/Databases
b571ee
Requires:	%{name} = %{version}-%{release}
b571ee
Requires:	zope
b571ee
b571ee
%description zope
b571ee
Zope Database Adapter for PostgreSQL, called ZPsycopgDA
b571ee
%endif
b571ee
b571ee
%prep
b571ee
%setup -q -n psycopg2-%{version}
b571ee
b571ee
%build
b571ee
for python in %{python_runtimes} ; do
b571ee
  $python setup.py build
b571ee
done
b571ee
b571ee
# Fix for wrong-file-end-of-line-encoding problem; upstream also must fix this.
b571ee
for i in `find doc -iname "*.html"`; do sed -i 's/\r//' $i; done
b571ee
for i in `find doc -iname "*.css"`; do sed -i 's/\r//' $i; done
b571ee
b571ee
# Get rid of a "hidden" file that rpmlint complains about
b571ee
rm -f doc/html/.buildinfo
b571ee
b571ee
%install
b571ee
b571ee
DoInstall() {
b571ee
  PythonBinary=$1
b571ee
b571ee
  Python_SiteArch=$($PythonBinary -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
b571ee
b571ee
  mkdir -p %{buildroot}$Python_SiteArch/psycopg2
b571ee
  $PythonBinary setup.py install --no-compile --root %{buildroot}
b571ee
b571ee
  # We're not currently interested in packaging the test suite.
b571ee
  rm -rf %{buildroot}$Python_SiteArch/psycopg2/tests
b571ee
}
b571ee
b571ee
rm -rf %{buildroot}
b571ee
for python in %{python_runtimes} ; do
b571ee
  DoInstall $python
b571ee
done
b571ee
b571ee
%if %zope
b571ee
install -d %{buildroot}%{ZPsycopgDAdir}
b571ee
cp -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
b571ee
%endif
b571ee
b571ee
%clean
b571ee
rm -rf %{buildroot}
b571ee
b571ee
%files
b571ee
%defattr(-,root,root)
b571ee
%doc AUTHORS LICENSE NEWS README
b571ee
%dir %{python_sitearch}/psycopg2
b571ee
%{python_sitearch}/psycopg2/*.py
b571ee
%{python_sitearch}/psycopg2/*.pyc
b571ee
%{python_sitearch}/psycopg2/_psycopg.so
b571ee
%{python_sitearch}/psycopg2/*.pyo
b571ee
%{python_sitearch}/psycopg2-%{version}-py%{pyver}.egg-info
b571ee
b571ee
%files debug
b571ee
%defattr(-,root,root)
b571ee
%doc LICENSE
b571ee
%{python_sitearch}/psycopg2/_psycopg_d.so
b571ee
b571ee
%if 0%{?with_python3}
b571ee
%files -n python3-psycopg2
b571ee
%defattr(-,root,root)
b571ee
%doc AUTHORS LICENSE NEWS README
b571ee
%dir %{python3_sitearch}/psycopg2
b571ee
%{python3_sitearch}/psycopg2/*.py
b571ee
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?m*.so
b571ee
%dir %{python3_sitearch}/psycopg2/__pycache__
b571ee
%{python3_sitearch}/psycopg2/__pycache__/*.pyc
b571ee
%{python3_sitearch}/psycopg2/__pycache__/*.pyo
b571ee
%{python3_sitearch}/psycopg2-%{version}-py%{py3ver}.egg-info
b571ee
b571ee
%files -n python3-psycopg2-debug
b571ee
%defattr(-,root,root)
b571ee
%doc LICENSE
b571ee
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?dm*.so
b571ee
%endif # with_python3
b571ee
b571ee
b571ee
%files doc
b571ee
%defattr(-,root,root)
b571ee
%doc doc examples/
b571ee
b571ee
%if %zope
b571ee
%files zope
b571ee
%defattr(-,root,root)
b571ee
%dir %{ZPsycopgDAdir}
b571ee
%{ZPsycopgDAdir}/*.py
b571ee
%{ZPsycopgDAdir}/*.pyo
b571ee
%{ZPsycopgDAdir}/*.pyc
b571ee
%{ZPsycopgDAdir}/dtml/*
b571ee
%{ZPsycopgDAdir}/icons/*
b571ee
%endif
b571ee
b571ee
%changelog
b571ee
* Sun Jul 07 2013 Pavel Raiskup <praiskup@redhat.com> - 2.5.1-1
b571ee
- rebase to 2.5.1
b571ee
b571ee
* Thu May 16 2013 Devrim Gündüz <devrim@gunduz.org> 2.5-1
b571ee
- Update to 2.5, per changes described at:
b571ee
  http://www.psycopg.org/psycopg/articles/2013/04/07/psycopg-25-released/
b571ee
b571ee
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.5-7
b571ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
b571ee
b571ee
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 2.4.5-6
b571ee
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3
b571ee
b571ee
* Fri Aug  3 2012 David Malcolm <dmalcolm@redhat.com> - 2.4.5-5
b571ee
- generalize python 3 fileglobbing to work with both Python 3.2 and 3.3
b571ee
b571ee
* Fri Aug  3 2012 David Malcolm <dmalcolm@redhat.com> - 2.4.5-4
b571ee
- replace "python3.2dmu" with "python3-debug"; with_python3 fixes
b571ee
b571ee
* Fri Aug  3 2012 David Malcolm <dmalcolm@redhat.com> - 2.4.5-3
b571ee
- add with_python3 conditional
b571ee
b571ee
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.5-2
b571ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
b571ee
b571ee
* Sat Apr  7 2012 Tom Lane <tgl@redhat.com> 2.4.5-1
b571ee
- Update to 2.4.5
b571ee
b571ee
* Thu Feb  2 2012 Tom Lane <tgl@redhat.com> 2.4.4-1
b571ee
- Update to 2.4.4
b571ee
- More specfile neatnik-ism
b571ee
b571ee
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.2-3
b571ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
b571ee
b571ee
* Tue Nov 29 2011 Tom Lane <tgl@redhat.com> 2.4.2-2
b571ee
- Fix mistaken %%dir marking on python3 files, per Dan Horak
b571ee
b571ee
* Sat Jun 18 2011 Tom Lane <tgl@redhat.com> 2.4.2-1
b571ee
- Update to 2.4.2
b571ee
Related: #711095
b571ee
- Some neatnik specfile cleanups
b571ee
b571ee
* Thu Feb 10 2011 David Malcolm <dmalcolm@redhat.com> - 2.4-0.beta2
b571ee
- 2.4.0-beta2
b571ee
- add python 2 debug, python3 (optimized) and python3-debug subpackages
b571ee
b571ee
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.2-2
b571ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
b571ee
b571ee
* Wed Dec 29 2010 Tom Lane <tgl@redhat.com> 2.3.2-1
b571ee
- Update to 2.3.2
b571ee
- Clean up a few rpmlint warnings
b571ee
b571ee
* Fri Dec 03 2010 Jason L Tibbitts III <tibbs@math.uh.edu> - 2.2.2-3
b571ee
- Fix incorrect (and invalid) License: tag.
b571ee
b571ee
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.2.2-2
b571ee
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
b571ee
b571ee
* Tue Jul 20 2010 Devrim GUNDUZ <devrim@gunduz.org> - 2.2.2-1
b571ee
- Update to 2.2.2
b571ee
b571ee
* Tue May 18 2010 Devrim GUNDUZ <devrim@gunduz.org> - 2.2.1-1
b571ee
- Update to 2.2.1
b571ee
- Improve description for 2.2 features.
b571ee
- Changelog for 2.2.0 is: 
b571ee
   http://initd.org/pub/software/psycopg/ChangeLog-2.2
b571ee
b571ee
* Wed Mar 17 2010 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.14-1
b571ee
- Update to 2.0.14
b571ee
- Update license (upstream switched to LGPL3)
b571ee
b571ee
* Sun Jan 24 2010 Tom Lane <tgl@redhat.com> 2.0.13-2
b571ee
- Fix rpmlint complaints: remove unneeded explicit Requires:, use Conflicts:
b571ee
  instead of bogus Obsoletes: to indicate lack of zope subpackage
b571ee
b571ee
* Sun Oct 18 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.13-1
b571ee
- Update to 2.0.13
b571ee
b571ee
* Fri Aug 14 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.12-1
b571ee
- Update to 2.0.12
b571ee
b571ee
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.11-2
b571ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
b571ee
b571ee
* Tue May 19 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.11-1
b571ee
- Update to 2.0.11
b571ee
b571ee
* Tue Apr 21 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.10-1
b571ee
- Update to 2.0.10
b571ee
b571ee
* Fri Mar 20 2009 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.9-1
b571ee
- Update to 2.0.9
b571ee
b571ee
* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.8-3
b571ee
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
b571ee
b571ee
* Thu Dec 04 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.8-2
b571ee
- Rebuild for Python 2.6
b571ee
b571ee
* Sat Nov 29 2008 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.8-1
b571ee
- Update to 2.0.8
b571ee
b571ee
* Sat Nov 29 2008 Devrim GUNDUZ <devrim@gunduz.org> - 2.0.8-1
b571ee
- Update to 2.0.8
b571ee
b571ee
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.7-3
b571ee
- Rebuild for Python 2.6
b571ee
b571ee
* Thu May 29 2008 Todd Zullinger <tmz@pobox.com> - 2.0.7-2
b571ee
- fix license tags
b571ee
b571ee
* Wed Apr 30 2008 Devrim GUNDUZ <devrim@commandprompt.com> 2.0.7-1
b571ee
- Update to 2.0.7
b571ee
b571ee
* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.0.6-4.1
b571ee
- Autorebuild for GCC 4.3
b571ee
b571ee
* Mon Jan 21 2008 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.6-3.1
b571ee
- Rebuilt against PostgreSQL 8.3
b571ee
b571ee
* Thu Jan 3 2008 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.6-3
b571ee
- Rebuild for rawhide changes
b571ee
b571ee
* Tue Aug 28 2007 Fedora Release Engineering <rel-eng at fedoraproject dot org> - 2.0.6-2
b571ee
- Rebuild for selinux ppc32 issue.
b571ee
b571ee
* Fri Jun 15 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.6-1
b571ee
- Update to 2.0.6
b571ee
b571ee
* Thu Apr 26 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.5.1-8
b571ee
- Disabled zope package temporarily.
b571ee
b571ee
* Wed Dec 6 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.5.1-7
b571ee
- Rebuilt
b571ee
b571ee
* Wed Dec 6 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.5.1-5
b571ee
- Bumped up spec version
b571ee
b571ee
* Wed Dec 6 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.5.1-4
b571ee
- Rebuilt for PostgreSQL 8.2.0
b571ee
b571ee
* Mon Sep 11 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.5.1-3
b571ee
- Rebuilt
b571ee
b571ee
* Wed Sep 6 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.5.1-2
b571ee
- Remove ghost'ing, per Python Packaging Guidelines
b571ee
b571ee
* Mon Sep 4 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.5.1-1
b571ee
- Update to 2.0.5.1
b571ee
b571ee
* Sun Aug 6 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.3-3
b571ee
- Fixed zope package dependencies and macro definition, per bugzilla review (#199784)
b571ee
- Fixed zope package directory ownership, per bugzilla review (#199784)
b571ee
- Fixed cp usage for zope subpackage, per bugzilla review (#199784)
b571ee
b571ee
* Mon Jul 31 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.3-2
b571ee
- Fixed 64 bit builds
b571ee
- Fixed license
b571ee
- Added Zope subpackage
b571ee
- Fixed typo in doc description
b571ee
- Added macro for zope subpackage dir
b571ee
b571ee
* Mon Jul 31 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.3-1
b571ee
- Update to 2.0.3
b571ee
- Fixed spec file, per bugzilla review (#199784)
b571ee
b571ee
* Sat Jul 22 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.2-3
b571ee
- Removed python dependency, per bugzilla review. (#199784)
b571ee
- Changed doc package group, per bugzilla review. (#199784)
b571ee
- Replaced dos2unix with sed, per guidelines and bugzilla review (#199784)
b571ee
- Fix changelog dates
b571ee
b571ee
* Sat Jul 22 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.2-2
b571ee
- Added dos2unix to buildrequires
b571ee
- removed python related part from package name
b571ee
b571ee
* Fri Jul 21 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 2.0.2-1
b571ee
- Fix rpmlint errors, including dos2unix solution
b571ee
- Re-engineered spec file
b571ee
b571ee
* Mon Jan 23 2006 - Devrim GUNDUZ <devrim@commandprompt.com>
b571ee
- First 2.0.X build
b571ee
b571ee
* Mon Jan 23 2006 - Devrim GUNDUZ <devrim@commandprompt.com>
b571ee
- Update to 1.2.21
b571ee
b571ee
* Tue Dec 06 2005 - Devrim GUNDUZ <devrim@commandprompt.com>
b571ee
- Initial release for 1.1.20