From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 184D915838C for ; Sat, 27 Jan 2024 20:33:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 489DAE2A16; Sat, 27 Jan 2024 20:33:29 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2C70FE2A1A for ; Sat, 27 Jan 2024 20:33:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7767234345C for ; Sat, 27 Jan 2024 20:33:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0A12814D0 for ; Sat, 27 Jan 2024 20:33:25 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1706387599.102c2f5b2beaf5374cf9b510d9adb7abaa21a5b4.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/psycopg/files/, dev-python/psycopg/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/psycopg/files/psycopg-3.1.17-musl.patch dev-python/psycopg/psycopg-3.1.17.ebuild X-VCS-Directories: dev-python/psycopg/files/ dev-python/psycopg/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 102c2f5b2beaf5374cf9b510d9adb7abaa21a5b4 X-VCS-Branch: master Date: Sat, 27 Jan 2024 20:33:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 12db6024-a1d6-4b25-9b9c-8b1f3b07732c X-Archives-Hash: 505bed22f89b79f7949a0b7a16370da1 commit: 102c2f5b2beaf5374cf9b510d9adb7abaa21a5b4 Author: Michał Górny gentoo org> AuthorDate: Sat Jan 27 15:30:51 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Sat Jan 27 20:33:19 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=102c2f5b dev-python/psycopg: Add a patch for musl Closes: https://bugs.gentoo.org/923003 Signed-off-by: Michał Górny gentoo.org> dev-python/psycopg/files/psycopg-3.1.17-musl.patch | 34 ++++++++++++++++++++++ dev-python/psycopg/psycopg-3.1.17.ebuild | 5 ++++ 2 files changed, 39 insertions(+) diff --git a/dev-python/psycopg/files/psycopg-3.1.17-musl.patch b/dev-python/psycopg/files/psycopg-3.1.17-musl.patch new file mode 100644 index 000000000000..ca1689931ed8 --- /dev/null +++ b/dev-python/psycopg/files/psycopg-3.1.17-musl.patch @@ -0,0 +1,34 @@ +From eeb662bf89e9ffdb3e6fc40eb30d0b53e0b4bece Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 27 Jan 2024 15:28:34 +0100 +Subject: [PATCH] fix: add `libc.so` fallback for musl systems to the ctypes + impl + +Add a fallback to `libc.so` library name to fix loading the ctypes +implementation on musl systems. On musl, `find_library("c")` does +not work (the problem has been reported to CPython in 2014, and has not +been resolved yet), causing the module to fail on `assert libcname`. +Instead, add a fallback to using `libc.so` and let ctypes raise +an exception if such a library does not exist. +--- + psycopg/psycopg/pq/_pq_ctypes.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/psycopg/psycopg/pq/_pq_ctypes.py b/psycopg/psycopg/pq/_pq_ctypes.py +index 9d4dd181..3ecff080 100644 +--- a/psycopg/psycopg/pq/_pq_ctypes.py ++++ b/psycopg/psycopg/pq/_pq_ctypes.py +@@ -28,8 +28,8 @@ class FILE(Structure): + FILE_ptr = POINTER(FILE) + + if sys.platform == "linux": +- libcname = ctypes.util.find_library("c") +- assert libcname ++ # find_library("c") does not work on musl, fall back to libc.so instead ++ libcname = ctypes.util.find_library("c") or "libc.so" + libc = ctypes.cdll.LoadLibrary(libcname) + + fdopen = libc.fdopen +-- +2.43.0 + diff --git a/dev-python/psycopg/psycopg-3.1.17.ebuild b/dev-python/psycopg/psycopg-3.1.17.ebuild index 70302101bce9..df2def1f51f9 100644 --- a/dev-python/psycopg/psycopg-3.1.17.ebuild +++ b/dev-python/psycopg/psycopg-3.1.17.ebuild @@ -51,6 +51,11 @@ BDEPEND=" distutils_enable_tests pytest +PATCHES=( + # https://github.com/psycopg/psycopg/pull/725 + "${FILESDIR}/${P}-musl.patch" +) + python_compile() { # Python code + ctypes backend cd psycopg || die