git: 27f3f4018fbe - main - databases/py-sqlite3: fix build with python 3.11

From: Dmitry Marakasov <amdmi3_at_FreeBSD.org>
Date: Wed, 24 Nov 2021 17:01:45 UTC
The branch main has been updated by amdmi3:

URL: https://cgit.FreeBSD.org/ports/commit/?id=27f3f4018fbe293d3a12dd2fd8212a93c4619b9a

commit 27f3f4018fbe293d3a12dd2fd8212a93c4619b9a
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2021-11-10 20:27:02 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2021-11-24 17:00:33 +0000

    databases/py-sqlite3: fix build with python 3.11
    
    PR:             259745
    Approved by:    python
---
 databases/py-sqlite3/files/setup3.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/databases/py-sqlite3/files/setup3.py b/databases/py-sqlite3/files/setup3.py
index 4a5bf6bb5ef6..7407503ceb54 100644
--- a/databases/py-sqlite3/files/setup3.py
+++ b/databases/py-sqlite3/files/setup3.py
@@ -3,6 +3,8 @@
 #       python setup.py install
 #
 
+import platform
+
 try:
     import distutils
     from distutils import sysconfig
@@ -19,7 +21,6 @@ lib_dirs = [prefix + "/lib"]
 libs = ["sqlite3"]
 macros = [('MODULE_NAME', '"sqlite3"')]
 sqlite_srcs = [
-'_sqlite/cache.c',
 '_sqlite/connection.c',
 '_sqlite/cursor.c',
 '_sqlite/microprotocols.c',
@@ -29,6 +30,11 @@ sqlite_srcs = [
 '_sqlite/statement.c',
 '_sqlite/util.c']
 
+major, minor = map(int, platform.python_version_tuple()[:2])
+
+if (major, minor) <= (3, 10):
+    sqlite_srcs.append('_sqlite/cache.c',)
+
 try:
     import ctypes
     ctypes.CDLL('libsqlite3.so').sqlite3_load_extension