MCPcopy Index your code
hub / github.com/python/cpython / _find_vc2015

Function _find_vc2015

Tools/c-analyzer/distutils/_msvccompiler.py:26–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24from itertools import count
25
26def _find_vc2015():
27 try:
28 key = winreg.OpenKeyEx(
29 winreg.HKEY_LOCAL_MACHINE,
30 r"Software\Microsoft\VisualStudio\SxS\VC7",
31 access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY
32 )
33 except OSError:
34 log.debug("Visual C++ is not registered")
35 return None, None
36
37 best_version = 0
38 best_dir = None
39 with key:
40 for i in count():
41 try:
42 v, vc_dir, vt = winreg.EnumValue(key, i)
43 except OSError:
44 break
45 if v and vt == winreg.REG_SZ and os.path.isdir(vc_dir):
46 try:
47 version = int(float(v))
48 except (ValueError, TypeError):
49 continue
50 if version >= 14 and version > best_version:
51 best_version, best_dir = version, vc_dir
52 return best_version, best_dir
53
54def _find_vc2017():
55 """Returns "15, path" based on the result of invoking vswhere.exe

Callers 1

_find_vcvarsallFunction · 0.85

Calls 4

countFunction · 0.85
OpenKeyExMethod · 0.80
debugMethod · 0.45
isdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…