From 8418abc4ff965b55d043237b388879b84d6ab0a5 Mon Sep 17 00:00:00 2001 From: Skye Date: Fri, 30 Jan 2026 13:35:42 +0900 Subject: [PATCH] support GraalPy --- copyparty/__init__.py | 2 ++ copyparty/stolen/ifaddr/__init__.py | 3 ++- copyparty/util.py | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/copyparty/__init__.py b/copyparty/__init__.py index afb05d18..224ace69 100644 --- a/copyparty/__init__.py +++ b/copyparty/__init__.py @@ -46,6 +46,8 @@ MACOS = platform.system() == "Darwin" EXE = bool(getattr(sys, "frozen", False)) +GRAAL = platform.python_implementation() == "GraalVM" + try: CORES = len(os.sched_getaffinity(0)) except: diff --git a/copyparty/stolen/ifaddr/__init__.py b/copyparty/stolen/ifaddr/__init__.py index 5e8b7827..c5731c0d 100644 --- a/copyparty/stolen/ifaddr/__init__.py +++ b/copyparty/stolen/ifaddr/__init__.py @@ -8,6 +8,7 @@ https://github.com/pydron/ifaddr/tree/0.2.0 """ import os +import platform from ._shared import IP, Adapter @@ -22,7 +23,7 @@ except: S390X = False -if os.environ.get("PRTY_NO_IFADDR") or S390X: +if os.environ.get("PRTY_NO_IFADDR") or S390X or platform.python_implementation() == "GraalVM": # s390x deadlocks at libc.getifaddrs get_adapters = nope elif os.name == "nt": diff --git a/copyparty/util.py b/copyparty/util.py index 1b9b5431..c153252a 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -45,6 +45,7 @@ except: from .__init__ import ( ANYWIN, EXE, + GRAAL, MACOS, PY2, PY36, @@ -779,7 +780,7 @@ class Daemon(threading.Thread): self.start() def run(self): - if not ANYWIN and not PY2: + if not ANYWIN and not PY2 and not GRAAL: signal.pthread_sigmask( signal.SIG_BLOCK, [signal.SIGINT, signal.SIGTERM, signal.SIGUSR1] ) @@ -1656,7 +1657,7 @@ def log_thrs(log: Callable[[str, str, int], None], ival: float, name: str) -> No def sigblock(): - if ANYWIN or PY2: + if ANYWIN or PY2 or GRAAL: return signal.pthread_sigmask(