MCPcopy Create free account
hub / github.com/nodejs/node / _ConfigWindowsTargetPlatformVersion

Function _ConfigWindowsTargetPlatformVersion

tools/gyp/pylib/gyp/generator/msvs.py:322–358  ·  view source on GitHub ↗
(config_data, version)

Source from the content-addressed store, hash-verified

320
321
322def _ConfigWindowsTargetPlatformVersion(config_data, version):
323 target_ver = config_data.get("msvs_windows_target_platform_version")
324 if target_ver and re.match(r"^\d+", target_ver):
325 return target_ver
326 config_ver = config_data.get("msvs_windows_sdk_version")
327 vers = [config_ver] if config_ver else version.compatible_sdks
328 for ver in vers:
329 for key in [
330 r"HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s",
331 r"HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s",
332 ]:
333 sdk_dir = MSVSVersion._RegistryGetValue(key % ver, "InstallationFolder")
334 if not sdk_dir:
335 continue
336 version = MSVSVersion._RegistryGetValue(key % ver, "ProductVersion") or ""
337 # Find a matching entry in sdk_dir\include.
338 expected_sdk_dir = r"%s\include" % sdk_dir
339 names = sorted(
340 (
341 x
342 for x in (
343 os.listdir(expected_sdk_dir)
344 if os.path.isdir(expected_sdk_dir)
345 else []
346 )
347 if x.startswith(version)
348 ),
349 reverse=True,
350 )
351 if names:
352 return names[0]
353 else:
354 print(
355 "Warning: No include files found for detected "
356 "Windows SDK version %s" % (version),
357 file=sys.stdout,
358 )
359
360
361def _BuildCommandLineForRuleRaw(

Callers 1

Calls 4

sortedFunction · 0.85
getMethod · 0.65
matchMethod · 0.65
printFunction · 0.50

Tested by

no test coverage detected