diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index f927d2d922a..8a03ebc12c2 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -11,6 +11,7 @@ from llnl.util import tty import spack.cmd +import spack.config import spack.repo import spack.spec import spack.stage @@ -275,4 +276,4 @@ def add_versions_to_package(pkg: PackageBase, version_lines: str): tty.msg(f"Open {filename} to review the additions.") if sys.stdout.isatty(): - editor(filename) + editor(filename, debug=spack.config.get('config:debug')) diff --git a/lib/spack/spack/cmd/config.py b/lib/spack/spack/cmd/config.py index e7d459ff77c..7458088fd11 100644 --- a/lib/spack/spack/cmd/config.py +++ b/lib/spack/spack/cmd/config.py @@ -180,7 +180,7 @@ def config_edit(args): if args.print_file: print(config_file) else: - editor(config_file) + editor(config_file, debug=spack.config.get('config:debug')) def config_list(args): diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py index f9d4c30a3db..b5dc399e6e6 100644 --- a/lib/spack/spack/cmd/create.py +++ b/lib/spack/spack/cmd/create.py @@ -11,6 +11,7 @@ import llnl.util.tty as tty from llnl.util.filesystem import mkdirp +import spack.config import spack.repo import spack.stage import spack.util.web @@ -986,4 +987,4 @@ def create(parser, args): # Optionally open up the new package file in your $EDITOR if not args.skip_editor: - editor(pkg_path) + editor(pkg_path, debug=spack.config.get('config:debug')) diff --git a/lib/spack/spack/cmd/edit.py b/lib/spack/spack/cmd/edit.py index 79f441a67ad..000e30dc266 100644 --- a/lib/spack/spack/cmd/edit.py +++ b/lib/spack/spack/cmd/edit.py @@ -9,6 +9,7 @@ import llnl.util.tty as tty import spack.cmd +import spack.config import spack.paths import spack.repo from spack.spec import Spec @@ -45,7 +46,7 @@ def edit_package(name, repo_path, namespace): else: raise spack.repo.UnknownPackageError(spec.name) - editor(path) + editor(path, debug=spack.config.get('config:debug')) def setup_parser(subparser): diff --git a/lib/spack/spack/hooks/licensing.py b/lib/spack/spack/hooks/licensing.py index e21445c302c..f61d20dccca 100644 --- a/lib/spack/spack/hooks/licensing.py +++ b/lib/spack/spack/hooks/licensing.py @@ -9,6 +9,7 @@ from llnl.util.filesystem import mkdirp from llnl.util.symlink import symlink +import spack.config import spack.util.editor as ed @@ -39,7 +40,7 @@ def set_up_license(pkg): write_license_file(pkg, license_path) # use spack.util.executable so the editor does not hang on return here - ed.editor(license_path, exec_fn=ed.executable) + ed.editor(license_path, exec_fn=ed.executable, debug=spack.config.get('config:debug')) else: # Use already existing license file tty.msg("Found already existing license %s" % license_path) diff --git a/lib/spack/spack/util/editor.py b/lib/spack/spack/util/editor.py index eff896f87e0..a4a5d5da72e 100644 --- a/lib/spack/spack/util/editor.py +++ b/lib/spack/spack/util/editor.py @@ -18,7 +18,6 @@ import llnl.util.tty as tty -import spack.config import spack.util.executable #: editors to try if VISUAL and EDITOR are not set @@ -61,7 +60,8 @@ def executable(exe: str, args: List[str]) -> int: return cmd.returncode -def editor(*args: str, exec_fn: Callable[[str, List[str]], int] = os.execv) -> bool: +def editor(*args: str, exec_fn: Callable[[str, List[str]], int] = os.execv, + debug: bool = False) -> bool: """Invoke the user's editor. This will try to execute the following, in order: @@ -100,7 +100,7 @@ def try_exec(exe, args, var=None): return exec_fn(exe, args) == 0 except (OSError, spack.util.executable.ProcessError) as e: - if spack.config.get("config:debug"): + if debug: raise # Show variable we were trying to use, if it's from one