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

Function query_vcvarsall

Tools/c-analyzer/distutils/msvc9compiler.py:250–288  ·  view source on GitHub ↗

Launch vcvarsall.bat and read the settings from its environment

(version, arch="x86")

Source from the content-addressed store, hash-verified

248 return None
249
250def query_vcvarsall(version, arch="x86"):
251 """Launch vcvarsall.bat and read the settings from its environment
252 """
253 vcvarsall = find_vcvarsall(version)
254 interesting = {"include", "lib", "libpath", "path"}
255 result = {}
256
257 if vcvarsall is None:
258 raise DistutilsPlatformError("Unable to find vcvarsall.bat")
259 log.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version)
260 popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch),
261 stdout=subprocess.PIPE,
262 stderr=subprocess.PIPE)
263 try:
264 stdout, stderr = popen.communicate()
265 if popen.wait() != 0:
266 raise DistutilsPlatformError(stderr.decode("mbcs"))
267
268 stdout = stdout.decode("mbcs")
269 for line in stdout.split("\n"):
270 line = Reg.convert_mbcs(line)
271 if '=' not in line:
272 continue
273 line = line.strip()
274 key, value = line.split('=', 1)
275 key = key.lower()
276 if key in interesting:
277 if value.endswith(os.pathsep):
278 value = value[:-1]
279 result[key] = removeDuplicates(value)
280
281 finally:
282 popen.stdout.close()
283 popen.stderr.close()
284
285 if len(result) != len(interesting):
286 raise ValueError(str(list(result.keys())))
287
288 return result
289
290# More globals
291VERSION = get_build_version()

Callers

nothing calls this directly

Calls 15

communicateMethod · 0.95
waitMethod · 0.95
find_vcvarsallFunction · 0.85
removeDuplicatesFunction · 0.85
strFunction · 0.85
listClass · 0.85
convert_mbcsMethod · 0.80
debugMethod · 0.45
decodeMethod · 0.45
splitMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…