diff --git a/var/spack/repos/builtin/packages/bazel/package.py b/var/spack/repos/builtin/packages/bazel/package.py index c4d3ca841c7..bdb980cc63b 100644 --- a/var/spack/repos/builtin/packages/bazel/package.py +++ b/var/spack/repos/builtin/packages/bazel/package.py @@ -319,7 +319,7 @@ def install_test(self): ) # Spack's logs don't handle colored output well - bazel = Executable(self.spec["bazel"].command.path) + bazel = Executable(self.command.path) bazel( "--output_user_root=/tmp/spack/bazel/spack-test", "build", @@ -332,7 +332,7 @@ def install_test(self): assert exe(output=str) == "Hi!\n" def setup_dependent_package(self, module, dependent_spec): - module.bazel = Executable(self.spec["bazel"].command.path) + module.bazel = Executable(self.command.path) @property def parallel(self): diff --git a/var/spack/repos/builtin/packages/cosmomc/package.py b/var/spack/repos/builtin/packages/cosmomc/package.py index db0fc69eddc..933dfd99768 100644 --- a/var/spack/repos/builtin/packages/cosmomc/package.py +++ b/var/spack/repos/builtin/packages/cosmomc/package.py @@ -169,7 +169,7 @@ def check_install(self): os.environ.pop("CLIKPATH", "") os.environ.pop("PLANCKLIKE", "") - exe = spec["cosmomc"].command.path + exe = self.command.path args = [] if spec.satisfies("+mpi"): # Add mpirun prefix diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index b5767c60538..9566b4db95c 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -1005,7 +1005,7 @@ def write_specs_file(self): specs_file = join_path(self.spec_dir, "specs") with open(specs_file, "w") as f: # can't extend the builtins without dumping them first - f.write(self.spec["gcc"].command("-dumpspecs", output=str, error=os.devnull).strip()) + f.write(self.command("-dumpspecs", output=str, error=os.devnull).strip()) f.write("\n\n# Generated by Spack\n\n") @@ -1179,7 +1179,7 @@ def _post_buildcache_install_hook(self): # Setting up the runtime environment shouldn't be necessary here. relocation_args = [] - gcc = self.spec["gcc"].command + gcc = self.command specs_file = os.path.join(self.spec_dir, "specs") dryrun = gcc("test.c", "-###", output=os.devnull, error=str).strip() if not dryrun: diff --git a/var/spack/repos/builtin/packages/go/package.py b/var/spack/repos/builtin/packages/go/package.py index 05196d7616b..fef03bec1c4 100644 --- a/var/spack/repos/builtin/packages/go/package.py +++ b/var/spack/repos/builtin/packages/go/package.py @@ -120,4 +120,4 @@ def setup_dependent_package(self, module, dependent_spec): install_tree('bin', prefix.bin) """ # Add a go command/compiler for extensions - module.go = self.spec["go"].command + module.go = self.command diff --git a/var/spack/repos/builtin/packages/jq/package.py b/var/spack/repos/builtin/packages/jq/package.py index 098963a74fc..fc4b1c89ae5 100644 --- a/var/spack/repos/builtin/packages/jq/package.py +++ b/var/spack/repos/builtin/packages/jq/package.py @@ -36,7 +36,7 @@ def configure_args(self): @run_after("install") @on_package_attributes(run_tests=True) def install_test(self): - jq = self.spec["jq"].command + jq = self.command f = os.path.join(os.path.dirname(__file__), "input.json") assert jq(".bar", input=f, output=str) == "2\n" diff --git a/var/spack/repos/builtin/packages/plumed/package.py b/var/spack/repos/builtin/packages/plumed/package.py index 04041f43df5..07b29affeee 100644 --- a/var/spack/repos/builtin/packages/plumed/package.py +++ b/var/spack/repos/builtin/packages/plumed/package.py @@ -244,7 +244,7 @@ def apply_patch(self, other): def setup_dependent_package(self, module, dependent_spec): # Make plumed visible from dependent packages - module.plumed = dependent_spec["plumed"].command + module.plumed = self.command @property def plumed_inc(self): diff --git a/var/spack/repos/builtin/packages/python-venv/package.py b/var/spack/repos/builtin/packages/python-venv/package.py index 796419a5ff6..583c3fafbd5 100644 --- a/var/spack/repos/builtin/packages/python-venv/package.py +++ b/var/spack/repos/builtin/packages/python-venv/package.py @@ -54,7 +54,7 @@ def bindir(self): def command(self): """Returns a python Executable instance""" python_name = "python" if self.spec.satisfies("platform=windows") else "python3" - return which(python_name, path=self.bindir) + return which(python_name, path=self.bindir, required=True) def _get_path(self, name) -> str: return self.command( diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index 322744dc0a5..f86e3570f34 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -1373,8 +1373,7 @@ def add_files_to_view(self, view, merge_map, skip_if_exists=True): def test_hello_world(self): """run simple hello world program""" - # do not use self.command because we are also testing the run env - python = self.spec["python"].command + python = self.command msg = "hello world!" out = python("-c", f'print("{msg}")', output=str.split, error=str.split) @@ -1382,7 +1381,7 @@ def test_hello_world(self): def test_import_executable(self): """ensure import of installed executable works""" - python = self.spec["python"].command + python = self.command out = python("-c", "import sys; print(sys.executable)", output=str.split, error=str.split) assert self.spec.prefix in out