diff options
-rw-r--r-- | gn/BUILDCONFIG.gn | 10 | ||||
-rw-r--r-- | gn/highest_version_dir.py | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn index 80cc0986cc..0e93f0a6b6 100644 --- a/gn/BUILDCONFIG.gn +++ b/gn/BUILDCONFIG.gn @@ -164,12 +164,18 @@ if (target_os == "win") { if (target_os == "win") { if (msvc == 2017 && win_toolchain_version == "") { win_toolchain_version = exec_script("//gn/highest_version_dir.py", - [ "$win_vc/Tools/MSVC" ], + [ + "$win_vc/Tools/MSVC", + "[0-9]{2}\.[0-9]{2}\.[0-9]{5}", + ], "trim string") } if (win_sdk_version == "") { win_sdk_version = exec_script("//gn/highest_version_dir.py", - [ "$win_sdk/Include" ], + [ + "$win_sdk/Include", + "[0-9]{2}\.[0-9]\.[0-9]{5}\.[0-9]", + ], "trim string") } } diff --git a/gn/highest_version_dir.py b/gn/highest_version_dir.py index 650154e4f3..1b82697d9a 100644 --- a/gn/highest_version_dir.py +++ b/gn/highest_version_dir.py @@ -6,8 +6,10 @@ # found in the LICENSE file. import os +import re import sys -dirpath, = sys.argv[1:] +dirpath = sys.argv[1] +regex = re.compile(sys.argv[2]) -print sorted(os.listdir(dirpath))[-1] +print sorted(filter(regex.match, os.listdir(dirpath)))[-1] |