git: 610d7a9ee076 - main - databases/py-apsw: Update to 3.41.2.0

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sat, 27 May 2023 04:26:18 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=610d7a9ee076f4f35ca0175c22e4822e8d11683d

commit 610d7a9ee076f4f35ca0175c22e4822e8d11683d
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-05-27 04:08:18 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-05-27 04:08:18 +0000

    databases/py-apsw: Update to 3.41.2.0
    
    - Change MASTER_SITES from GitHub to PYPI
    - Update WWW
    
    Changes:        https://github.com/rogerbinns/apsw/releases
                    https://rogerbinns.github.io/apsw/changes.html
---
 databases/py-apsw/Makefile             | 18 ++++++++------
 databases/py-apsw/distinfo             |  8 ++++---
 databases/py-apsw/files/patch-setup.py | 44 ++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/databases/py-apsw/Makefile b/databases/py-apsw/Makefile
index 9be71481b950..5bdbf25b2db5 100644
--- a/databases/py-apsw/Makefile
+++ b/databases/py-apsw/Makefile
@@ -1,20 +1,21 @@
 PORTNAME=	apsw
-PORTVERSION=	3.38.5
-DISTVERSIONSUFFIX=	-r1
+PORTVERSION=	3.41.2.0
 CATEGORIES=	databases python
-MASTER_SITES=	https://github.com/rogerbinns/apsw/releases/download/${PORTVERSION}${DISTVERSIONSUFFIX}/
+MASTER_SITES=	PYPI \
+		https://sqlite.org/2023/:sqlite
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+DISTFILES=	apsw-${PORTVERSION}${EXTRACT_SUFX} \
+		sqlite-autoconf-${PORTVERSION:C|\.([0-9])[[:>:]]|0\1|g:C|\.||g}.tar.gz:sqlite
 
 MAINTAINER=	sunpoet@FreeBSD.org
 COMMENT=	Another Python SQLite Wrapper
-WWW=		https://rogerbinns.github.io/apsw/
+WWW=		https://rogerbinns.github.io/apsw/ \
+		https://github.com/rogerbinns/apsw
 
 LICENSE=	ZLIB
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BUILD_DEPENDS=	sqlite3>=${PORTVERSION:R},1:databases/sqlite3
-
-USES=		localbase python:3.7+ sqlite:3 zip
+USES=		localbase python:3.7+
 USE_PYTHON=	autoplist concurrent distutils unittest
 
 TEST_ENV=	PYTHONPATH=${STAGEDIR}${PYTHON_SITELIBDIR}
@@ -26,6 +27,9 @@ EXTENSION_DESC=	Allow loadable extensions
 EXTENSION_VARS=		PYDISTUTILS_BUILDARGS+=--enable=load_extension
 EXTENSION_VARS_OFF=	PYDISTUTILS_BUILDARGS+=--omit=load_extension
 
+post-patch:
+	@${MV} ${WRKDIR}/sqlite-autoconf-${PORTVERSION:C|\.([0-9])[[:>:]]|0\1|g:C|\.||g} ${WRKSRC}/sqlite3
+
 post-install:
 	${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' -exec ${STRIP_CMD} {} +
 
diff --git a/databases/py-apsw/distinfo b/databases/py-apsw/distinfo
index 1328a800e19e..15002617efb8 100644
--- a/databases/py-apsw/distinfo
+++ b/databases/py-apsw/distinfo
@@ -1,3 +1,5 @@
-TIMESTAMP = 1654774064
-SHA256 (apsw-3.38.5-r1.zip) = 172ebe553db6b9ed7aaaef850199c11072624db1f210c7bf8a3b6965b52e44f5
-SIZE (apsw-3.38.5-r1.zip) = 748553
+TIMESTAMP = 1684104360
+SHA256 (apsw-3.41.2.0.tar.gz) = 99905371d0fb423df84691371b3d1fee27efc09032f33a051b36c73b158fc34a
+SIZE (apsw-3.41.2.0.tar.gz) = 379762
+SHA256 (sqlite-autoconf-3410200.tar.gz) = e98c100dd1da4e30fa460761dab7c0b91a50b785e167f8c57acc46514fae9499
+SIZE (sqlite-autoconf-3410200.tar.gz) = 3125545
diff --git a/databases/py-apsw/files/patch-setup.py b/databases/py-apsw/files/patch-setup.py
new file mode 100644
index 000000000000..dba26bfcd001
--- /dev/null
+++ b/databases/py-apsw/files/patch-setup.py
@@ -0,0 +1,44 @@
+--- setup.py.orig	2023-03-26 20:08:04 UTC
++++ setup.py
+@@ -227,40 +227,7 @@ class fetch(Command):
+         if self.sqlite:
+             write("  Getting the SQLite amalgamation")
+ 
+-            AURL = "https://sqlite.org/sqlite-autoconf-%s.tar.gz" % (self.webversion, )
+-
+-            AURL = fixup_download_url(AURL)
+-
+-            data = self.download(AURL, checksum=True)
+-
+-            # we need to run configure to get various -DHAVE_foo flags on non-windows platforms
+-            # delete existing sqlite3 directory if it exists, but save sqlite3config.h if it exists
+-            sqlite3config_h = None
+-            if os.path.exists("sqlite3/sqlite3config.h"):
+-                sqlite3config_h = read_whole_file("sqlite3/sqlite3config.h", "rt")
+-            if os.path.exists('sqlite3'):
+-                for dirpath, dirnames, filenames in os.walk('sqlite3', topdown=False):
+-                    for file in filenames:
+-                        os.remove(os.path.join(dirpath, file))
+-                    for dir in dirnames:
+-                        os.rmdir(os.path.join(dirpath, dir))
+-                os.rmdir('sqlite3')
+-            # if you get an exception here it is likely that you don't have the python zlib module
+-            import zlib
+-            tar = tarfile.open("nonexistentname to keep old python happy", 'r', data)
+-            configmember = None
+-            for member in tar.getmembers():
+-                tar.extract(member)
+-                # find first file named configure
+-                if not configmember and member.name.endswith("/configure"):
+-                    configmember = member
+-            tar.close()
+-            # the directory name has changed a bit with each release so try to work out what it is
+-            if not configmember:
+-                write("Unable to determine directory it extracted to.", dest=sys.stderr)
+-                sys.exit(19)
+-            dirname = configmember.name.split('/')[0]
+-            os.rename(dirname, 'sqlite3')
++            dirname = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'sqlite3')
+             if sys.platform != "win32":
+                 os.chdir('sqlite3')
+                 write("    Running configure to work out SQLite compilation flags")