MCPcopy Index your code
hub / github.com/astral-sh/python-build-standalone / find_vs_path

Function find_vs_path

cpython-windows/build.py:239–273  ·  view source on GitHub ↗
(path, msvc_version)

Source from the content-addressed store, hash-verified

237
238
239def find_vs_path(path, msvc_version):
240 vswhere = find_vswhere()
241
242 if msvc_version == "2019":
243 version = "[16,17)"
244 elif msvc_version == "2022":
245 version = "[17,18)"
246 elif msvc_version == "2026":
247 version = "[18,19)"
248 else:
249 raise ValueError(f"unsupported Visual Studio version: {msvc_version}")
250
251 p = subprocess.check_output(
252 [
253 str(vswhere),
254 "-utf8",
255 # Visual Studio 2019.
256 "-version",
257 version,
258 "-property",
259 "installationPath",
260 "-products",
261 "*",
262 ]
263 )
264
265 p = pathlib.Path(p.strip().decode("utf-8"))
266
267 p = p / path
268
269 if not p.exists():
270 print("%s does not exist" % p)
271 sys.exit(1)
272
273 return p
274
275
276def find_msbuild(msvc_version):

Callers 2

find_msbuildFunction · 0.85
find_vcvarsall_pathFunction · 0.85

Calls 1

find_vswhereFunction · 0.85

Tested by

no test coverage detected