diff --git a/var/spack/repos/builtin/packages/aws-ofi-rccl/package.py b/var/spack/repos/builtin/packages/aws-ofi-rccl/package.py index e46601f1195..7d26f58680d 100644 --- a/var/spack/repos/builtin/packages/aws-ofi-rccl/package.py +++ b/var/spack/repos/builtin/packages/aws-ofi-rccl/package.py @@ -37,13 +37,11 @@ class AwsOfiRccl(AutotoolsPackage): # To enable this plug-in to work with RCCL add it to the LD_LIBRARY_PATH def setup_run_environment(self, env): - aws_ofi_rccl_home = self.spec["aws-ofi-rccl"].prefix - env.prepend_path("LD_LIBRARY_PATH", aws_ofi_rccl_home.lib) + env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib) # To enable this plug-in to work with RCCL add it to the LD_LIBRARY_PATH def setup_dependent_run_environment(self, env, dependent_spec): - aws_ofi_rccl_home = self.spec["aws-ofi-rccl"].prefix - env.prepend_path("LD_LIBRARY_PATH", aws_ofi_rccl_home.lib) + env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib) def configure_args(self): spec = self.spec diff --git a/var/spack/repos/builtin/packages/diy/package.py b/var/spack/repos/builtin/packages/diy/package.py index 07fda881fcc..5a7d3872d90 100644 --- a/var/spack/repos/builtin/packages/diy/package.py +++ b/var/spack/repos/builtin/packages/diy/package.py @@ -54,7 +54,7 @@ def test_smoke_test(self): cmake( self.prefix.share.DIY.examples.smoke_test, f"-DMPI_HOME={spec['mpi'].prefix}", - f"-DCMAKE_PREFIX_PATH={spec['diy'].prefix}", + f"-DCMAKE_PREFIX_PATH={self.prefix}", ) cmake("--build", ".") ctest("--verbose") diff --git a/var/spack/repos/builtin/packages/dust/package.py b/var/spack/repos/builtin/packages/dust/package.py index 89f169d7f0b..b802fbc45ac 100644 --- a/var/spack/repos/builtin/packages/dust/package.py +++ b/var/spack/repos/builtin/packages/dust/package.py @@ -28,10 +28,8 @@ def install(self, spec, prefix): @run_after("install") def check_install(self): - print("Attempt to call 'dust' with '--version'") - dust = Executable(join_path(self.spec["dust"].prefix.bin, "dust")) + dust = Executable(join_path(self.prefix.bin, "dust")) output = dust("--version", output=str.split) - print("stdout received fromm dust is '{}".format(output)) assert "Dust " in output def test_run(self): diff --git a/var/spack/repos/builtin/packages/freeipmi/package.py b/var/spack/repos/builtin/packages/freeipmi/package.py index b8b3f9350e6..7e06cd54c5d 100644 --- a/var/spack/repos/builtin/packages/freeipmi/package.py +++ b/var/spack/repos/builtin/packages/freeipmi/package.py @@ -35,13 +35,8 @@ class Freeipmi(AutotoolsPackage): def configure_args(self): # FIXME: If root checking of root installation is added fix this: # Discussed in issue #4432 - tty.warn( - "Requires 'root' for bmc-watchdog.service installation to" " /lib/systemd/system/ !" - ) - - args = [ - "--prefix={0}".format(prefix), - "--with-systemdsystemunitdir=" + self.spec["freeipmi"].prefix.lib.systemd.system, + tty.warn("Requires 'root' for bmc-watchdog.service installation to /lib/systemd/system/") + return [ + f"--prefix={self.prefix}", + f"--with-systemdsystemunitdir={self.prefix.lib.systemd.system}", ] - - return args diff --git a/var/spack/repos/builtin/packages/kmod/package.py b/var/spack/repos/builtin/packages/kmod/package.py index acbca655c5f..af672baac53 100644 --- a/var/spack/repos/builtin/packages/kmod/package.py +++ b/var/spack/repos/builtin/packages/kmod/package.py @@ -34,9 +34,5 @@ def autoreconf(self, spec, prefix): bash("autogen.sh") def configure_args(self): - args = [ - "--disable-manpages", - "--with-bashcompletiondir=" - + join_path(self.spec["kmod"].prefix, "share", "bash-completion", "completions"), - ] - return args + completions = join_path(self.prefix, "share", "bash-completion", "completions") + return ["--disable-manpages", f"--with-bashcompletiondir={completions}"] diff --git a/var/spack/repos/builtin/packages/lxc/package.py b/var/spack/repos/builtin/packages/lxc/package.py index 912bfcdefbf..fdcb96a6ab5 100644 --- a/var/spack/repos/builtin/packages/lxc/package.py +++ b/var/spack/repos/builtin/packages/lxc/package.py @@ -36,8 +36,4 @@ class Lxc(AutotoolsPackage): depends_on("m4", type="build") def configure_args(self): - args = [ - "bashcompdir=" - + join_path(self.spec["lxc"].prefix, "share", "bash-completion", "completions") - ] - return args + return [f"bashcompdir={join_path(self.prefix, 'share', 'bash-completion', 'completions')}"] diff --git a/var/spack/repos/builtin/packages/openspeedshop-utils/package.py b/var/spack/repos/builtin/packages/openspeedshop-utils/package.py index f82fa5c9c21..46562aa6cfe 100644 --- a/var/spack/repos/builtin/packages/openspeedshop-utils/package.py +++ b/var/spack/repos/builtin/packages/openspeedshop-utils/package.py @@ -291,10 +291,7 @@ def setup_run_environment(self, env): # Find openspeedshop library path oss_libdir = find_libraries( - "libopenss-framework", - root=self.spec["openspeedshop-utils"].prefix, - shared=True, - recursive=True, + "libopenss-framework", root=self.prefix, shared=True, recursive=True ) env.prepend_path("LD_LIBRARY_PATH", os.path.dirname(oss_libdir.joined())) diff --git a/var/spack/repos/builtin/packages/ophidia-analytics-framework/package.py b/var/spack/repos/builtin/packages/ophidia-analytics-framework/package.py index 4e2f010fe91..57f5a106f01 100644 --- a/var/spack/repos/builtin/packages/ophidia-analytics-framework/package.py +++ b/var/spack/repos/builtin/packages/ophidia-analytics-framework/package.py @@ -42,10 +42,8 @@ def autoreconf(self, spec, prefix): def configure_args(self): args = [ "--enable-parallel-netcdf", - "--with-web-server-path={0}/html".format( - self.spec["ophidia-analytics-framework"].prefix - ), + f"--with-web-server-path={self.prefix}/html", "--with-web-server-url=http://127.0.0.1/ophidia", - "--with-ophidiaio-server-path={0}".format(self.spec["ophidia-io-server"].prefix), + f"--with-ophidiaio-server-path={self.spec['ophidia-io-server'].prefix}", ] return args diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py index 12b731409f9..4790f8dfe33 100644 --- a/var/spack/repos/builtin/packages/paraview/package.py +++ b/var/spack/repos/builtin/packages/paraview/package.py @@ -748,19 +748,15 @@ def use_x11(): def test_smoke_test(self): """Simple smoke test for ParaView""" - spec = self.spec - - pvserver = Executable(spec["paraview"].prefix.bin.pvserver) + pvserver = Executable(self.prefix.bin.pvserver) pvserver("--help") def test_pvpython(self): """Test pvpython""" - spec = self.spec - - if "~python" in spec: + if "~python" in self.spec: raise SkipTest("Package must be installed with +python") - pvpython = Executable(spec["paraview"].prefix.bin.pvpython) + pvpython = Executable(self.prefix.bin.pvpython) pvpython("-c", "import paraview") def test_mpi_ensemble(self): @@ -771,8 +767,8 @@ def test_mpi_ensemble(self): raise SkipTest("Package must be installed with +mpi and +python") mpirun = spec["mpi"].prefix.bin.mpirun - pvserver = spec["paraview"].prefix.bin.pvserver - pvpython = Executable(spec["paraview"].prefix.bin.pvpython) + pvserver = self.prefix.bin.pvserver + pvpython = Executable(self.prefix.bin.pvpython) with working_dir("smoke_test_build", create=True): with Popen( diff --git a/var/spack/repos/builtin/packages/pocl/package.py b/var/spack/repos/builtin/packages/pocl/package.py index 1f3b0a3bc58..da304a492ea 100644 --- a/var/spack/repos/builtin/packages/pocl/package.py +++ b/var/spack/repos/builtin/packages/pocl/package.py @@ -121,8 +121,7 @@ def check_install(self): with working_dir(checkdir, create=True): source = join_path(os.path.dirname(self.module.__file__), "example1.c") cflags = spec["pocl"].headers.cpp_flags.split() - # ldflags = spec["pocl"].libs.ld_flags.split() - ldflags = ["-L%s" % spec["pocl"].prefix.lib, "-lOpenCL", "-lpoclu"] + ldflags = [f"-L{self.prefix.lib}", "-lOpenCL", "-lpoclu"] output = compile_c_and_execute(source, cflags, ldflags) compare_output_file( output, join_path(os.path.dirname(self.module.__file__), "example1.out") diff --git a/var/spack/repos/builtin/packages/rocm-clang-ocl/package.py b/var/spack/repos/builtin/packages/rocm-clang-ocl/package.py index 0014483235e..5e41a98168a 100644 --- a/var/spack/repos/builtin/packages/rocm-clang-ocl/package.py +++ b/var/spack/repos/builtin/packages/rocm-clang-ocl/package.py @@ -89,6 +89,6 @@ def test_make(self): test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) with working_dir(test_dir): cmake = self.spec["cmake"].command - cmake("-DCMAKE_PREFIX_PATH=" + self.spec["rocm-clang-ocl"].prefix, ".") + cmake(f"-DCMAKE_PREFIX_PATH={self.prefix}", ".") make = which("make") make() diff --git a/var/spack/repos/builtin/packages/rocm-cmake/package.py b/var/spack/repos/builtin/packages/rocm-cmake/package.py index 05cff118b27..701535a103f 100644 --- a/var/spack/repos/builtin/packages/rocm-cmake/package.py +++ b/var/spack/repos/builtin/packages/rocm-cmake/package.py @@ -80,9 +80,8 @@ def test_cmake(self): """Test cmake""" test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) with working_dir(test_dir, create=True): - prefixes = ";".join([self.spec["rocm-cmake"].prefix]) - cc_options = ["-DCMAKE_PREFIX_PATH=" + prefixes, "."] - cmake = which(self.spec["cmake"].prefix.bin.cmake) + cc_options = [f"-DCMAKE_PREFIX_PATH={self.prefix}", "."] + cmake = self.spec["cmake"].command cmake(*cc_options) make() make("clean") diff --git a/var/spack/repos/builtin/packages/tixi/package.py b/var/spack/repos/builtin/packages/tixi/package.py index 4437bc3c5c5..80b3d6ba246 100644 --- a/var/spack/repos/builtin/packages/tixi/package.py +++ b/var/spack/repos/builtin/packages/tixi/package.py @@ -67,7 +67,7 @@ def setup_run_environment(self, env): env.prepend_path("PYTHONPATH", self.spec.prefix.share.tixi.python) # allow ctypes to find the tixi library - libs = ":".join(self.spec["tixi"].libs.directories) + libs = ":".join(self.libs.directories) if sys.platform == "darwin": env.prepend_path("DYLD_FALLBACK_LIBRARY_PATH", libs) else: diff --git a/var/spack/repos/builtin/packages/tk/package.py b/var/spack/repos/builtin/packages/tk/package.py index 91e461a41b8..4d026369b88 100644 --- a/var/spack/repos/builtin/packages/tk/package.py +++ b/var/spack/repos/builtin/packages/tk/package.py @@ -80,9 +80,7 @@ def install(self, spec, prefix): # Replace stage dir -> installed src dir in tkConfig filter_file( - stage_src, - installed_src, - join_path(self.spec["tk"].libs.directories[0], "tkConfig.sh"), + stage_src, installed_src, join_path(self.libs.directories[0], "tkConfig.sh") ) @run_after("install") @@ -92,8 +90,7 @@ def symlink_wish(self): def test_tk_help(self): """run tk help""" - tk = self.spec["tk"].command - tk("-h") + self.command("-h") def test_tk_load(self): """check that tk can be loaded""" @@ -112,15 +109,11 @@ def command(self): # Although we symlink wishX.Y to wish, we also need to support external # installations that may not have this symlink, or may have multiple versions # of Tk installed in the same directory. - return Executable( - os.path.realpath(self.prefix.bin.join("wish{0}".format(self.version.up_to(2)))) - ) + return Executable(os.path.realpath(self.prefix.bin.join(f"wish{self.version.up_to(2)}"))) @property def libs(self): - return find_libraries( - ["libtk{0}".format(self.version.up_to(2))], root=self.prefix, recursive=True - ) + return find_libraries([f"libtk{self.version.up_to(2)}"], root=self.prefix, recursive=True) def _find_script_dir(self): # Put more-specific prefixes first diff --git a/var/spack/repos/builtin/packages/veclibfort/package.py b/var/spack/repos/builtin/packages/veclibfort/package.py index 40a5d0aedd9..66593bde358 100644 --- a/var/spack/repos/builtin/packages/veclibfort/package.py +++ b/var/spack/repos/builtin/packages/veclibfort/package.py @@ -2,8 +2,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import sys - from spack.package import * @@ -47,9 +45,6 @@ def headers(self): return HeaderList([]) def install(self, spec, prefix): - if sys.platform != "darwin": - raise InstallError("vecLibFort can be installed on macOS only") - filter_file(r"^PREFIX=.*", "", "Makefile") make_args = [] @@ -57,13 +52,13 @@ def install(self, spec, prefix): if spec.satisfies("%gcc@6:"): make_args += ["CFLAGS=-flax-vector-conversions"] - make_args += ["PREFIX=%s" % prefix, "install"] + make_args += [f"PREFIX={prefix}", "install"] make(*make_args) # test fc = which("fc") flags = ["-o", "tester", "-O", "tester.f90"] - flags.extend(spec["veclibfort"].libs.ld_flags.split()) + flags.extend(self.libs.ld_flags.split()) fc(*flags) Executable("./tester")() diff --git a/var/spack/repos/builtin/packages/vtk-m/package.py b/var/spack/repos/builtin/packages/vtk-m/package.py index 765cda84c84..5b6e99add80 100644 --- a/var/spack/repos/builtin/packages/vtk-m/package.py +++ b/var/spack/repos/builtin/packages/vtk-m/package.py @@ -276,20 +276,16 @@ def cmake_args(self): def test_smoke_test(self): """Build and run ctests""" - spec = self.spec - - if "+examples" not in spec: + if "+examples" not in self.spec: raise SkipTest("Package must be installed with +examples") testdir = "smoke_test_build" with working_dir(testdir, create=True): - cmake = Executable(spec["cmake"].prefix.bin.cmake) - ctest = Executable(spec["cmake"].prefix.bin.ctest) - cmakeExampleDir = spec["vtk-m"].prefix.share.doc.VTKm.examples.smoke_test - - cmake(*([cmakeExampleDir, "-DVTKm_ROOT=" + spec["vtk-m"].prefix])) - cmake(*(["--build", "."])) - ctest(*(["--verbose"])) + cmake = Executable(self.spec["cmake"].prefix.bin.cmake) + ctest = Executable(self.spec["cmake"].prefix.bin.ctest) + cmake(self.prefix.share.doc.VTKm.examples.smoke_test, f"-DVTKm_ROOT={self.prefix}") + cmake("--build", ".") + ctest("--verbose") @run_after("install") @on_package_attributes(run_tests=True) diff --git a/var/spack/repos/builtin/packages/zfp/package.py b/var/spack/repos/builtin/packages/zfp/package.py index 8c13ad703df..000d7208bf8 100644 --- a/var/spack/repos/builtin/packages/zfp/package.py +++ b/var/spack/repos/builtin/packages/zfp/package.py @@ -185,9 +185,9 @@ def test_smoke_test(self, source_dir=None): cmake = Executable(spec["cmake"].prefix.bin.cmake) ctest = Executable(spec["cmake"].prefix.bin.ctest) - cmake(*([".", "-DZFP_ROOT=" + spec["zfp"].prefix])) - cmake(*(["--build", "."])) - ctest(*(["--verbose"])) + cmake(".", f"-DZFP_ROOT={self.prefix}") + cmake("--build", ".") + ctest("--verbose") @run_after("install") def copy_test_files(self):