summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Latham <rlatham@gmail.com>2017-09-07 22:07:03 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2017-09-07 17:07:03 -1000
commit4f57c9651a5f4605d4e3668298bd20307181bfb5 (patch)
tree6f1fc820fdaf3c813a6bc6d3103ec2f61798924c /lib
parent2e0fc391736d3cc4c382d3fe4eaa5be692ceb717 (diff)
downloadspack-4f57c9651a5f4605d4e3668298bd20307181bfb5.tar.gz
spack-4f57c9651a5f4605d4e3668298bd20307181bfb5.tar.bz2
spack-4f57c9651a5f4605d4e3668298bd20307181bfb5.tar.xz
spack-4f57c9651a5f4605d4e3668298bd20307181bfb5.zip
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"
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/util/environment.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py
index 276f8d63f3..38576d6e9d 100644
--- a/lib/spack/spack/util/environment.py
+++ b/lib/spack/spack/util/environment.py
@@ -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))