Move setting the environment variables into getMSVCInfo

This commit is contained in:
Robin Dunn
2022-05-15 10:40:51 -07:00
parent cadd91697c
commit 685b9af718
2 changed files with 8 additions and 7 deletions

View File

@@ -981,7 +981,7 @@ def getExpectedVisCVersion():
MSVCinfo = None
def getMSVCInfo(PYTHON, arch):
def getMSVCInfo(PYTHON, arch, set_env=False):
"""
Fetch info from the system about MSVC, such as versions, paths, etc.
"""
@@ -1005,6 +1005,12 @@ def getMSVCInfo(PYTHON, arch):
env = eval(runcmd('"%s" -c "%s"' % (PYTHON, cmd), getOutput=True, echoCmd=False))
info = AttrDict(env)
if set_env:
os.environ['PATH'] = info.path
os.environ['INCLUDE'] = info.include
os.environ['LIB'] = info.lib
os.environ['LIBPATH'] = info.libpath
MSVCinfo = info
return info