Loading pkgs/development/python-modules/psycopg/ctypes.patch +9 −11 Original line number Diff line number Diff line diff --git a/psycopg/psycopg/pq/_pq_ctypes.py b/psycopg/psycopg/pq/_pq_ctypes.py index f3a7b143..1bf935fb 100644 index 99e49357..3827d6dd 100644 --- a/psycopg/psycopg/pq/_pq_ctypes.py +++ b/psycopg/psycopg/pq/_pq_ctypes.py @@ -13,14 +13,11 @@ from ctypes import Structure, CFUNCTYPE, POINTER from ctypes import c_char, c_char_p, c_int, c_size_t, c_ubyte, c_uint, c_void_p @@ -13,13 +13,10 @@ from ctypes import CFUNCTYPE, POINTER, Structure, c_char, c_char_p, c_int, c_siz from ctypes import c_ubyte, c_uint, c_void_p from typing import Any, NoReturn -from .misc import find_libpq_full_path, version_pretty +from .misc import version_pretty from ..errors import NotSupportedError -libname = find_libpq_full_path() -if not libname: -if not (libname := find_libpq_full_path()): - raise ImportError("libpq library not found") - -pq = ctypes.cdll.LoadLibrary(libname) +pq = ctypes.cdll.LoadLibrary("@libpq@") class FILE(Structure): @@ -30,12 +27,7 @@ class FILE(Structure): @@ -29,11 +26,7 @@ class FILE(Structure): FILE_ptr = POINTER(FILE) if sys.platform == "linux": - libcname = ctypes.util.find_library("c") - if not libcname: - if not (libcname := ctypes.util.find_library("c")): - # Likely this is a system using musl libc, see the following bug: - # https://github.com/python/cpython/issues/65821 - libcname = "libc.so" Loading @@ -34,10 +32,10 @@ index f3a7b143..1bf935fb 100644 fdopen = libc.fdopen fdopen.argtypes = (c_int, c_char_p) diff --git a/tests/fix_pq.py b/tests/fix_pq.py index 1cff7e18..218d90a0 100644 index 8d7e9ae6..074be456 100644 --- a/tests/fix_pq.py +++ b/tests/fix_pq.py @@ -49,18 +49,7 @@ def pytest_runtest_setup(item): @@ -50,18 +50,7 @@ def pytest_runtest_setup(item): @pytest.fixture def libpq(): """Return a ctypes wrapper to access the libpq.""" Loading pkgs/development/python-modules/psycopg/default.nix +2 −2 Original line number Diff line number Diff line Loading @@ -35,13 +35,13 @@ let pname = "psycopg"; version = "3.2.6"; version = "3.2.7"; src = fetchFromGitHub { owner = "psycopg"; repo = "psycopg"; tag = version; hash = "sha256-fCiTu6lKFqY7Yl9KfmhRZQIDg5sEkXkQ95kPfIDSGn8="; hash = "sha256-v4R+5jgC4dTrL+i6O+UCCr7+g673hKi9YmrSeROLpZs="; }; patches = [ Loading Loading
pkgs/development/python-modules/psycopg/ctypes.patch +9 −11 Original line number Diff line number Diff line diff --git a/psycopg/psycopg/pq/_pq_ctypes.py b/psycopg/psycopg/pq/_pq_ctypes.py index f3a7b143..1bf935fb 100644 index 99e49357..3827d6dd 100644 --- a/psycopg/psycopg/pq/_pq_ctypes.py +++ b/psycopg/psycopg/pq/_pq_ctypes.py @@ -13,14 +13,11 @@ from ctypes import Structure, CFUNCTYPE, POINTER from ctypes import c_char, c_char_p, c_int, c_size_t, c_ubyte, c_uint, c_void_p @@ -13,13 +13,10 @@ from ctypes import CFUNCTYPE, POINTER, Structure, c_char, c_char_p, c_int, c_siz from ctypes import c_ubyte, c_uint, c_void_p from typing import Any, NoReturn -from .misc import find_libpq_full_path, version_pretty +from .misc import version_pretty from ..errors import NotSupportedError -libname = find_libpq_full_path() -if not libname: -if not (libname := find_libpq_full_path()): - raise ImportError("libpq library not found") - -pq = ctypes.cdll.LoadLibrary(libname) +pq = ctypes.cdll.LoadLibrary("@libpq@") class FILE(Structure): @@ -30,12 +27,7 @@ class FILE(Structure): @@ -29,11 +26,7 @@ class FILE(Structure): FILE_ptr = POINTER(FILE) if sys.platform == "linux": - libcname = ctypes.util.find_library("c") - if not libcname: - if not (libcname := ctypes.util.find_library("c")): - # Likely this is a system using musl libc, see the following bug: - # https://github.com/python/cpython/issues/65821 - libcname = "libc.so" Loading @@ -34,10 +32,10 @@ index f3a7b143..1bf935fb 100644 fdopen = libc.fdopen fdopen.argtypes = (c_int, c_char_p) diff --git a/tests/fix_pq.py b/tests/fix_pq.py index 1cff7e18..218d90a0 100644 index 8d7e9ae6..074be456 100644 --- a/tests/fix_pq.py +++ b/tests/fix_pq.py @@ -49,18 +49,7 @@ def pytest_runtest_setup(item): @@ -50,18 +50,7 @@ def pytest_runtest_setup(item): @pytest.fixture def libpq(): """Return a ctypes wrapper to access the libpq.""" Loading
pkgs/development/python-modules/psycopg/default.nix +2 −2 Original line number Diff line number Diff line Loading @@ -35,13 +35,13 @@ let pname = "psycopg"; version = "3.2.6"; version = "3.2.7"; src = fetchFromGitHub { owner = "psycopg"; repo = "psycopg"; tag = version; hash = "sha256-fCiTu6lKFqY7Yl9KfmhRZQIDg5sEkXkQ95kPfIDSGn8="; hash = "sha256-v4R+5jgC4dTrL+i6O+UCCr7+g673hKi9YmrSeROLpZs="; }; patches = [ Loading