summaryrefslogtreecommitdiff
path: root/dev-python/trio
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-01-30 17:49:05 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-01-30 17:49:05 +0000
commit28d8acbb30a9ebda81447e5e3f5210a438ba7d24 (patch)
tree6d6b6b0a1aca19e8118845870c9e6a25bad27963 /dev-python/trio
parent840a65e2af3f2cc7527e723a28f6e627a9592fb7 (diff)
gentoo auto-resync : 30:01:2024 - 17:49:05
Diffstat (limited to 'dev-python/trio')
-rw-r--r--dev-python/trio/Manifest3
-rw-r--r--dev-python/trio/files/trio-0.24.0-musl.patch66
-rw-r--r--dev-python/trio/trio-0.24.0.ebuild5
3 files changed, 73 insertions, 1 deletions
diff --git a/dev-python/trio/Manifest b/dev-python/trio/Manifest
index 654262cb5df0..c30d17264925 100644
--- a/dev-python/trio/Manifest
+++ b/dev-python/trio/Manifest
@@ -1,3 +1,4 @@
+AUX trio-0.24.0-musl.patch 2793 BLAKE2B 2e15fa8703361e0bc55f1fa067e2f35e24a778f6e34ae0cc2c08a05c15bd385f70a5e5d485a5252caf5cdbae37223fd48bea035debb6140eda945257d6565278 SHA512 1cd8133ba0d7c80e7277c445f39329139abe8740905e43c531fd86b1a100d1e75bdf038c8f2189e3a310ed8692e826ab5745133ea70b638bc6ddc4f659b0a71c
DIST trio-0.24.0.gh.tar.gz 592652 BLAKE2B c102c6b6e25b497a5823b58b926f43d06905a8aaa41434d9503c127cb1b26a3c58594edc90e48e9acea6e6ffbc36a2d02a9f1805b14ba65a77ffedcbb8cf48f8 SHA512 3f52e770a19c45b5227ffd34e7ae4664ee739dbae81c09e1e4bf2bd3eddb414ff9ab32dd2b18d59e420a18660a2f7db7ad2cda9f725729dda7e99f7a89b66bbc
-EBUILD trio-0.24.0.ebuild 1742 BLAKE2B 44eaea489cca8184c041c9eb568cc29dad7de6d5617d7ff50fffb45fb7309249de17e7b1249ee036403d5778b7167444dac13d87ad5953140c4e02dd91054c8a SHA512 681655c74d20f5370dd5feffc8fb9bee22795b1f2600d57d12b63a5819e0d285c7eeccd953bef3d894319a8672420fb219e052ab13f5c05c564a107704773061
+EBUILD trio-0.24.0.ebuild 1835 BLAKE2B 47252081fe8446c918645f740ce8df83beb9368d1ffd43b124130ea8e4c68e5309c41c3062a5118c3129b10f43f9e99fc3c3d4b26cb71532b991163dfec58eba SHA512 d6a3f9c691f7d5df4fad53ed451a533b2fad670576e2f415ada22f716e29307e454ffc50aa8ea1fef47362c7196f6acdd9807c5cf9cb021194097c0f214aeb5d
MISC metadata.xml 2060 BLAKE2B bb6ddfddfb3c19038e5982227a8c5f9999b93868c343a9a5bf7af5963006b5b719ef960f65b91747dfddf19544134db9e1a2d65e94192c079c64c303cdc8997a SHA512 4b86e7cccddc200d5616550e309ad46587f900ed13c38196e874e5110974b856d65e18745b8b7b42858cb672940ba280b0c2ea54d33f9b5bf32a375fa1232088
diff --git a/dev-python/trio/files/trio-0.24.0-musl.patch b/dev-python/trio/files/trio-0.24.0-musl.patch
new file mode 100644
index 000000000000..b5b692bf6e0c
--- /dev/null
+++ b/dev-python/trio/files/trio-0.24.0-musl.patch
@@ -0,0 +1,66 @@
+From c8c19570aa9e46b67d44228241e7401af96cbccd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 29 Jan 2024 17:48:40 +0100
+Subject: [PATCH] Fix finding pthread_*name_np on vanilla musl libc
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix the `pthread_getname_np` and `pthread_setname_np` search logic
+to support vanilla versions of musl and CPython, e.g. as used on Gentoo
+musl systems. On such systems, there is no "libpthread.so" (there is
+only a static library) and the relevant functions are found
+in "libc.so". Additionally, `ctypes.util.find_library("c")` does not
+work because of an old unsolved bug in CPython (linked in the code).
+
+To resolve the problem, add a fallback to trying `libc.so` if no pthread
+library can be found. This roughly covers three possibilities:
+
+- a "typical" system with `libpthread.so` will find that library
+ and use it
+
+- a musl system will fall back to `libc.so`, load that library and find
+ pthread functions there
+
+- any other system will try to load `libc.so`, and fail
+
+The code in `get_os_thread_name_func()` remains fully relaxed, allowing
+either CDLL construction (i.e. finding the library) to fail,
+or the library not to contain `pthread_setname_np`.
+
+The code in `test_threads.py` was made more relaxed — rather than
+skipping if `libpthread.so` does not exist, it tries to load `libc.so`
+as a fallback, and skips if that fails.
+
+Originally reported as https://bugs.gentoo.org/923257.
+---
+ newsfragments/2939.bugfix.rst | 1 +
+ src/trio/_core/_thread_cache.py | 9 +++++++--
+ src/trio/_tests/test_threads.py | 12 ++++++++++--
+ 3 files changed, 18 insertions(+), 4 deletions(-)
+ create mode 100644 newsfragments/2939.bugfix.rst
+
+diff --git a/src/trio/_tests/test_threads.py b/src/trio/_tests/test_threads.py
+index aefb4ba27..326cffd6b 100644
+--- a/src/trio/_tests/test_threads.py
++++ b/src/trio/_tests/test_threads.py
+@@ -237,9 +237,17 @@ def _get_thread_name(ident: int | None = None) -> str | None:
+
+ libpthread_path = ctypes.util.find_library("pthread")
+ if not libpthread_path:
+- print(f"no pthread on {sys.platform})")
++ # musl includes pthread functions directly in libc.so
++ # (but note that find_library("c") does not work on musl,
++ # see: https://github.com/python/cpython/issues/65821)
++ # so try that library instead
++ # if it doesn't exist, CDLL() will fail below
++ libpthread_path = "libc.so"
++ try:
++ libpthread = ctypes.CDLL(libpthread_path)
++ except Exception:
++ print(f"no pthread on {sys.platform}")
+ return None
+- libpthread = ctypes.CDLL(libpthread_path)
+
+ pthread_getname_np = getattr(libpthread, "pthread_getname_np", None)
+
diff --git a/dev-python/trio/trio-0.24.0.ebuild b/dev-python/trio/trio-0.24.0.ebuild
index 4ad16f8afab3..731ec9713527 100644
--- a/dev-python/trio/trio-0.24.0.ebuild
+++ b/dev-python/trio/trio-0.24.0.ebuild
@@ -49,6 +49,11 @@ distutils_enable_tests pytest
# dev-python/sphinx-rtd-theme \
# dev-python/towncrier
+PATCHES=(
+ # https://github.com/python-trio/trio/pull/2939
+ "${FILESDIR}/${P}-musl.patch"
+)
+
python_test() {
local EPYTEST_DESELECT=(
# Times out on slower arches (ia64 in this case)