From 84fd982f4bfb32375247066f6cc883917b3da807 Mon Sep 17 00:00:00 2001 From: James Harris Date: Tue, 26 Feb 2019 17:26:32 +0000 Subject: [PATCH] Utils: only use msys2 paths from msys2 python This patch attempts to detects if, when we are running from within an MSYS2 environement (MSYSTEM is set) we are also executing inside an MSYS2 provided version of python. It does this by assuming that if we are not in a cygwin environment and we are building on windows, If the value of sys.executable is /usr/bin or /bin or /usr/local/bin (somethign unixy) then we are running in an MSYS2 python interpreter and shoudl compensate for msys2 root paths. Otherwise we shouldn't be doing extra path manipulation. --- waflib/Utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/waflib/Utils.py b/waflib/Utils.py index b84de64b..4b808a85 100644 --- a/waflib/Utils.py +++ b/waflib/Utils.py @@ -490,7 +490,9 @@ def split_path_msys(path): if sys.platform == 'cygwin': split_path = split_path_cygwin elif is_win32: - if os.environ.get('MSYSTEM'): + # Consider this an MSYSTEM environment if $MSYSTEM is set and python + # reports is executable from a unix like path on a windows host. + if os.environ.get('MSYSTEM') and sys.executable.startswith('/'): split_path = split_path_msys else: split_path = split_path_win32