FreeBSD Bugzilla – Attachment 249898 Details for
Bug 268283
databases/py-sqlite3: switch away from distutils
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed PEP517 switch (apply via git am)
0001-databases-py-sqlite3-Don-t-use-distutils-for-python3.patch (text/plain), 4.75 KB, created by
Oleg Sidorkin
on 2024-04-11 09:22:14 UTC
(
hide
)
Description:
Proposed PEP517 switch (apply via git am)
Filename:
MIME Type:
Creator:
Oleg Sidorkin
Created:
2024-04-11 09:22:14 UTC
Size:
4.75 KB
patch
obsolete
>From f726e57d8ba1257645ba136e5947976eb160b35d Mon Sep 17 00:00:00 2001 >From: Oleg Sidorkin <osidorkin@gmail.com> >Date: Thu, 11 Apr 2024 10:41:24 +0300 >Subject: [PATCH] databases/py-sqlite3: Don't use distutils for python3 > >--- > databases/py-sqlite3/Makefile | 22 ++++++++- > databases/py-sqlite3/files/pyproject.toml.in | 14 ++++++ > databases/py-sqlite3/files/setup3.py | 52 ++++++++++---------- > 3 files changed, 61 insertions(+), 27 deletions(-) > create mode 100644 databases/py-sqlite3/files/pyproject.toml.in > >diff --git a/databases/py-sqlite3/Makefile b/databases/py-sqlite3/Makefile >index 510ad060eac7..c724f3ee6688 100644 >--- a/databases/py-sqlite3/Makefile >+++ b/databases/py-sqlite3/Makefile >@@ -18,7 +18,15 @@ LIB_DEPENDS= libsqlite3.so:databases/sqlite3 > PORTSCOUT= ignore:1 > > USES= compiler:c11 python:2.7+ tar:xz >-USE_PYTHON= autoplist distutils allflavors >+USE_PYTHON= autoplist allflavors >+.if ${FLAVOR:U} == py27 >+USE_PYTHON+= distutils >+.else >+USE_PYTHON+= cython pep517 >+BUILD_DEPENDS+= ${UNZIP_CMD}:archivers/unzip \ >+ ${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \ >+ ${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR} >+.endif > > DISTINFO_FILE= ${PORTSDIR}/lang/python${PYTHON_SUFFIX}/distinfo > WRKSRC_SUBDIR= Modules >@@ -34,6 +42,18 @@ post-extract: > @${CP} ${FILESDIR}/setup.py ${WRKSRC} > .else > @${CP} ${FILESDIR}/setup3.py ${WRKSRC}/setup.py >+ @${SED} -e 's|PY_VERSION|${PYTHON_DISTVERSION}|' ${FILESDIR}/pyproject.toml.in >> ${WRKSRC}/pyproject.toml >+ ${TOUCH} ${WRKSRC}/__init__.py >+.endif >+ >+.if ${FLAVOR:U} != py27 >+do-install: >+ @${MKDIR} ${STAGEDIR}${PYTHONPREFIX_LIBDIR}/lib-dynload >+ @cd ${INSTALL_WRKSRC} \ >+ && ${UNZIP_CMD} -d ${STAGEDIR}${PYTHONPREFIX_LIBDIR}/lib-dynload ${BUILD_WRKSRC}/dist/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.whl >+ @${PYTHON_CMD} -B ${PORTSDIR}/Mk/Scripts/strip_RECORD.py \ >+ ${STAGEDIR}/${PYTHONPREFIX_LIBDIR}/lib-dynload/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.dist-info/RECORD | \ >+ ${SED} -e 's|^|${PYTHONPREFIX_LIBDIR}/lib-dynload/|' >> ${_PYTHONPKGLIST} > .endif > > post-install: >diff --git a/databases/py-sqlite3/files/pyproject.toml.in b/databases/py-sqlite3/files/pyproject.toml.in >new file mode 100644 >index 000000000000..8b11121016cb >--- /dev/null >+++ b/databases/py-sqlite3/files/pyproject.toml.in >@@ -0,0 +1,14 @@ >+[build-system] >+requires = ["setuptools", "cython", "wheel"] >+build-backend = "setuptools.build_meta" >+ >+[project] >+name = "sqlite3" >+version = "PY_VERSION" >+ >+[tool.setuptools.packages.find] >+exclude=["*"] >+ >+[tool.setuptools.package-data] >+"*" = ["_sqlite3.cpython-*.so"] >+ >diff --git a/databases/py-sqlite3/files/setup3.py b/databases/py-sqlite3/files/setup3.py >index 944c89920852..a3505a7474c2 100644 >--- a/databases/py-sqlite3/files/setup3.py >+++ b/databases/py-sqlite3/files/setup3.py >@@ -4,31 +4,29 @@ > # > > import platform >+import sysconfig > > try: >- import distutils >- from distutils import sysconfig >- from distutils.command.install import install >- from distutils.core import setup, Extension >-except: >- raise SystemExit("Distutils problem") >+ from setuptools import Extension, setup >+except Exception as e: >+ raise SystemExit("Setuptools problem", e) > >-install.sub_commands = [x for x in install.sub_commands if 'egg' not in x[0]] > >-prefix = sysconfig.PREFIX >+prefix = sysconfig.get_config_var('base') > inc_dirs = [prefix + "/include", "Modules/_sqlite"] > lib_dirs = [prefix + "/lib"] > libs = ["sqlite3"] > macros = [('MODULE_NAME', '"sqlite3"')] > sqlite_srcs = [ >-'_sqlite/connection.c', >-'_sqlite/cursor.c', >-'_sqlite/microprotocols.c', >-'_sqlite/module.c', >-'_sqlite/prepare_protocol.c', >-'_sqlite/row.c', >-'_sqlite/statement.c', >-'_sqlite/util.c'] >+ '_sqlite/connection.c', >+ '_sqlite/cursor.c', >+ '_sqlite/microprotocols.c', >+ '_sqlite/module.c', >+ '_sqlite/prepare_protocol.c', >+ '_sqlite/row.c', >+ '_sqlite/statement.c', >+ '_sqlite/util.c' >+] > > major, minor = map(int, platform.python_version_tuple()[:2]) > >@@ -44,13 +42,15 @@ 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, >- include_dirs = inc_dirs, >- libraries = libs, >- library_dirs = lib_dirs, >- runtime_library_dirs = lib_dirs, >- define_macros = macros)] >- ) >+setup( >+ ext_modules=[ >+ Extension( >+ "_sqlite3", >+ sources = sqlite_srcs, >+ include_dirs = inc_dirs, >+ libraries = libs, >+ runtime_library_dirs = lib_dirs, >+ define_macros = macros >+ ) >+ ] >+) >-- >2.44.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 268283
: 249898