Sync from SUSE:SLFO:Main python-psycopg2 revision 2660508958e298a30eda146f66a2025e

This commit is contained in:
Adrian Schröter 2024-12-13 11:59:02 +01:00
parent 4141036607
commit d8d0948dea
5 changed files with 163 additions and 46 deletions

BIN
psycopg2-2.9.6.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
psycopg2-2.9.9.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,37 @@
-------------------------------------------------------------------
Tue Oct 29 05:08:18 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Drop patch py313-tests.patch, included in:
- Add patch support-python-313.patch:
* Support Python 3.13.
-------------------------------------------------------------------
Mon Oct 28 21:56:17 UTC 2024 - Dirk Müller <dmueller@suse.com>
- add py313-tests.patch
-------------------------------------------------------------------
Wed Jan 3 10:10:03 UTC 2024 - Dirk Müller <dmueller@suse.com>
- require setuptools
-------------------------------------------------------------------
Tue Nov 28 21:39:17 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 2.9.9:
* Add support for Python 3.12.
* Drop support for Python 3.6.
* Wheel package bundled with PostgreSQL 16 libpq in order to
add support for recent features, such as ``sslcertmode``.
-------------------------------------------------------------------
Thu Sep 7 11:08:36 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 2.9.7:
* Fix propagation of exceptions raised during module
initialization
* Fix building when pg_config returns an empty string
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Apr 21 12:30:00 UTC 2023 - Dirk Müller <dmueller@suse.com> Fri Apr 21 12:30:00 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package python-psycopg2 # spec file for package python-psycopg2
# #
# Copyright (c) 2023 SUSE LLC # Copyright (c) 2024 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,25 +16,27 @@
# #
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
Name: python-psycopg2 Name: python-psycopg2
Version: 2.9.6 Version: 2.9.9
Release: 0 Release: 0
Summary: Python-PostgreSQL Database Adapter Summary: Python-PostgreSQL Database Adapter
License: LGPL-3.0-or-later AND (LGPL-3.0-or-later OR ZPL-2.0) AND SUSE-GPL-2.0-with-openssl-exception License: LGPL-3.0-or-later AND (LGPL-3.0-or-later OR ZPL-2.0) AND SUSE-GPL-2.0-with-openssl-exception
URL: http://initd.org/psycopg/ URL: https://www.psycopg.org/
Source: https://files.pythonhosted.org/packages/source/p/psycopg2/psycopg2-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/p/psycopg2/psycopg2-%{version}.tar.gz
BuildRequires: %{python_module devel >= 3.6} # PATCH-FIX-UPSTREAM gh#psycopg/psycopg2#1695
Patch0: support-python-313.patch
BuildRequires: %{python_module devel >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
# newer postgresql packages pg_config in -server-devel # newer postgresql packages pg_config in -server-devel
%if 0%{?sle_version} > 150100 || 0%{?suse_version} > 1500 %if 0%{?sle_version} > 150100 || 0%{?suse_version} > 1500
BuildRequires: postgresql-server-devel >= 9.1 BuildRequires: postgresql-server-devel >= 15
%else %else
BuildRequires: postgresql-devel >= 9.1 BuildRequires: postgresql-devel >= 15
%endif %endif
%if 0%{?suse_version} || 0%{?fedora_version} >= 24 %if 0%{?suse_version} || 0%{?fedora_version} >= 24
Suggests: postgresql-server Suggests: postgresql-server
@ -52,14 +54,14 @@ UPDATEs. psycopg2 also provide asychronous operations and support
for coroutine libraries. for coroutine libraries.
%prep %prep
%setup -q -n psycopg2-%{version} %autosetup -p1 -n psycopg2-%{version}
%build %build
export CFLAGS="%{optflags} -fno-strict-aliasing" export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_build %pyproject_wheel
%install %install
%python_install %pyproject_install
%python_expand rm -rf %{buildroot}%{$python_sitearch}/psycopg2/tests # Don't package testsuite %python_expand rm -rf %{buildroot}%{$python_sitearch}/psycopg2/tests # Don't package testsuite
%fdupes %{buildroot}/%{_mandir} # Create symlinks for man pages %fdupes %{buildroot}/%{_mandir} # Create symlinks for man pages
%python_expand %fdupes %{buildroot}%{$python_sitearch} %python_expand %fdupes %{buildroot}%{$python_sitearch}
@ -72,6 +74,6 @@ export CFLAGS="%{optflags} -fno-strict-aliasing"
%license LICENSE %license LICENSE
%doc AUTHORS NEWS README.rst %doc AUTHORS NEWS README.rst
%{python_sitearch}/psycopg2/ %{python_sitearch}/psycopg2/
%{python_sitearch}/psycopg2-%{version}-py%{python_version}.egg-info %{python_sitearch}/psycopg2-%{version}.dist-info
%changelog %changelog

81
support-python-313.patch Normal file
View File

@ -0,0 +1,81 @@
From 829a7a2be93f5d0fb1edbc0feb104181f208efc6 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Wed, 24 Apr 2024 09:50:32 +0200
Subject: [PATCH 1/6] _PyInterpreterState_Get() has become public in Python
3.13
Since 3.13.0a1 it has been renamed to PyInterpreterStateGet()
Source: https://github.com/python/cpython/pull/106321
---
psycopg/utils.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/psycopg/utils.c b/psycopg/utils.c
index 16be9062a..1dfb87d0b 100644
--- a/psycopg/utils.c
+++ b/psycopg/utils.c
@@ -392,7 +392,10 @@ psyco_set_error(PyObject *exc, cursorObject *curs, const char *msg)
static int
psyco_is_main_interp(void)
{
-#if PY_VERSION_HEX >= 0x03080000
+#if PY_VERSION_HEX >= 0x030d0000
+ /* tested with Python 3.13.0a6 */
+ return PyInterpreterState_Get() == PyInterpreterState_Main();
+#elif PY_VERSION_HEX >= 0x03080000
/* tested with Python 3.8.0a2 */
return _PyInterpreterState_Get() == PyInterpreterState_Main();
#else
From 3b9aa7cf9f3b000407dc0ee8e77fbcf54fa04d7f Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Wed, 24 Apr 2024 09:56:08 +0200
Subject: [PATCH 2/6] Fix tests with Python 3.13
The textual representation of addresses has changed, adapt the code to
expect different values on Python 3.13+.
See: https://github.com/python/cpython/commit/f22bf8e3cf899896cf587099d292
---
tests/test_ipaddress.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/test_ipaddress.py b/tests/test_ipaddress.py
index 4a2339ef9..3f8036900 100755
--- a/tests/test_ipaddress.py
+++ b/tests/test_ipaddress.py
@@ -18,6 +18,7 @@
from . import testutils
import unittest
+import sys
import psycopg2
import psycopg2.extras
@@ -68,7 +69,12 @@ def test_inet_adapt(self):
self.assertEquals(cur.fetchone()[0], '127.0.0.1/24')
cur.execute("select %s", [ip.ip_interface('::ffff:102:300/128')])
- self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
+
+ # The texual representation of addresses has changed in Python 3.13
+ if sys.version_info >= (3, 13):
+ self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
+ else:
+ self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
@testutils.skip_if_crdb("cidr")
def test_cidr_cast(self):
@@ -109,7 +115,12 @@ def test_cidr_adapt(self):
self.assertEquals(cur.fetchone()[0], '127.0.0.0/24')
cur.execute("select %s", [ip.ip_network('::ffff:102:300/128')])
- self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
+
+ # The texual representation of addresses has changed in Python 3.13
+ if sys.version_info >= (3, 13):
+ self.assertEquals(cur.fetchone()[0], '::ffff:1.2.3.0/128')
+ else:
+ self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
def test_suite():