aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/base.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-01-15 00:14:05 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-01-15 01:45:14 +0530
commit04e275cdcc99095c9a71b1ce0d3d7d3f3124409c (patch)
treed356a5fc4e4f88e5b1b864a46c05557281ea6986 /mesonbuild/dependencies/base.py
parentc7cc7341322f23b8bad801c09328efd32f586387 (diff)
downloadmeson-04e275cdcc99095c9a71b1ce0d3d7d3f3124409c.zip
meson-04e275cdcc99095c9a71b1ce0d3d7d3f3124409c.tar.gz
meson-04e275cdcc99095c9a71b1ce0d3d7d3f3124409c.tar.bz2
find_program: Always use USERPROFILE instead of HOME
On MSYS2 and MSYS, Python reads HOME instead of USERPROFILE, which gets the path wrong. Serves me right for not writing a test!!
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r--mesonbuild/dependencies/base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index d7fa532..d2d115e 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -1817,10 +1817,13 @@ class ExternalProgram:
@staticmethod
@functools.lru_cache(maxsize=None)
def _windows_sanitize_path(path: str) -> str:
+ # Ensure that we use USERPROFILE even when inside MSYS, MSYS2, Cygwin, etc.
+ if 'USERPROFILE' not in os.environ:
+ return path
# Ignore executables in the WindowsApps directory which are
# zero-sized wrappers that magically open the Windows Store to
# install the application.
- appstore_dir = Path.home() / 'AppData' / 'Local' / 'Microsoft' / 'WindowsApps'
+ appstore_dir = Path(os.environ['USERPROFILE']) / 'AppData' / 'Local' / 'Microsoft' / 'WindowsApps'
paths = []
for each in path.split(os.pathsep):
if Path(each) != appstore_dir: