dump environment in sourceable form (#5301)

First, quote the environment variable values.  Second, export the
variables. sorry, this is bourn-shell syntax.  Happy to consider a
shell-independent way to do this, but spack is already using sh-like
"env=value"
This commit is contained in:
Rob Latham 2017-09-07 22:07:03 -05:00 committed by Todd Gamblin
parent 2e0fc39173
commit 4f57c9651a

View File

@ -72,4 +72,4 @@ def dump_environment(path):
"""Dump the current environment out to a file."""
with open(path, 'w') as env_file:
for key, val in sorted(os.environ.items()):
env_file.write("%s=%s\n" % (key, val))
env_file.write('export %s="%s"\n' % (key, val))