Skip to content

Commit

Permalink
vsenv: check the version of vswhere and raise an error if it is too old
Browse files Browse the repository at this point in the history
Per mesonbuild#10799 at least 3.0.2 is needed for the -utf8 option to both exist
and work.
  • Loading branch information
eli-schwartz committed Jan 2, 2024
1 parent 6fe9d43 commit 9034424
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mesonbuild/utils/vsenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from .. import mlog
from .core import MesonException
from .universal import is_windows, windows_detect_native_arch
from .universal import is_windows, search_version, version_compare, windows_detect_native_arch


__all__ = [
Expand Down Expand Up @@ -56,6 +56,10 @@ def _setup_vsenv(force: bool) -> bool:
bat_locator_bin = pathlib.Path(root, 'Microsoft Visual Studio/Installer/vswhere.exe')
if not bat_locator_bin.exists():
raise MesonException(f'Could not find {bat_locator_bin}')
ver = search_version(subprocess.check_output(str(bat_locator_bin), text=True))
if not version_compare(ver, '>=3.0.2'):
raise MesonException(f'{bat_locator_bin} is too old. Found {ver} but need: 3.0.2')

bat_json = subprocess.check_output(
[
str(bat_locator_bin),
Expand Down

0 comments on commit 9034424

Please sign in to comment.