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

Function find_vcvarsall

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

Find the vcvarsall.bat file At first it tries to find the productdir of VS 2008 in the registry. If that fails it falls back to the VS90COMNTOOLS env var.

(version)

Source from the content-addressed store, hash-verified

213 return newVariable
214
215def find_vcvarsall(version):
216 """Find the vcvarsall.bat file
217
218 At first it tries to find the productdir of VS 2008 in the registry. If
219 that fails it falls back to the VS90COMNTOOLS env var.
220 """
221 vsbase = VS_BASE % version
222 try:
223 productdir = Reg.get_value(r"%s\Setup\VC" % vsbase,
224 "productdir")
225 except KeyError:
226 log.debug("Unable to find productdir in registry")
227 productdir = None
228
229 if not productdir or not os.path.isdir(productdir):
230 toolskey = "VS%0.f0COMNTOOLS" % version
231 toolsdir = os.environ.get(toolskey, None)
232
233 if toolsdir and os.path.isdir(toolsdir):
234 productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")
235 productdir = os.path.abspath(productdir)
236 if not os.path.isdir(productdir):
237 log.debug("%s is not a valid directory" % productdir)
238 return None
239 else:
240 log.debug("Env var %s is not set or invalid" % toolskey)
241 if not productdir:
242 log.debug("No productdir found")
243 return None
244 vcvarsall = os.path.join(productdir, "vcvarsall.bat")
245 if os.path.isfile(vcvarsall):
246 return vcvarsall
247 log.debug("Unable to find vcvarsall.bat")
248 return None
249
250def query_vcvarsall(version, arch="x86"):
251 """Launch vcvarsall.bat and read the settings from its environment

Callers 1

query_vcvarsallFunction · 0.85

Calls 7

get_valueMethod · 0.45
debugMethod · 0.45
isdirMethod · 0.45
getMethod · 0.45
joinMethod · 0.45
abspathMethod · 0.45
isfileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…