A class to manage environment variables
Typical usage:
envsetter = EnvSetter()
envsetter.prepend_to_path(r"c:\path\to\cmake")
envsetter.set_env_var("WITH_SPAM", "ON")
envsetter.source_bat(r"C:\path\to\vcvars.bat")
build_env = envsetter.get_build_env()
# build_env is now a *copy* of os.environ, os.environ does
# NOT change
qisys.command.call("cmake", env=build_env)
Notes:
Returns a dict containing the new environnment (note that os.environ is presevered)
Set a new variable
Append a new directory to an environment variable containing a list of paths (most of the time PATH, but can be LIBDIR, for instance when using cl.exe)
(absolute, native path)
No directory will be added twice
The variable will be put in upper case on the dictionnary on windows.
Append a directory to PATH environment variable
Set environment variables using a .bat script
Note: right now, this only works well with vcvarsall.bat scripts.
Read a qibuild.config.QiBuildConfig instance