From 9279e0828e6d128c717395c491f14ad25c2cfdcf Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 15 Sep 2018 00:20:56 -0400 Subject: [PATCH] [SCons] Expand environment variables and ~/ when used in cantera.conf --- SConstruct | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SConstruct b/SConstruct index 2d0bc0a90..4f08caedb 100644 --- a/SConstruct +++ b/SConstruct @@ -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("""