From cbded6f65312cf3e31bd347f963c11a4e1b2fd39 Mon Sep 17 00:00:00 2001 From: raikoug Date: Sat, 8 Jun 2024 22:38:45 +0200 Subject: [PATCH] Correct - Extend msys search to all possible drives Corrected version - Previously, the code was only checking for the msys installation in the C drive. This commit extends the search to all possible drives on the system. It generates all possible paths by combining each drive letter with each possible path, and then checks each one. This ensures that the msys installation can be found regardless of the drive it's installed on. I proposed a change for a mid file by mistake, this one is working fine with a different drive letter. --- gvsbuild/utils/builder.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gvsbuild/utils/builder.py b/gvsbuild/utils/builder.py index 90368e1f1..9b12340f0 100644 --- a/gvsbuild/utils/builder.py +++ b/gvsbuild/utils/builder.py @@ -32,6 +32,7 @@ from typing import Optional from urllib.error import ContentTooShortError, URLError from urllib.request import urlopen +from string import ascii_uppercase from .base_expanders import dirlist2set, make_zip from .base_project import Project @@ -230,13 +231,12 @@ def __check_tools(self, opts): log.start("Checking msys tool") msys_path = opts.msys_dir if not msys_path or not Path.exists(msys_path): - msys_paths = [ - Path(r"C:\msys64"), - Path(r"C:\msys32"), - Path(r"C:\tools\msys64"), - Path(r"C:\tools\msys32"), - ] - for path in msys_paths: + # list of drive letters to check + possible_drives = ['%s:' % d for d in ascii_uppercase if os.path.exists('%s:' % d)] + possible_paths = [r"\msys64", r"\tools\msys64", r"\msys32", r"\tools\msys32"] + all_possible_paths = [Path(drive + path) for drive in possible_drives for path in possible_paths] + + for path in all_possible_paths: if Path.exists(path): msys_path = path self.opts.msys_dir = str(msys_path)