import CS python3.12-psycopg2-2.9.6-2.el8
This commit is contained in:
commit
1fd698ff6a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
SOURCES/psycopg2-2.9.6.tar.gz
|
1
.python3.12-psycopg2.metadata
Normal file
1
.python3.12-psycopg2.metadata
Normal file
@ -0,0 +1 @@
|
||||
f8f323406dc89e83e738b3d5708a0fffe91de3f8 SOURCES/psycopg2-2.9.6.tar.gz
|
54
SOURCES/test_types_extras-2.9.3-test_from_tables.patch
Normal file
54
SOURCES/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):
|
286
SPECS/python3.12-psycopg2.spec
Normal file
286
SPECS/python3.12-psycopg2.spec
Normal file
@ -0,0 +1,286 @@
|
||||
%global __python3 /usr/bin/python3.12
|
||||
%global python3_pkgversion 3.12
|
||||
|
||||
# RHEL python3.12: 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.6
|
||||
Release: 2%{?dist}
|
||||
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
|
||||
License: LGPLv3+ with exceptions
|
||||
Url: https://www.psycopg.org/
|
||||
|
||||
Source0: https://github.com/psycopg/psycopg2/archive/%{version}/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
|
||||
BuildRequires: python3-sphinx
|
||||
|
||||
# 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 %{python3_pkgversion}
|
||||
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 %{python3_pkgversion} (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 %{python3_pkgversion}.
|
||||
%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 Jan 23 2024 Miro Hrončok <mhroncok@redhat.com> - 2.9.6-2
|
||||
- Rebuilt for timestamp .pyc invalidation mode
|
||||
|
||||
* Wed Oct 18 2023 Tomáš Hrnčiar <thrnciar@redhat.com> - 2.9.6-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@gunduz.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>
|
Loading…
Reference in New Issue
Block a user