From ab5c2d5f7c43eec50edc1fbfb7b4328ebe9ffe0c Mon Sep 17 00:00:00 2001 From: psakiev Date: Tue, 12 Nov 2024 16:09:16 -0700 Subject: [PATCH] Fixes --- lib/spack/spack/cmd/common/env_utility.py | 9 +++++---- lib/spack/spack/cmd/dev_build.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/spack/spack/cmd/common/env_utility.py b/lib/spack/spack/cmd/common/env_utility.py index b3d1a159f91..82379c47a15 100644 --- a/lib/spack/spack/cmd/common/env_utility.py +++ b/lib/spack/spack/cmd/common/env_utility.py @@ -156,7 +156,11 @@ def emulate_env_utility(cmd_name, context: Context, args): ), ) - mods = build_environment.setup_package(spec.package, args.dirty, context) + if cmd: + run_command_in_subshell(spec, context, cmd, prompt=args.dive) + else: + # setup build env if no command to run + build_environment.setup_package(spec.package, args.dirty, context) if args.dump: # Dump a source-able environment to a text file. @@ -168,9 +172,6 @@ def emulate_env_utility(cmd_name, context: Context, args): tty.msg("Pickling a source-able environment to {0}".format(args.pickle)) pickle_environment(args.pickle) - if cmd: - run_command_in_subshell(spec, context, cmd, prompt=args.dive, location=args.cd) - elif not bool(args.pickle or args.dump): # If no command or dump/pickle option then act like the "env" command # and print out env vars. diff --git a/lib/spack/spack/cmd/dev_build.py b/lib/spack/spack/cmd/dev_build.py index b5e75309ffc..e3598d57a3c 100644 --- a/lib/spack/spack/cmd/dev_build.py +++ b/lib/spack/spack/cmd/dev_build.py @@ -17,6 +17,7 @@ import spack.repo from spack.cmd.common import arguments from spack.cmd.common.env_utility import run_command_in_subshell +from spack.context import Context from spack.installer import PackageInstaller description = "developer build: build from user managed code" @@ -171,5 +172,5 @@ def dev_build(self, args): # drop into the build environment of the package? if args.shell is not None: run_command_in_subshell( - spec, context.BUILD, [args.shell], prompt=args.prompt, shell=args.shell + spec, Context.BUILD, [args.shell], prompt=args.prompt, shell=args.shell )