summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/cmd/load.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/spack/spack/cmd/load.py b/lib/spack/spack/cmd/load.py
index 80c7263a7a..09f3fd31ee 100644
--- a/lib/spack/spack/cmd/load.py
+++ b/lib/spack/spack/cmd/load.py
@@ -12,6 +12,7 @@ import spack.cmd.common.arguments as arguments
import spack.environment as ev
import spack.util.environment
import spack.user_environment as uenv
+import spack.store
description = "add package to the user environment"
section = "user environment"
@@ -63,15 +64,17 @@ def load(parser, args):
tty.msg(*msg)
return 1
- if 'dependencies' in args.things_to_load:
- include_roots = 'package' in args.things_to_load
- specs = [dep for spec in specs
- for dep in spec.traverse(root=include_roots, order='post')]
+ with spack.store.db.read_transaction():
+ if 'dependencies' in args.things_to_load:
+ include_roots = 'package' in args.things_to_load
+ specs = [dep for spec in specs
+ for dep in
+ spec.traverse(root=include_roots, order='post')]
- env_mod = spack.util.environment.EnvironmentModifications()
- for spec in specs:
- env_mod.extend(uenv.environment_modifications_for_spec(spec))
- env_mod.prepend_path(uenv.spack_loaded_hashes_var, spec.dag_hash())
- cmds = env_mod.shell_modifications(args.shell)
+ env_mod = spack.util.environment.EnvironmentModifications()
+ for spec in specs:
+ env_mod.extend(uenv.environment_modifications_for_spec(spec))
+ env_mod.prepend_path(uenv.spack_loaded_hashes_var, spec.dag_hash())
+ cmds = env_mod.shell_modifications(args.shell)
- sys.stdout.write(cmds)
+ sys.stdout.write(cmds)