|
|
9232a0 |
%global __python3 /usr/bin/python3.11
|
|
|
9232a0 |
%global python3_pkgversion 3.11
|
|
|
9232a0 |
|
|
|
9232a0 |
# RHEL python3.11: Python 3 and Python 3 debug enabled, both Python 2 builds disabled
|
|
|
9232a0 |
%bcond_without python3
|
|
|
9232a0 |
%bcond_without python3_debug
|
|
|
9232a0 |
%bcond_with python2
|
|
|
9232a0 |
%bcond_with python2_debug
|
|
|
9232a0 |
|
|
|
9232a0 |
%bcond_without tests
|
|
|
9232a0 |
|
|
|
9232a0 |
%global srcname psycopg2
|
|
|
9232a0 |
%global sum A PostgreSQL database adapter for Python
|
|
|
9232a0 |
%global desc Psycopg is the most popular PostgreSQL adapter for the Python \
|
|
|
9232a0 |
programming language. At its core it fully implements the Python DB \
|
|
|
9232a0 |
API 2.0 specifications. Several extensions allow access to many of the \
|
|
|
9232a0 |
features offered by PostgreSQL.
|
|
|
9232a0 |
|
|
|
9232a0 |
%global python_runtimes \\\
|
|
|
9232a0 |
%{?with_python2:python2} \\\
|
|
|
9232a0 |
%{?with_python2_debug:python2-debug} \\\
|
|
|
9232a0 |
%{?with_python3:python%{python3_pkgversion}} \\\
|
|
|
9232a0 |
%{?with_python3_debug:python%{python3_pkgversion}d}
|
|
|
9232a0 |
|
|
|
9232a0 |
%{!?with_python2:%{!?with_python3:%{error:one python version needed}}}
|
|
|
9232a0 |
|
|
|
9232a0 |
# Python 2.5+ is not supported by Zope, so it does not exist in
|
|
|
9232a0 |
# recent Fedora releases. That's why zope subpackage is disabled.
|
|
|
9232a0 |
%global zope 0
|
|
|
9232a0 |
%if %zope
|
|
|
9232a0 |
%global ZPsycopgDAdir %{_localstatedir}/lib/zope/Products/ZPsycopgDA
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
Summary: %{sum}
|
|
|
9232a0 |
Name: python%{python3_pkgversion}-%{srcname}
|
|
|
9232a0 |
Version: 2.9.3
|
|
|
9232a0 |
Release: 1%{?dist}
|
|
|
9232a0 |
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
|
|
|
9232a0 |
License: LGPLv3+ with exceptions
|
|
|
9232a0 |
Url: http://initd.org/psycopg/
|
|
|
9232a0 |
|
|
|
9232a0 |
Source0: http://initd.org/psycopg/tarballs/PSYCOPG-2-8/psycopg2-%{version}.tar.gz
|
|
|
9232a0 |
|
|
|
9232a0 |
%{?with_python2:BuildRequires: python2-devel python2-setuptools}
|
|
|
9232a0 |
%{?with_python3:BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-rpm-macros python%{python3_pkgversion}-setuptools}
|
|
|
9232a0 |
%{?with_python2_debug:BuildRequires: python2-debug}
|
|
|
9232a0 |
%{?with_python3_debug:BuildRequires: python%{python3_pkgversion}-debug}
|
|
|
9232a0 |
|
|
|
9232a0 |
BuildRequires: gcc
|
|
|
9232a0 |
BuildRequires: libpq-devel
|
|
|
9232a0 |
|
|
|
9232a0 |
# For testsuite
|
|
|
9232a0 |
%if %{with tests}
|
|
|
9232a0 |
BuildRequires: postgresql-test-rpm-macros
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
Conflicts: python-psycopg2-zope < %{version}
|
|
|
9232a0 |
|
|
|
9232a0 |
# Remove test 'test_from_tables' for s390 architecture
|
|
|
9232a0 |
# from ./tests/test_types_extras.py
|
|
|
9232a0 |
Patch0: test_types_extras-2.9.3-test_from_tables.patch
|
|
|
9232a0 |
|
|
|
9232a0 |
%description
|
|
|
9232a0 |
%{desc}
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python2}
|
|
|
9232a0 |
%package -n python2-%{srcname}
|
|
|
9232a0 |
%{?python_provide:%python_provide python2-%{srcname}}
|
|
|
9232a0 |
Summary: %{sum} 2
|
|
|
9232a0 |
|
|
|
9232a0 |
%description -n python2-%{srcname}
|
|
|
9232a0 |
%{desc}
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%package -n python2-%{srcname}-tests
|
|
|
9232a0 |
Summary: A testsuite for %sum 2
|
|
|
9232a0 |
Requires: python2-%srcname = %version-%release
|
|
|
9232a0 |
|
|
|
9232a0 |
%description -n python2-%{srcname}-tests
|
|
|
9232a0 |
%desc
|
|
|
9232a0 |
This sub-package delivers set of tests for the adapter.
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python2_debug}
|
|
|
9232a0 |
%package -n python2-%{srcname}-debug
|
|
|
9232a0 |
Summary: A PostgreSQL database adapter for Python 2 (debug build)
|
|
|
9232a0 |
# Require the base package, as we're sharing .py/.pyc files:
|
|
|
9232a0 |
Requires: python2-%{srcname} = %{version}-%{release}
|
|
|
9232a0 |
%{?python_provide:%python_provide python2-%{srcname}-debug}
|
|
|
9232a0 |
|
|
|
9232a0 |
%description -n python2-%{srcname}-debug
|
|
|
9232a0 |
This is a build of the psycopg PostgreSQL database adapter for the debug
|
|
|
9232a0 |
build of Python 2.
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python3}
|
|
|
9232a0 |
%package -n python%{python3_pkgversion}-%{srcname}-tests
|
|
|
9232a0 |
Summary: A testsuite for %sum 2
|
|
|
9232a0 |
Requires: python%{python3_pkgversion}-%{srcname} = %version-%release
|
|
|
9232a0 |
|
|
|
9232a0 |
%description -n python%{python3_pkgversion}-%{srcname}-tests
|
|
|
9232a0 |
%desc
|
|
|
9232a0 |
This sub-package delivers set of tests for the adapter.
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python3_debug}
|
|
|
9232a0 |
%package -n python%{python3_pkgversion}-psycopg2-debug
|
|
|
9232a0 |
Summary: A PostgreSQL database adapter for Python 3 (debug build)
|
|
|
9232a0 |
# Require base python 3 package, as we're sharing .py/.pyc files:
|
|
|
9232a0 |
Requires: python%{python3_pkgversion}-psycopg2 = %{version}-%{release}
|
|
|
9232a0 |
|
|
|
9232a0 |
%description -n python%{python3_pkgversion}-%{srcname}-debug
|
|
|
9232a0 |
This is a build of the psycopg PostgreSQL database adapter for the debug
|
|
|
9232a0 |
build of Python 3.
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %zope
|
|
|
9232a0 |
%package zope
|
|
|
9232a0 |
Summary: Zope Database Adapter ZPsycopgDA
|
|
|
9232a0 |
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
|
|
|
9232a0 |
License: GPLv2+ with exceptions or ZPLv1.0
|
|
|
9232a0 |
Requires: %{name} = %{version}-%{release}
|
|
|
9232a0 |
Requires: zope
|
|
|
9232a0 |
|
|
|
9232a0 |
%description zope
|
|
|
9232a0 |
Zope Database Adapter for PostgreSQL, called ZPsycopgDA
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%prep
|
|
|
9232a0 |
%setup -q -n psycopg2-%{version}
|
|
|
9232a0 |
|
|
|
9232a0 |
# The patch is applied only for s390 architecture as
|
|
|
9232a0 |
# on other architectures the test works
|
|
|
9232a0 |
%ifarch s390x s390
|
|
|
9232a0 |
%patch0 -p0
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
%build
|
|
|
9232a0 |
export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS}
|
|
|
9232a0 |
for python in %{python_runtimes} ; do
|
|
|
9232a0 |
$python setup.py build
|
|
|
9232a0 |
done
|
|
|
9232a0 |
|
|
|
9232a0 |
%check
|
|
|
9232a0 |
%if %{with tests}
|
|
|
9232a0 |
export PGTESTS_LOCALE=C.UTF-8
|
|
|
9232a0 |
%postgresql_tests_run
|
|
|
9232a0 |
|
|
|
9232a0 |
export PSYCOPG2_TESTDB=${PGTESTS_DATABASES##*:}
|
|
|
9232a0 |
export PSYCOPG2_TESTDB_HOST=$PGHOST
|
|
|
9232a0 |
export PSYCOPG2_TESTDB_PORT=$PGPORT
|
|
|
9232a0 |
|
|
|
9232a0 |
cmd="import tests; tests.unittest.main(defaultTest='tests.test_suite')"
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python2}
|
|
|
9232a0 |
PYTHONPATH=%buildroot%python2_sitearch %__python2 -c "$cmd" --verbose
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
%if %{with python3}
|
|
|
9232a0 |
PYTHONPATH=%buildroot%python3_sitearch %__python3 -c "$cmd" --verbose
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%install
|
|
|
9232a0 |
export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS}
|
|
|
9232a0 |
for python in %{python_runtimes} ; do
|
|
|
9232a0 |
$python setup.py install --no-compile --root %{buildroot}
|
|
|
9232a0 |
done
|
|
|
9232a0 |
|
|
|
9232a0 |
# Upstream removed tests from the package so we need to add them manually
|
|
|
9232a0 |
%if %{with python2}
|
|
|
9232a0 |
cp -r tests/ %{buildroot}%{python2_sitearch}/%{srcname}/tests/
|
|
|
9232a0 |
for i in `find %{buildroot}%{python2_sitearch}/%{srcname}/tests/ -iname "*.py"`; do
|
|
|
9232a0 |
sed -i 's|#!/usr/bin/env python|#!/usr/bin/python2|' $i
|
|
|
9232a0 |
done
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
%if %{with python3}
|
|
|
9232a0 |
cp -r tests/ %{buildroot}%{python3_sitearch}/%{srcname}/tests/
|
|
|
9232a0 |
for i in `find %{buildroot}%{python3_sitearch}/%{srcname}/tests/ -iname "*.py"`; do
|
|
|
9232a0 |
sed -i 's|#!/usr/bin/env python|#!%{__python3}|' $i
|
|
|
9232a0 |
done
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %zope
|
|
|
9232a0 |
%{__install} -d %{buildroot}%{ZPsycopgDAdir}
|
|
|
9232a0 |
%{__cp} -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python2}
|
|
|
9232a0 |
%files -n python2-psycopg2
|
|
|
9232a0 |
%license LICENSE
|
|
|
9232a0 |
%doc AUTHORS NEWS README.rst
|
|
|
9232a0 |
%dir %{python2_sitearch}/psycopg2
|
|
|
9232a0 |
%{python2_sitearch}/psycopg2/*.py
|
|
|
9232a0 |
%{python2_sitearch}/psycopg2/*.pyc
|
|
|
9232a0 |
%{python2_sitearch}/psycopg2/_psycopg.so
|
|
|
9232a0 |
%{python2_sitearch}/psycopg2/*.pyo
|
|
|
9232a0 |
%{python2_sitearch}/psycopg2-%{version}-py2*.egg-info
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%files -n python2-%{srcname}-tests
|
|
|
9232a0 |
%{python2_sitearch}/psycopg2/tests
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python2_debug}
|
|
|
9232a0 |
%files -n python2-%{srcname}-debug
|
|
|
9232a0 |
%license LICENSE
|
|
|
9232a0 |
%{python2_sitearch}/psycopg2/_psycopg_d.so
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python3}
|
|
|
9232a0 |
%files -n python%{python3_pkgversion}-psycopg2
|
|
|
9232a0 |
%license LICENSE
|
|
|
9232a0 |
%doc AUTHORS NEWS README.rst
|
|
|
9232a0 |
%dir %{python3_sitearch}/psycopg2
|
|
|
9232a0 |
%{python3_sitearch}/psycopg2/*.py
|
|
|
9232a0 |
%{python3_sitearch}/psycopg2/_psycopg.cpython-%{python3_version_nodots}[!d]*.so
|
|
|
9232a0 |
%dir %{python3_sitearch}/psycopg2/__pycache__
|
|
|
9232a0 |
%{python3_sitearch}/psycopg2/__pycache__/*.py{c,o}
|
|
|
9232a0 |
%{python3_sitearch}/psycopg2-%{version}-py3*.egg-info
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%files -n python%{python3_pkgversion}-%{srcname}-tests
|
|
|
9232a0 |
%{python3_sitearch}/psycopg2/tests
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %{with python3_debug}
|
|
|
9232a0 |
%files -n python%{python3_pkgversion}-psycopg2-debug
|
|
|
9232a0 |
%license LICENSE
|
|
|
9232a0 |
%{python3_sitearch}/psycopg2/_psycopg.cpython-%{python3_version_nodots}d*.so
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%if %zope
|
|
|
9232a0 |
%files zope
|
|
|
9232a0 |
%license LICENSE
|
|
|
9232a0 |
%dir %{ZPsycopgDAdir}
|
|
|
9232a0 |
%{ZPsycopgDAdir}/*.py
|
|
|
9232a0 |
%{ZPsycopgDAdir}/*.pyo
|
|
|
9232a0 |
%{ZPsycopgDAdir}/*.pyc
|
|
|
9232a0 |
%{ZPsycopgDAdir}/dtml/*
|
|
|
9232a0 |
%{ZPsycopgDAdir}/icons/*
|
|
|
9232a0 |
%endif
|
|
|
9232a0 |
|
|
|
9232a0 |
|
|
|
9232a0 |
%changelog
|
|
|
9232a0 |
* Tue Nov 29 2022 Charalampos Stratakis <cstratak@redhat.com> - 2.9.3-1
|
|
|
9232a0 |
- Initial package
|
|
|
9232a0 |
- Fedora contributions by:
|
|
|
9232a0 |
Bill Nottingham <notting@fedoraproject.org>
|
|
|
9232a0 |
Charalampos Stratakis <cstratak@redhat.com>
|
|
|
9232a0 |
David Malcolm <dmalcolm@redhat.com>
|
|
|
9232a0 |
Dennis Gilmore <dennis@ausil.us>
|
|
|
9232a0 |
Devrim GÜNDÜZ <devrim@fedoraproject.org>
|
|
|
9232a0 |
Filip Januš <fjanus@redhat.com>
|
|
|
9232a0 |
Honza Horak <hhorak@redhat.com>
|
|
|
9232a0 |
Ignacio Vazquez-Abrams <ivazquez@fedoraproject.org>
|
|
|
9232a0 |
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
|
9232a0 |
Jason Tibbitts <tibbs@math.uh.edu>
|
|
|
9232a0 |
Jesse Keating <jkeating@fedoraproject.org>
|
|
|
9232a0 |
Jozef Mlich <jmlich@redhat.com>
|
|
|
9232a0 |
Lumir Balhar <lbalhar@redhat.com>
|
|
|
9232a0 |
Miro Hrončok <miro@hroncok.cz>
|
|
|
9232a0 |
Ondřej Sloup <ondrej.sloup@protonmail.com>
|
|
|
9232a0 |
Patrik Novotný <panovotn@redhat.com>
|
|
|
9232a0 |
Pavel Raiskup <praiskup@redhat.com>
|
|
|
9232a0 |
Peter Robinson <pbrobinson@fedoraproject.org>
|
|
|
9232a0 |
Petr Kubat <pkubat@redhat.com>
|
|
|
9232a0 |
Slavek Kabrda <bkabrda@redhat.com>
|
|
|
9232a0 |
Todd Zullinger <tmz@fedoraproject.org>
|
|
|
9232a0 |
Tomas Hrnciar <thrnciar@redhat.com>
|
|
|
9232a0 |
Tom Lane <tgl@fedoraproject.org>
|