Auto sync2gitlab import of python3.11-psycopg2-2.9.3-1.el8.src.rpm
This commit is contained in:
parent
ca98b1ab86
commit
06b23a76d5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/psycopg2-2.9.3.tar.gz
|
282
python3.11-psycopg2.spec
Normal file
282
python3.11-psycopg2.spec
Normal file
@ -0,0 +1,282 @@
|
||||
%global __python3 /usr/bin/python3.11
|
||||
%global python3_pkgversion 3.11
|
||||
|
||||
# RHEL python3.11: Python 3 and Python 3 debug enabled, both Python 2 builds disabled
|
||||
%bcond_without python3
|
||||
%bcond_without python3_debug
|
||||
%bcond_with python2
|
||||
%bcond_with python2_debug
|
||||
|
||||
%bcond_without tests
|
||||
|
||||
%global srcname psycopg2
|
||||
%global sum A PostgreSQL database adapter for Python
|
||||
%global desc Psycopg is the most popular PostgreSQL adapter for the Python \
|
||||
programming language. At its core it fully implements the Python DB \
|
||||
API 2.0 specifications. Several extensions allow access to many of the \
|
||||
features offered by PostgreSQL.
|
||||
|
||||
%global python_runtimes \\\
|
||||
%{?with_python2:python2} \\\
|
||||
%{?with_python2_debug:python2-debug} \\\
|
||||
%{?with_python3:python%{python3_pkgversion}} \\\
|
||||
%{?with_python3_debug:python%{python3_pkgversion}d}
|
||||
|
||||
%{!?with_python2:%{!?with_python3:%{error:one python version needed}}}
|
||||
|
||||
# Python 2.5+ is not supported by Zope, so it does not exist in
|
||||
# recent Fedora releases. That's why zope subpackage is disabled.
|
||||
%global zope 0
|
||||
%if %zope
|
||||
%global ZPsycopgDAdir %{_localstatedir}/lib/zope/Products/ZPsycopgDA
|
||||
%endif
|
||||
|
||||
|
||||
Summary: %{sum}
|
||||
Name: python%{python3_pkgversion}-%{srcname}
|
||||
Version: 2.9.3
|
||||
Release: 1%{?dist}
|
||||
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
|
||||
License: LGPLv3+ with exceptions
|
||||
Url: http://initd.org/psycopg/
|
||||
|
||||
Source0: http://initd.org/psycopg/tarballs/PSYCOPG-2-8/psycopg2-%{version}.tar.gz
|
||||
|
||||
%{?with_python2:BuildRequires: python2-devel python2-setuptools}
|
||||
%{?with_python3:BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-rpm-macros python%{python3_pkgversion}-setuptools}
|
||||
%{?with_python2_debug:BuildRequires: python2-debug}
|
||||
%{?with_python3_debug:BuildRequires: python%{python3_pkgversion}-debug}
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libpq-devel
|
||||
|
||||
# For testsuite
|
||||
%if %{with tests}
|
||||
BuildRequires: postgresql-test-rpm-macros
|
||||
%endif
|
||||
|
||||
Conflicts: python-psycopg2-zope < %{version}
|
||||
|
||||
# Remove test 'test_from_tables' for s390 architecture
|
||||
# from ./tests/test_types_extras.py
|
||||
Patch0: test_types_extras-2.9.3-test_from_tables.patch
|
||||
|
||||
%description
|
||||
%{desc}
|
||||
|
||||
|
||||
%if %{with python2}
|
||||
%package -n python2-%{srcname}
|
||||
%{?python_provide:%python_provide python2-%{srcname}}
|
||||
Summary: %{sum} 2
|
||||
|
||||
%description -n python2-%{srcname}
|
||||
%{desc}
|
||||
|
||||
|
||||
%package -n python2-%{srcname}-tests
|
||||
Summary: A testsuite for %sum 2
|
||||
Requires: python2-%srcname = %version-%release
|
||||
|
||||
%description -n python2-%{srcname}-tests
|
||||
%desc
|
||||
This sub-package delivers set of tests for the adapter.
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python2_debug}
|
||||
%package -n python2-%{srcname}-debug
|
||||
Summary: A PostgreSQL database adapter for Python 2 (debug build)
|
||||
# Require the base package, as we're sharing .py/.pyc files:
|
||||
Requires: python2-%{srcname} = %{version}-%{release}
|
||||
%{?python_provide:%python_provide python2-%{srcname}-debug}
|
||||
|
||||
%description -n python2-%{srcname}-debug
|
||||
This is a build of the psycopg PostgreSQL database adapter for the debug
|
||||
build of Python 2.
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python3}
|
||||
%package -n python%{python3_pkgversion}-%{srcname}-tests
|
||||
Summary: A testsuite for %sum 2
|
||||
Requires: python%{python3_pkgversion}-%{srcname} = %version-%release
|
||||
|
||||
%description -n python%{python3_pkgversion}-%{srcname}-tests
|
||||
%desc
|
||||
This sub-package delivers set of tests for the adapter.
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python3_debug}
|
||||
%package -n python%{python3_pkgversion}-psycopg2-debug
|
||||
Summary: A PostgreSQL database adapter for Python 3 (debug build)
|
||||
# Require base python 3 package, as we're sharing .py/.pyc files:
|
||||
Requires: python%{python3_pkgversion}-psycopg2 = %{version}-%{release}
|
||||
|
||||
%description -n python%{python3_pkgversion}-%{srcname}-debug
|
||||
This is a build of the psycopg PostgreSQL database adapter for the debug
|
||||
build of Python 3.
|
||||
%endif
|
||||
|
||||
|
||||
%if %zope
|
||||
%package zope
|
||||
Summary: Zope Database Adapter ZPsycopgDA
|
||||
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
|
||||
License: GPLv2+ with exceptions or ZPLv1.0
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: zope
|
||||
|
||||
%description zope
|
||||
Zope Database Adapter for PostgreSQL, called ZPsycopgDA
|
||||
%endif
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n psycopg2-%{version}
|
||||
|
||||
# The patch is applied only for s390 architecture as
|
||||
# on other architectures the test works
|
||||
%ifarch s390x s390
|
||||
%patch0 -p0
|
||||
%endif
|
||||
|
||||
%build
|
||||
export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS}
|
||||
for python in %{python_runtimes} ; do
|
||||
$python setup.py build
|
||||
done
|
||||
|
||||
%check
|
||||
%if %{with tests}
|
||||
export PGTESTS_LOCALE=C.UTF-8
|
||||
%postgresql_tests_run
|
||||
|
||||
export PSYCOPG2_TESTDB=${PGTESTS_DATABASES##*:}
|
||||
export PSYCOPG2_TESTDB_HOST=$PGHOST
|
||||
export PSYCOPG2_TESTDB_PORT=$PGPORT
|
||||
|
||||
cmd="import tests; tests.unittest.main(defaultTest='tests.test_suite')"
|
||||
|
||||
%if %{with python2}
|
||||
PYTHONPATH=%buildroot%python2_sitearch %__python2 -c "$cmd" --verbose
|
||||
%endif
|
||||
%if %{with python3}
|
||||
PYTHONPATH=%buildroot%python3_sitearch %__python3 -c "$cmd" --verbose
|
||||
%endif
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS}
|
||||
for python in %{python_runtimes} ; do
|
||||
$python setup.py install --no-compile --root %{buildroot}
|
||||
done
|
||||
|
||||
# Upstream removed tests from the package so we need to add them manually
|
||||
%if %{with python2}
|
||||
cp -r tests/ %{buildroot}%{python2_sitearch}/%{srcname}/tests/
|
||||
for i in `find %{buildroot}%{python2_sitearch}/%{srcname}/tests/ -iname "*.py"`; do
|
||||
sed -i 's|#!/usr/bin/env python|#!/usr/bin/python2|' $i
|
||||
done
|
||||
%endif
|
||||
%if %{with python3}
|
||||
cp -r tests/ %{buildroot}%{python3_sitearch}/%{srcname}/tests/
|
||||
for i in `find %{buildroot}%{python3_sitearch}/%{srcname}/tests/ -iname "*.py"`; do
|
||||
sed -i 's|#!/usr/bin/env python|#!%{__python3}|' $i
|
||||
done
|
||||
%endif
|
||||
|
||||
%if %zope
|
||||
%{__install} -d %{buildroot}%{ZPsycopgDAdir}
|
||||
%{__cp} -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python2-psycopg2
|
||||
%license LICENSE
|
||||
%doc AUTHORS NEWS README.rst
|
||||
%dir %{python2_sitearch}/psycopg2
|
||||
%{python2_sitearch}/psycopg2/*.py
|
||||
%{python2_sitearch}/psycopg2/*.pyc
|
||||
%{python2_sitearch}/psycopg2/_psycopg.so
|
||||
%{python2_sitearch}/psycopg2/*.pyo
|
||||
%{python2_sitearch}/psycopg2-%{version}-py2*.egg-info
|
||||
|
||||
|
||||
%files -n python2-%{srcname}-tests
|
||||
%{python2_sitearch}/psycopg2/tests
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python2_debug}
|
||||
%files -n python2-%{srcname}-debug
|
||||
%license LICENSE
|
||||
%{python2_sitearch}/psycopg2/_psycopg_d.so
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python3}
|
||||
%files -n python%{python3_pkgversion}-psycopg2
|
||||
%license LICENSE
|
||||
%doc AUTHORS NEWS README.rst
|
||||
%dir %{python3_sitearch}/psycopg2
|
||||
%{python3_sitearch}/psycopg2/*.py
|
||||
%{python3_sitearch}/psycopg2/_psycopg.cpython-%{python3_version_nodots}[!d]*.so
|
||||
%dir %{python3_sitearch}/psycopg2/__pycache__
|
||||
%{python3_sitearch}/psycopg2/__pycache__/*.py{c,o}
|
||||
%{python3_sitearch}/psycopg2-%{version}-py3*.egg-info
|
||||
|
||||
|
||||
%files -n python%{python3_pkgversion}-%{srcname}-tests
|
||||
%{python3_sitearch}/psycopg2/tests
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with python3_debug}
|
||||
%files -n python%{python3_pkgversion}-psycopg2-debug
|
||||
%license LICENSE
|
||||
%{python3_sitearch}/psycopg2/_psycopg.cpython-%{python3_version_nodots}d*.so
|
||||
%endif
|
||||
|
||||
|
||||
%if %zope
|
||||
%files zope
|
||||
%license LICENSE
|
||||
%dir %{ZPsycopgDAdir}
|
||||
%{ZPsycopgDAdir}/*.py
|
||||
%{ZPsycopgDAdir}/*.pyo
|
||||
%{ZPsycopgDAdir}/*.pyc
|
||||
%{ZPsycopgDAdir}/dtml/*
|
||||
%{ZPsycopgDAdir}/icons/*
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Nov 29 2022 Charalampos Stratakis <cstratak@redhat.com> - 2.9.3-1
|
||||
- Initial package
|
||||
- Fedora contributions by:
|
||||
Bill Nottingham <notting@fedoraproject.org>
|
||||
Charalampos Stratakis <cstratak@redhat.com>
|
||||
David Malcolm <dmalcolm@redhat.com>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Devrim GÜNDÜZ <devrim@fedoraproject.org>
|
||||
Filip Januš <fjanus@redhat.com>
|
||||
Honza Horak <hhorak@redhat.com>
|
||||
Ignacio Vazquez-Abrams <ivazquez@fedoraproject.org>
|
||||
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
||||
Jason Tibbitts <tibbs@math.uh.edu>
|
||||
Jesse Keating <jkeating@fedoraproject.org>
|
||||
Jozef Mlich <jmlich@redhat.com>
|
||||
Lumir Balhar <lbalhar@redhat.com>
|
||||
Miro Hrončok <miro@hroncok.cz>
|
||||
Ondřej Sloup <ondrej.sloup@protonmail.com>
|
||||
Patrik Novotný <panovotn@redhat.com>
|
||||
Pavel Raiskup <praiskup@redhat.com>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Petr Kubat <pkubat@redhat.com>
|
||||
Slavek Kabrda <bkabrda@redhat.com>
|
||||
Todd Zullinger <tmz@fedoraproject.org>
|
||||
Tomas Hrnciar <thrnciar@redhat.com>
|
||||
Tom Lane <tgl@fedoraproject.org>
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (psycopg2-2.9.3.tar.gz) = 048184d1d162a371fc0fba711448a6fa8a6aac193421f4484c7f7b91c39065d5b632fa34fc15a901eca055d597302b1f9e38330b248ed0e4653dcdc544b0d660
|
54
test_types_extras-2.9.3-test_from_tables.patch
Normal file
54
test_types_extras-2.9.3-test_from_tables.patch
Normal file
@ -0,0 +1,54 @@
|
||||
--- tests/test_types_extras.py-orig 2021-12-29 13:51:56.000000000 +0100
|
||||
+++ tests/test_types_extras.py 2022-05-17 11:23:12.476001589 +0200
|
||||
@@ -616,51 +616,6 @@
|
||||
curs.execute("select (1,2)::type_ii")
|
||||
self.assertRaises(psycopg2.DataError, curs.fetchone)
|
||||
|
||||
- @slow
|
||||
- @skip_if_no_composite
|
||||
- @skip_before_postgres(8, 4)
|
||||
- def test_from_tables(self):
|
||||
- curs = self.conn.cursor()
|
||||
- curs.execute("""create table ctest1 (
|
||||
- id integer primary key,
|
||||
- temp int,
|
||||
- label varchar
|
||||
- );""")
|
||||
-
|
||||
- curs.execute("""alter table ctest1 drop temp;""")
|
||||
-
|
||||
- curs.execute("""create table ctest2 (
|
||||
- id serial primary key,
|
||||
- label varchar,
|
||||
- test_id integer references ctest1(id)
|
||||
- );""")
|
||||
-
|
||||
- curs.execute("""insert into ctest1 (id, label) values
|
||||
- (1, 'test1'),
|
||||
- (2, 'test2');""")
|
||||
- curs.execute("""insert into ctest2 (label, test_id) values
|
||||
- ('testa', 1),
|
||||
- ('testb', 1),
|
||||
- ('testc', 2),
|
||||
- ('testd', 2);""")
|
||||
-
|
||||
- psycopg2.extras.register_composite("ctest1", curs)
|
||||
- psycopg2.extras.register_composite("ctest2", curs)
|
||||
-
|
||||
- curs.execute("""
|
||||
- select ctest1, array_agg(ctest2) as test2s
|
||||
- from (
|
||||
- select ctest1, ctest2
|
||||
- from ctest1 inner join ctest2 on ctest1.id = ctest2.test_id
|
||||
- order by ctest1.id, ctest2.label
|
||||
- ) x group by ctest1;""")
|
||||
-
|
||||
- r = curs.fetchone()
|
||||
- self.assertEqual(r[0], (1, 'test1'))
|
||||
- self.assertEqual(r[1], [(1, 'testa', 1), (2, 'testb', 1)])
|
||||
- r = curs.fetchone()
|
||||
- self.assertEqual(r[0], (2, 'test2'))
|
||||
- self.assertEqual(r[1], [(3, 'testc', 2), (4, 'testd', 2)])
|
||||
|
||||
@skip_if_no_composite
|
||||
def test_non_dbapi_connection(self):
|
Loading…
Reference in New Issue
Block a user