From dd3292a5a2a9c5464b609430f7f95d5592e1ca82 Mon Sep 17 00:00:00 2001 From: Timothee 'TTimo' Besset <ttimo@ttimo.net> Date: Thu, 2 Nov 2023 19:49:49 -0500 Subject: [PATCH] fix the new cygwin tools lookup, we don't want to pickup non-cygwin rsync.exe or ssh.exe that may happen to be in the path --- client/devkit_client/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/devkit_client/__init__.py b/client/devkit_client/__init__.py index 670e02a..eeab25f 100644 --- a/client/devkit_client/__init__.py +++ b/client/devkit_client/__init__.py @@ -242,10 +242,13 @@ def _locate_external_tool(name): ret = os.path.join(r'C:\cygwin64\bin', name) if os.path.exists(ret): return ret - # Look for the first thing in PATH, that would be the 'preferred' cygwin install if that's setup - ret = shutil.which(name) + # Look for cygpath.exe in system PATH, that would be the 'preferred' cygwin install if that's setup + # (don't look for 'name' e.g. ssh.exe lest you find Windows SSH which is not what we're looking for here) + ret = shutil.which('cygpath.exe') if ret is not None: - return ret + ret = os.path.join(os.path.dirname(ret), name) + if os.path.exists(ret): + return ret # Go poke at the registry then CYGWIN_KEY = "SOFTWARE\\Cygwin\\setup" for hk in (winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER): -- GitLab