-
-
Save zionyx/cd0db3d6027e9a2cd7366e26d1eda289 to your computer and use it in GitHub Desktop.
python implementation replacing "call vsvars32.bat"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess as sub | |
def vs_env_dict(vsver): | |
cmd = r'cmd /s /c ""%VS{0}COMNTOOLS%vsvars32.bat" & set"'.format(vsver) | |
output = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.STDOUT, stdin=sub.PIPE).communicate()[0].split(os.linesep) | |
return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2) | |
#VS2010=100, VS2012=110, VS2013=120, VS2015=140 | |
os.environ.update(vs_env_dict(100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment