Hide some variables in spack-build.env file
Don't arbitrarily reset PWD and OLDPWD when sourcing, as well as other session-specific IDs
This commit is contained in:
parent
e4ce4e5c2c
commit
6cdbc33c90
1 changed files with 6 additions and 2 deletions
|
@ -119,10 +119,14 @@ def env_var_to_source_line(var, val):
|
|||
|
||||
def dump_environment(path, environment=None):
|
||||
"""Dump an environment dictionary to a source-able file."""
|
||||
use_env = environment if environment else os.environ
|
||||
use_env = environment or os.environ
|
||||
hidden_vars = set(['PS1', 'PWD', 'OLDPWD', 'TERM_SESSION_ID'])
|
||||
|
||||
with open(path, 'w') as env_file:
|
||||
for var, val in sorted(use_env.items()):
|
||||
env_file.write('{0}\n'.format(env_var_to_source_line(var, val)))
|
||||
env_file.write(''.join(['#' if var in hidden_vars else '',
|
||||
env_var_to_source_line(var, val),
|
||||
'\n']))
|
||||
|
||||
|
||||
def pickle_environment(path, environment=None):
|
||||
|
|
Loading…
Reference in a new issue