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

Function _get_vc_env

Tools/c-analyzer/distutils/_msvccompiler.py:111–139  ·  view source on GitHub ↗
(plat_spec)

Source from the content-addressed store, hash-verified

109 return vcvarsall, None
110
111def _get_vc_env(plat_spec):
112 if os.getenv("DISTUTILS_USE_SDK"):
113 return {
114 key.lower(): value
115 for key, value in os.environ.items()
116 }
117
118 vcvarsall, _ = _find_vcvarsall(plat_spec)
119 if not vcvarsall:
120 raise DistutilsPlatformError("Unable to find vcvarsall.bat")
121
122 try:
123 out = subprocess.check_output(
124 'cmd /u /c "{}" {} && set'.format(vcvarsall, plat_spec),
125 stderr=subprocess.STDOUT,
126 ).decode('utf-16le', errors='replace')
127 except subprocess.CalledProcessError as exc:
128 log.error(exc.output)
129 raise DistutilsPlatformError("Error executing {}"
130 .format(exc.cmd))
131
132 env = {
133 key.lower(): value
134 for key, _, value in
135 (line.partition('=') for line in out.splitlines())
136 if key and value
137 }
138
139 return env
140
141def _find_exe(exe, paths=None):
142 """Return path to an MSVC executable program.

Callers

nothing calls this directly

Calls 10

_find_vcvarsallFunction · 0.85
lowerMethod · 0.45
itemsMethod · 0.45
decodeMethod · 0.45
check_outputMethod · 0.45
formatMethod · 0.45
errorMethod · 0.45
partitionMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…