From 4f57c9651a5f4605d4e3668298bd20307181bfb5 Mon Sep 17 00:00:00 2001 From: Rob Latham Date: Thu, 7 Sep 2017 22:07:03 -0500 Subject: 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" --- lib/spack/spack/util/environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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)) -- cgit v1.2.3-60-g2f50