Skip to content

Commit 34522d1

Browse files
committed
use regex to find all valid sdk versions instead of just 10.0 versions
1 parent 864f207 commit 34522d1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
# TLS_PARAMETERS. These are required to build Windows Binaries with TLS 1.3 support.
3333
WINDOWS_SDK_MIN_VERSION_TLS1_3_SUPPORT = "10.0.17763.0"
3434

35+
# Regex to match a Windows SDK version directory name in the format of major.minor.build.revision
36+
SDK_VERSION_RE = re.compile(r'^(\d+)\.(\d+)\.(\d+)\.(\d+)$')
37+
3538

3639
def parse_version(version_string):
3740
return tuple(int(x) for x in version_string.split("."))
@@ -123,8 +126,8 @@ def get_windows_sdk_versions():
123126
if os.path.exists(sdk_path):
124127
try:
125128
for entry in os.listdir(sdk_path):
126-
# SDK version directories look like "10.0.17763.0"
127-
if entry.startswith('10.0.') and os.path.isdir(os.path.join(sdk_path, entry)):
129+
# SDK version directories look like "major.minor.build.revision" (e.g. "10.0.17763.0")
130+
if SDK_VERSION_RE.match(entry) and os.path.isdir(os.path.join(sdk_path, entry)):
128131
if entry not in sdk_versions:
129132
sdk_versions.append(entry)
130133
except OSError:

0 commit comments

Comments
 (0)