Skip to content

Instantly share code, notes, and snippets.

@flozz
Created April 8, 2020 14:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flozz/c992c1b6dd91e0d5fde93fae1464daf8 to your computer and use it in GitHub Desktop.
Save flozz/c992c1b6dd91e0d5fde93fae1464daf8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
## Version 2, December 2004
##
## Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
##
## Everyone is permitted to copy and distribute verbatim or modified
## copies of this license document, and changing it is allowed as long
## as the name is changed.
##
## DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
## TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
##
## 0. You just DO WHAT THE FUCK YOU WANT TO.
import os
# This function finds the path of the MSBuild.exe executable (Visual Studio / MS Build Tools)
def find_msbuild(plat_spec="x64"):
# https://github.com/python/cpython/blob/master/Lib/distutils/_msvccompiler.py
import distutils._msvccompiler as msvc
vc_env = msvc._get_vc_env(plat_spec)
if "vsinstalldir" not in vc_env:
raise Exception("Unable to find any Visual Studio installation")
return os.path.join(vc_env["vsinstalldir"], "MSBuild", "Current", "Bin", "MSBuild.exe") # noqa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment