[SCons] Expand environment variables and ~/ when used in cantera.conf

This commit is contained in:
Ray Speth 2018-09-15 00:20:56 -04:00
parent 4de4aa3f65
commit 9279e0828e

View file

@ -626,6 +626,16 @@ opts.AddVariables(*config_options)
opts.Update(env)
opts.Save('cantera.conf', env)
# Expand ~/ and environment variables used in cantera.conf (variables used on
# the command line will be expanded by the shell)
for option in opts.keys():
original = env[option]
if isinstance(original, str):
modified = os.path.expandvars(os.path.expanduser(env[option]))
if original != modified:
print('INFO: Expanding {!r} to {!r}'.format(original, modified))
env[option] = modified
if 'help' in COMMAND_LINE_TARGETS:
### Print help about configuration options and exit.
print("""