From 41e86feebb22074cdf5d9cc9c3825be2d1a292fa Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 23 Sep 2025 13:33:43 +0100 Subject: [PATCH] Downstream patch: always find the system-wide ty executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following issue is for uv, but the situation is exactly the same. “Should uv.find_uv_bin() be able to find /usr/bin/uv?” https://github.com/astral-sh/uv/issues/4451 --- python/ty/__main__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/ty/__main__.py b/python/ty/__main__.py index 47c44e3..26e46e8 100644 --- a/python/ty/__main__.py +++ b/python/ty/__main__.py @@ -10,6 +10,16 @@ def find_ty_bin() -> str: ty_exe = "ty" + sysconfig.get_config_var("EXE") + # Downstream patch: always find the system-wide ty executable + # + # The following issue is for uv, but the situation is exactly the same. + # + # “Should uv.find_uv_bin() be able to find /usr/bin/uv?” + # https://github.com/astral-sh/uv/issues/4451 + bindir_path = os.path.join(sysconfig.get_config_var("BINDIR"), ty_exe) + if os.path.isfile(bindir_path): + return bindir_path + scripts_path = os.path.join(sysconfig.get_path("scripts"), ty_exe) if os.path.isfile(scripts_path): return scripts_path -- 2.52.0