diff --git a/databases/py-psycopg-c/Makefile b/databases/py-psycopg-c/Makefile index 30888cee0fc6..c5a8c7beeb17 100644 --- a/databases/py-psycopg-c/Makefile +++ b/databases/py-psycopg-c/Makefile @@ -1,26 +1,26 @@ PORTNAME= psycopg-c -PORTVERSION= 3.2.13 +PORTVERSION= 3.3.4 CATEGORIES= databases python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} DISTNAME= psycopg_c-${PORTVERSION} MAINTAINER= sunpoet@FreeBSD.org COMMENT= PostgreSQL database adapter for Python - C optimization distribution WWW= https://www.psycopg.org/psycopg3/ \ https://github.com/psycopg/psycopg/tree/master/psycopg_c LICENSE= LGPL3 LICENSE_FILE= ${WRKSRC}/LICENSE.txt -BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>=49.2.0:devel/py-setuptools@${PY_FLAVOR} \ +BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>=61:devel/py-setuptools@${PY_FLAVOR} \ ${PY_TOMLI} \ ${PYTHON_PKGNAMEPREFIX}wheel>=0.37:devel/py-wheel@${PY_FLAVOR} USES= pgsql python USE_PYTHON= autoplist concurrent cython pep517 post-install: ${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' -exec ${STRIP_CMD} {} + .include diff --git a/databases/py-psycopg-c/distinfo b/databases/py-psycopg-c/distinfo index dd8e114e8978..653eb5ab6ea6 100644 --- a/databases/py-psycopg-c/distinfo +++ b/databases/py-psycopg-c/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1763853252 -SHA256 (psycopg_c-3.2.13.tar.gz) = 3f8d69a563f198198aaf3333e3830c68368a4e45cd60faeabca9949f958f6480 -SIZE (psycopg_c-3.2.13.tar.gz) = 624372 +TIMESTAMP = 1783564020 +SHA256 (psycopg_c-3.3.4.tar.gz) = ed8106128b2d04359c185fc9641b4409abfce4d0b6fb1d1ff6800646e27f1a22 +SIZE (psycopg_c-3.3.4.tar.gz) = 647111 diff --git a/databases/py-psycopg-c/files/patch-pyproject.toml b/databases/py-psycopg-c/files/patch-pyproject.toml new file mode 100644 index 000000000000..07f9ae701331 --- /dev/null +++ b/databases/py-psycopg-c/files/patch-pyproject.toml @@ -0,0 +1,38 @@ +--- pyproject.toml.orig 2026-05-01 20:43:36 UTC ++++ pyproject.toml +@@ -5,7 +5,7 @@ requires = [ + # `[tool.setuptools.ext-modules]` in `pyproject.toml` is still + # *experimental* and likely to change in future releases + # +- "setuptools == 80.3.1", ++ "setuptools >= 61", + "wheel >= 0.37", + "tomli >= 2.0.1; python_version < '3.11'", + ] +@@ -25,8 +25,7 @@ version = "3.3.4" + name = "psycopg-c" + description = "PostgreSQL database adapter for Python -- C optimisation distribution" + version = "3.3.4" +-license = "LGPL-3.0-only" +-license-files = ["LICENSE.txt"] ++license = {text = "LGPL-3.0-only"} + classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", +@@ -89,16 +88,6 @@ psycopg_binary = [ + "py.typed", + "*.pyi", + ] +- +-# Note: these ext modules lack details such as libraries and directories. +-# They are added by the 'psycopg_build_ext' build module. +-[[tool.setuptools.ext-modules]] +-name = "psycopg_c._psycopg" +-sources = ["psycopg_c/_psycopg.c", "psycopg_c/types/numutils.c"] +- +-[[tool.setuptools.ext-modules]] +-name = "psycopg_c.pq" +-sources = ["psycopg_c/pq.c"] + + [tool.setuptools.cmdclass] + build_ext = "psycopg_build_ext.psycopg_build_ext" diff --git a/databases/py-psycopg-c/files/patch-setup.py b/databases/py-psycopg-c/files/patch-setup.py new file mode 100644 index 000000000000..bea888ebdc3d --- /dev/null +++ b/databases/py-psycopg-c/files/patch-setup.py @@ -0,0 +1,104 @@ +--- setup.py.orig 2026-07-11 02:53:43 UTC ++++ setup.py +@@ -0,0 +1,101 @@ ++#!/usr/bin/env python3 ++""" ++PostgreSQL database adapter for Python - optimisation package ++""" ++ ++# Copyright (C) 2020 The Psycopg Team ++ ++import os ++import sys ++import subprocess as sp ++from distutils import log ++from distutils.command.build_ext import build_ext ++ ++from setuptools import Extension, setup ++ ++# Move to the directory of setup.py: executing this file from another location ++# (e.g. from the project root) will fail ++here = os.path.abspath(os.path.dirname(__file__)) ++if os.path.abspath(os.getcwd()) != here: ++ os.chdir(here) ++ ++ ++def get_config(what: str) -> str: ++ pg_config = "pg_config" ++ try: ++ out = sp.run([pg_config, f"--{what}"], stdout=sp.PIPE, check=True) ++ except Exception as e: ++ log.error(f"couldn't run {pg_config!r} --{what}: %s", e) ++ raise ++ else: ++ return out.stdout.strip().decode() ++ ++ ++class psycopg_build_ext(build_ext): ++ def finalize_options(self) -> None: ++ self._setup_ext_build() ++ super().finalize_options() ++ ++ def _setup_ext_build(self) -> None: ++ cythonize = None ++ ++ # In the sdist there are not .pyx, only c, so we don't need Cython. ++ # Otherwise Cython is a requirement and it is used to compile pyx to c. ++ if os.path.exists("psycopg_c/_psycopg.pyx"): ++ from Cython.Build import cythonize # type: ignore ++ ++ # Add include and lib dir for the libpq. ++ includedir = get_config("includedir") ++ libdir = get_config("libdir") ++ for ext in self.distribution.ext_modules: ++ ext.include_dirs.append(includedir) ++ ext.library_dirs.append(libdir) ++ ++ if sys.platform == "win32": ++ # For __imp_htons and others ++ ext.libraries.append("ws2_32") ++ ++ if cythonize is not None: ++ for ext in self.distribution.ext_modules: ++ for i in range(len(ext.sources)): ++ base, fext = os.path.splitext(ext.sources[i]) ++ if fext == ".c" and os.path.exists(base + ".pyx"): ++ ext.sources[i] = base + ".pyx" ++ ++ self.distribution.ext_modules = cythonize( ++ self.distribution.ext_modules, ++ language_level=3, ++ compiler_directives={ ++ "always_allow_keywords": False, ++ }, ++ annotate=False, # enable to get an html view of the C module ++ ) ++ else: ++ self.distribution.ext_modules = [pgext, pqext] ++ ++ ++# MSVC requires an explicit "libpq" ++libpq = "pq" if sys.platform != "win32" else "libpq" ++ ++# Some details missing, to be finished by psycopg_build_ext.finalize_options ++pgext = Extension( ++ "psycopg_c._psycopg", ++ [ ++ "psycopg_c/_psycopg.c", ++ "psycopg_c/types/numutils.c", ++ ], ++ libraries=[libpq], ++ include_dirs=[], ++) ++ ++pqext = Extension( ++ "psycopg_c.pq", ++ ["psycopg_c/pq.c"], ++ libraries=[libpq], ++ include_dirs=[], ++) ++ ++setup( ++ ext_modules=[pgext, pqext], ++ cmdclass={"build_ext": psycopg_build_ext}, # type: ignore ++)