From ea3e83ac29b99654a63262b5899cc730704f72cc Mon Sep 17 00:00:00 2001 From: Kyle Siefring Date: Wed, 12 Jun 2024 15:33:20 -0400 Subject: [PATCH] Fix Visual Studio Version Selection Fix how the version of visual studio is selected. Visual Studio is selected by checking the path for the presence of either the year or the version number. Unfortunately, some version number are present in different editions. This can lead to the wrong installed version being selected. For example, Visual Studio 2022 has a version of 17, so specifying the use of version 17 can result in 2017 being selected instead. --- gvsbuild/utils/builder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gvsbuild/utils/builder.py b/gvsbuild/utils/builder.py index fa8be418c..90368e1f1 100644 --- a/gvsbuild/utils/builder.py +++ b/gvsbuild/utils/builder.py @@ -380,8 +380,11 @@ def __check_good_vs_install(self, opts, vs_path, exit_missing=True): ) def __find_vs_path_with_vs_version(self, paths): + # Don't match version with data (e.g. vs version 17 with vs 2017) + vs_ver_re = re.compile("[^0-9]" + self.opts.vs_ver) + for path in paths: - if self.vs_ver_year[-4:] in path or self.opts.vs_ver in path: + if self.vs_ver_year[-4:] in path or vs_ver_re.search(path): return path log.debug(f"Can't find vs-ver {self.opts.vs_ver} in found VS installations.")