1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-05-04 07:27:38 -04:00

databases/py-sqlite3: convert to USE_PYTHON=pep517

PR: 268283
This commit is contained in:
Charlie Li 2025-03-11 22:32:06 -04:00
parent 7a5f12ca6a
commit b7e75ada7e
No known key found for this signature in database
GPG key ID: 678F936058415CCA
3 changed files with 30 additions and 29 deletions
databases/py-sqlite3

View file

@ -1,6 +1,6 @@
PORTNAME= sqlite3
DISTVERSION= ${PYTHON_DISTVERSION}
PORTREVISION= 9
PORTREVISION= 10
CATEGORIES= databases python
MASTER_SITES= PYTHON/ftp/python/${DISTVERSION}
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -13,29 +13,33 @@ COMMENT= Standard Python binding to the SQLite3 library (Python ${PYTHON_VER})
LICENSE= PSFL
LICENSE_FILE= ${WRKDIR}/Python-${DISTVERSION}/LICENSE
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py-setuptools@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR}
LIB_DEPENDS= libsqlite3.so:databases/sqlite3
PORTSCOUT= ignore:1
USES= compiler:c11 python tar:xz
USE_PYTHON= autoplist distutils allflavors
USE_PYTHON= allflavors autoplist pep517
DISTINFO_FILE= ${PORTSDIR}/lang/python${PYTHON_SUFFIX}/distinfo
WRKSRC_SUBDIR= Modules
PYDISTUTILS_INSTALLARGS+= --install-lib ${PYTHON_LIBDIR}/lib-dynload
SUB_LIST+= DISTVERSION=${DISTVERSION}
SUB_FILES= pyproject.toml
PLIST_FILES= ${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;}/lib-dynload/_sqlite3${PYTHON_EXT_SUFFIX}.so
TESTING_UNSAFE= ModuleNotFoundError: No module named '_sqlite3'
PORTSCOUT= ignore:1
.include <bsd.port.pre.mk>
post-extract:
pre-configure:
@${CP} ${FILESDIR}/setup.py ${WRKSRC}
@${MV} ${WRKDIR}/pyproject.toml ${WRKSRC}
post-install:
@${STRIP_CMD} ${STAGEDIR}${PYTHON_LIBDIR}/lib-dynload/_sqlite3*.so
@${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/_sqlite3${PYTHON_EXT_SUFFIX}.so
# lib-dynload is the expected location
@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_LIBDIR}/lib-dynload
@(cd ${STAGEDIR}${PYTHONPREFIX_LIBDIR}/lib-dynload && ${LN} -s ../site-packages/_sqlite3${PYTHON_EXT_SUFFIX}.so)
do-test:
@${PYTHON_CMD} -c 'import sqlite3' # minimal smoke test
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View file

@ -0,0 +1,11 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "sqlite3"
version = "%%DISTVERSION%%"
description = "SQLite 3 extension to Python"
[tool.setuptools]
packages = []

View file

@ -1,21 +1,10 @@
#!/usr/bin/env python
# To use:
# python setup.py install
#
import platform
import sysconfig
from setuptools import setup, Extension
try:
import distutils
from distutils import sysconfig
from distutils.command.install import install
from distutils.core import setup, Extension
except:
raise SystemExit("Distutils problem")
install.sub_commands = [x for x in install.sub_commands if 'egg' not in x[0]]
prefix = sysconfig.PREFIX
prefix = sysconfig.get_config_var('prefix')
inc_dirs = [prefix + "/include", "Modules/_sqlite"]
lib_dirs = [prefix + "/lib"]
libs = ["sqlite3"]
@ -44,10 +33,7 @@ try:
except AttributeError:
macros.append(('SQLITE_OMIT_LOAD_EXTENSION', '1'))
setup(name = "sqlite3",
description = "SQLite 3 extension to Python",
ext_modules = [Extension('_sqlite3', sqlite_srcs,
setup(ext_modules = [Extension('_sqlite3', sqlite_srcs,
include_dirs = inc_dirs,
libraries = libs,
library_dirs = lib_dirs,