Reputation: 1328
I'm writing a python script to coordinate building of a number of Qt-projects on windows. The python script decides which architecture to build for, and which versions of Visual Studio and Qt to use. After that is done I would like to run the proper qtenv2.bat and vcvarsall.bat to setup my environment, and then import the resulting environment for use in my python file.
If the bat files contained only setting of environment variables this would be easy, but since the also contain logic and stuff I need to actually run them and pickup the changes they have done.
I can solve this by using multiple bat/py scripts, but my goal is to write one python script to take care of this build process.
Upvotes: 0
Views: 1095
Reputation: 70961
"If the bat files contained only setting of environment variables this would be easy"
Include a set
command at the end of the batch file and capture its output that will be just the listing of the variables in the environment and their values
Upvotes: 2