diff options
Diffstat (limited to 'lib/spack/spack/util/environment.py')
-rw-r--r-- | lib/spack/spack/util/environment.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py index b370053c3c..53e0da32d7 100644 --- a/lib/spack/spack/util/environment.py +++ b/lib/spack/spack/util/environment.py @@ -528,13 +528,18 @@ class EnvironmentModifications(object): return rev - def apply_modifications(self): + def apply_modifications(self, env=None): """Applies the modifications and clears the list.""" + # Use os.environ if not specified + # Do not copy, we want to modify it in place + if env is None: + env = os.environ + modifications = self.group_by_name() # Apply modifications one variable at a time for name, actions in sorted(modifications.items()): for x in actions: - x.execute(os.environ) + x.execute(env) def shell_modifications(self, shell='sh'): """Return shell code to apply the modifications and clears the list.""" |