MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / find_vs_path

Function find_vs_path

scripts/compile_cpp.py:203–227  ·  view source on GitHub ↗

Find the Visual Studio installation path, if it exists.

()

Source from the content-addressed store, hash-verified

201
202
203def find_vs_path() -> pathlib.Path | None:
204 """Find the Visual Studio installation path, if it exists."""
205 if platform.system() != "Windows":
206 return None
207 pf86: str = os.environ.get("ProgramFiles(x86)", r"C:\Program Files (x86)")
208 pf: str = os.environ.get("ProgramFiles", r"C:\Program Files")
209 try_paths: list[pathlib.Path] = [pathlib.Path(p) / "Microsoft Visual Studio" / "Installer" / "vswhere.exe" for p in [pf86, pf]]
210 vswhere: pathlib.Path | None = next((p for p in try_paths if p.exists()), None)
211 if vswhere is None:
212 return None
213 try:
214 install_root: str = subprocess.check_output(
215 [
216 str(vswhere),
217 "-latest",
218 "-property",
219 "installationPath",
220 ],
221 text=True,
222 ).strip()
223 except subprocess.CalledProcessError:
224 return None
225 if install_root == "":
226 return None
227 return pathlib.Path(install_root)
228
229
230def get_module_flags(name: str, module_output_path: pathlib.Path) -> list[str]:

Callers 1

compile_cpp.pyFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected