diff options
author | Auriane R. <48684432+aurianer@users.noreply.github.com> | 2024-08-02 01:21:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-01 18:21:37 -0500 |
commit | de98e3d6e58000b1e75b8f0bf6f0f1d485d0c490 (patch) | |
tree | d2d240e188566808fde9dd966ca6e2dea2ab5714 /var | |
parent | ffcb4ee4878bb4f76a9c754f952c56fb6635c77d (diff) | |
download | spack-de98e3d6e58000b1e75b8f0bf6f0f1d485d0c490.tar.gz spack-de98e3d6e58000b1e75b8f0bf6f0f1d485d0c490.tar.bz2 spack-de98e3d6e58000b1e75b8f0bf6f0f1d485d0c490.tar.xz spack-de98e3d6e58000b1e75b8f0bf6f0f1d485d0c490.zip |
Update if ... in spec with satisfies in a* dirs (#44822)
Diffstat (limited to 'var')
34 files changed, 194 insertions, 194 deletions
diff --git a/var/spack/repos/builtin/packages/abacus/package.py b/var/spack/repos/builtin/packages/abacus/package.py index 7ba2ee206a..c44cfb0676 100644 --- a/var/spack/repos/builtin/packages/abacus/package.py +++ b/var/spack/repos/builtin/packages/abacus/package.py @@ -46,7 +46,7 @@ class Abacus(MakefilePackage): build_directory = "source" def edit(self, spec, prefix): - if "+openmp" in spec: + if spec.satisfies("+openmp"): inc_var = "_openmp-" system_var = "ELPA_LIB = -L${ELPA_LIB_DIR} -lelpa_openmp -Wl, -rpath=${ELPA_LIB_DIR}" else: diff --git a/var/spack/repos/builtin/packages/abinit/package.py b/var/spack/repos/builtin/packages/abinit/package.py index 67abe078f6..4f8238ed1b 100644 --- a/var/spack/repos/builtin/packages/abinit/package.py +++ b/var/spack/repos/builtin/packages/abinit/package.py @@ -146,12 +146,12 @@ class Abinit(AutotoolsPackage): options += self.with_or_without("libxml2") oapp = options.append - if "@:8" in spec: + if spec.satisfies("@:8"): oapp(f"--enable-optim={self.spec.variants['optimization-flavor'].value}") else: oapp(f"--with-optim-flavor={self.spec.variants['optimization-flavor'].value}") - if "+wannier90" in spec: + if spec.satisfies("+wannier90"): if spec.satisfies("@:8"): oapp(f"--with-wannier90-libs=-L{spec['wannier90'].prefix.lib} -lwannier -lm") oapp(f"--with-wannier90-incs=-I{spec['wannier90'].prefix.modules}") @@ -174,16 +174,16 @@ class Abinit(AutotoolsPackage): ] ) else: - if "@:9.8" in spec: + if spec.satisfies("@:9.8"): oapp(f"--with-fftw={spec['fftw-api'].prefix}") oapp(f"--with-hdf5={spec['hdf5'].prefix}") - if "@:8" in spec: + if spec.satisfies("@:8"): oapp("--with-dft-flavor=atompaw+libxc") else: "--without-wannier90", - if "+mpi" in spec: + if spec.satisfies("+mpi"): oapp(f"CC={spec['mpi'].mpicc}") oapp(f"CXX={spec['mpi'].mpicxx}") oapp(f"FC={spec['mpi'].mpifc}") @@ -192,18 +192,18 @@ class Abinit(AutotoolsPackage): # MPI version: # let the configure script auto-detect MPI support from mpi_prefix - if "@:8" in spec: + if spec.satisfies("@:8"): oapp("--enable-mpi=yes") else: oapp("--with-mpi") else: - if "@:8" in spec: + if spec.satisfies("@:8"): oapp("--enable-mpi=no") else: oapp("--without-mpi") # Activate OpenMP in Abinit Fortran code. - if "+openmp" in spec: + if spec.satisfies("+openmp"): oapp("--enable-openmp=yes") else: oapp("--enable-openmp=no") @@ -213,19 +213,19 @@ class Abinit(AutotoolsPackage): is_using_intel_libraries = spec["lapack"].name in INTEL_MATH_LIBRARIES if is_using_intel_libraries: linalg_flavor = "mkl" - elif "@9:" in spec and "^openblas" in spec: + if spec.satisfies("@9:") and spec.satisfies("^openblas"): linalg_flavor = "openblas" - elif "@9:" in spec and "^fujitsu-ssl2" in spec: + if spec.satisfies("@9:") and spec.satisfies("^fujitsu-ssl2"): linalg_flavor = "openblas" else: linalg_flavor = "custom" - if "+scalapack" in spec: + if spec.satisfies("+scalapack"): linalg = spec["scalapack"].libs + linalg - if "@:8" in spec: + if spec.satisfies("@:8"): linalg_flavor = f"scalapack+{linalg_flavor}" - if "@:8" in spec: + if spec.satisfies("@:8"): oapp(f"--with-linalg-libs={linalg.ld_flags}") else: oapp(f"LINALG_LIBS={linalg.ld_flags}") @@ -235,14 +235,14 @@ class Abinit(AutotoolsPackage): if is_using_intel_libraries: fftflavor = "dfti" else: - if "+openmp" in spec: + if spec.satisfies("+openmp"): fftflavor, fftlibs = "fftw3-threads", "-lfftw3_omp -lfftw3 -lfftw3f" else: fftflavor, fftlibs = "fftw3", "-lfftw3 -lfftw3f" oapp(f"--with-fft-flavor={fftflavor}") - if "@:8" in spec: + if spec.satisfies("@:8"): if is_using_intel_libraries: oapp(f"--with-fft-incs={spec['fftw-api'].headers.cpp_flags}") oapp(f"--with-fft-libs={spec['fftw-api'].libs.ld_flags}") @@ -271,7 +271,7 @@ class Abinit(AutotoolsPackage): # LibXC library libxc = spec["libxc:fortran"] - if "@:8" in spec: + if spec.satisfies("@:8"): options.extend( [ f"--with-libxc-incs={libxc.headers.cpp_flags}", @@ -285,7 +285,7 @@ class Abinit(AutotoolsPackage): hdf5 = spec["hdf5:hl"] netcdfc = spec["netcdf-c"] netcdff = spec["netcdf-fortran:shared"] - if "@:8" in spec: + if spec.satisfies("@:8"): oapp("--with-trio-flavor=netcdf") # Since version 8, Abinit started to use netcdf4 + hdf5 and we have # to link with the high level HDF5 library @@ -318,7 +318,7 @@ class Abinit(AutotoolsPackage): # the tests directly execute abinit. thus failing with MPI # TODO: run tests in tests/ via the builtin runtests.py # requires Python with numpy, pyyaml, pandas - if "~mpi" in self.spec: + if self.spec.satisfies("~mpi"): make("tests_in") # Abinit assumes the *old* behavior of HDF5 where the library flags to link @@ -333,5 +333,5 @@ class Abinit(AutotoolsPackage): def install(self, spec, prefix): make("install") - if "+install-tests" in spec: + if spec.satisfies("+install-tests"): install_tree("tests", spec.prefix.tests) diff --git a/var/spack/repos/builtin/packages/accfft/package.py b/var/spack/repos/builtin/packages/accfft/package.py index b38e074119..45ffad796c 100644 --- a/var/spack/repos/builtin/packages/accfft/package.py +++ b/var/spack/repos/builtin/packages/accfft/package.py @@ -42,7 +42,7 @@ class Accfft(CMakePackage, CudaPackage): self.define("BUILD_SHARED", str(spec.satisfies("+shared")).lower()), ] - if "+cuda" in spec: + if spec.satisfies("+cuda"): cuda_arch = [x for x in spec.variants["cuda_arch"].value if x] if cuda_arch: args.append(f"-DCUDA_NVCC_FLAGS={' '.join(self.cuda_flags(cuda_arch))}") diff --git a/var/spack/repos/builtin/packages/acts/package.py b/var/spack/repos/builtin/packages/acts/package.py index d4f79be031..fcd2c9e576 100644 --- a/var/spack/repos/builtin/packages/acts/package.py +++ b/var/spack/repos/builtin/packages/acts/package.py @@ -493,7 +493,7 @@ class Acts(CMakePackage, CudaPackage): if spec.satisfies("@14: +vecmem"): args.append("-DACTS_USE_SYSTEM_VECMEM=ON") - if "+cuda" in spec: + if spec.satisfies("+cuda"): cuda_arch = spec.variants["cuda_arch"].value if cuda_arch != "none": args.append(f"-DCUDA_FLAGS=-arch=sm_{cuda_arch[0]}") diff --git a/var/spack/repos/builtin/packages/adios/package.py b/var/spack/repos/builtin/packages/adios/package.py index 88536258c7..0b77cfd327 100644 --- a/var/spack/repos/builtin/packages/adios/package.py +++ b/var/spack/repos/builtin/packages/adios/package.py @@ -144,14 +144,14 @@ class Adios(AutotoolsPackage): extra_args += self.enable_or_disable("shared") extra_args += self.enable_or_disable("fortran") - if "+mpi" in spec: + if spec.satisfies("+mpi"): env["MPICC"] = spec["mpi"].mpicc env["MPICXX"] = spec["mpi"].mpicxx extra_args += self.with_or_without("mpi", activation_value="prefix") extra_args += self.with_or_without("infiniband") - if "+zlib" in spec: + if spec.satisfies("+zlib"): extra_args.append(f"--with-zlib={spec['zlib-api'].prefix}") else: extra_args.append("--without-zlib") diff --git a/var/spack/repos/builtin/packages/adios2/package.py b/var/spack/repos/builtin/packages/adios2/package.py index 7a263b5a1c..c70a7b1660 100644 --- a/var/spack/repos/builtin/packages/adios2/package.py +++ b/var/spack/repos/builtin/packages/adios2/package.py @@ -292,7 +292,7 @@ class Adios2(CMakePackage, CudaPackage, ROCmPackage): self.define("ADIOS2_USE_MGARD", False), ] - if "+sst" in spec: + if spec.satisfies("+sst"): args.extend( [ # Broken dependency package @@ -305,15 +305,15 @@ class Adios2(CMakePackage, CudaPackage, ROCmPackage): ] ) - if "%fj" in spec: + if spec.satisfies("%fj"): args.extend(["-DCMAKE_Fortran_SUBMODULE_EXT=.smod", "-DCMAKE_Fortran_SUBMODULE_SEP=."]) # hip support - if "+cuda" in spec: + if spec.satisfies("+cuda"): args.append(self.builder.define_cuda_architectures(self)) # hip support - if "+rocm" in spec: + if spec.satisfies("+rocm"): args.append(self.builder.define_hip_architectures(self)) return args @@ -323,18 +323,18 @@ class Adios2(CMakePackage, CudaPackage, ROCmPackage): spec = self.spec libs_to_seek = set() - if "@2.6:" in spec: + if spec.satisfies("@2.6:"): libs_to_seek.add("libadios2_core") libs_to_seek.add("libadios2_c") libs_to_seek.add("libadios2_cxx11") - if "+fortran" in spec: + if spec.satisfies("+fortran"): libs_to_seek.add("libadios2_fortran") - if "+mpi" in spec: + if spec.satisfies("+mpi"): libs_to_seek.add("libadios2_core_mpi") libs_to_seek.add("libadios2_c_mpi") libs_to_seek.add("libadios2_cxx11_mpi") - if "+fortran" in spec: + if spec.satisfies("+fortran"): libs_to_seek.add("libadios2_fortran_mpi") if "@2.7: +shared+hdf5" in spec and "@1.12:" in spec["hdf5"]: @@ -342,7 +342,7 @@ class Adios2(CMakePackage, CudaPackage, ROCmPackage): else: libs_to_seek.add("libadios2") - if "+fortran" in spec: + if spec.satisfies("+fortran"): libs_to_seek.add("libadios2_fortran") return find_libraries( @@ -391,7 +391,7 @@ class Adios2(CMakePackage, CudaPackage, ROCmPackage): std_cmake_args = [] - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): mpi_exec = join_path(self.spec["mpi"].prefix, "bin", "mpiexec") std_cmake_args.append(f"-DMPIEXEC_EXECUTABLE={mpi_exec}") diff --git a/var/spack/repos/builtin/packages/adol-c/package.py b/var/spack/repos/builtin/packages/adol-c/package.py index 44567d936b..a7eff71ad5 100644 --- a/var/spack/repos/builtin/packages/adol-c/package.py +++ b/var/spack/repos/builtin/packages/adol-c/package.py @@ -87,12 +87,12 @@ class AdolC(AutotoolsPackage): configure_args = [] - if "+boost" in spec: + if spec.satisfies("+boost"): configure_args.append(f"--with-boost={spec['boost'].prefix}") else: configure_args.append("--with-boost=no") - if "+openmp" in spec: + if spec.satisfies("+openmp"): configure_args.append(f"--with-openmp-flag={self.compiler.openmp_flag}") configure_args.extend( @@ -107,14 +107,14 @@ class AdolC(AutotoolsPackage): # We can simply use the bundled examples to check # whether Adol-C works as expected - if "+examples" in spec: + if spec.satisfies("+examples"): configure_args.extend( [ "--enable-docexa", # Documented examples "--enable-addexa", # Additional examples ] ) - if "+openmp" in spec: + if spec.satisfies("+openmp"): configure_args.append("--enable-parexa") # Parallel examples return configure_args @@ -130,11 +130,11 @@ class AdolC(AutotoolsPackage): install(config_h, join_path(prefix.include, "adolc")) # Install documentation to {prefix}/share - if "+doc" in spec: + if spec.satisfies("+doc"): install_tree(join_path("ADOL-C", "doc"), join_path(prefix.share, "doc")) # Install examples to {prefix}/share - if "+examples" in spec: + if spec.satisfies("+examples"): install_tree(join_path("ADOL-C", "examples"), join_path(prefix.share, "examples")) # Run some examples that don't require user input @@ -148,7 +148,7 @@ class AdolC(AutotoolsPackage): ): Executable("./checkpointing/checkpointing")() - if "+openmp" in spec: + if spec.satisfies("+openmp"): with working_dir( join_path(source_directory, "ADOL-C", "examples", "additional_examples") ): diff --git a/var/spack/repos/builtin/packages/alpaka/package.py b/var/spack/repos/builtin/packages/alpaka/package.py index e8e06fd4a9..29a5b2ccf9 100644 --- a/var/spack/repos/builtin/packages/alpaka/package.py +++ b/var/spack/repos/builtin/packages/alpaka/package.py @@ -79,30 +79,30 @@ class Alpaka(CMakePackage, CudaPackage): def cmake_args(self): spec = self.spec args = [] - if "backend=serial" in spec: + if spec.satisfies("backend=serial"): args.append(self.define("ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLE", True)) - if "backend=threads" in self.spec: + if self.spec.satisfies("backend=threads"): args.append(self.define("ALPAKA_ACC_CPU_B_SEQ_T_THREADS_ENABLE", True)) - if "backend=fiber" in spec: + if spec.satisfies("backend=fiber"): args.append(self.define("ALPAKA_ACC_CPU_B_SEQ_T_FIBERS_ENABLE", True)) - if "backend=tbb" in spec: + if spec.satisfies("backend=tbb"): args.append(self.define("ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLE", True)) - if "backend=omp2_gridblock" in spec: + if spec.satisfies("backend=omp2_gridblock"): args.append(self.define("ALPAKA_ACC_CPU_B_OMP2_T_SEQ_ENABLE", True)) - if "backend=omp2_blockthread" in spec: + if spec.satisfies("backend=omp2_blockthread"): args.append(self.define("ALPAKA_ACC_CPU_B_SEQ_T_OMP2_ENABLE", True)) - if "backend=omp5" in spec: + if spec.satisfies("backend=omp5"): args.append(self.define("ALPAKA_ACC_ANY_BT_OMP5_ENABLE", True)) - if "backend=oacc" in spec: + if spec.satisfies("backend=oacc"): args.append(self.define("ALPAKA_ACC_ANY_BT_OACC_ENABLE", True)) - if "backend=cuda" in spec: + if spec.satisfies("backend=cuda"): args.append(self.define("ALPAKA_ACC_GPU_CUDA_ENABLE", True)) - if "backend=cuda_only" in spec: + if spec.satisfies("backend=cuda_only"): args.append(self.define("ALPAKA_ACC_GPU_CUDA_ENABLE", True)) args.append(self.define("ALPAKA_ACC_GPU_CUDA_ONLY_MODE", True)) - if "backend=hip" in spec: + if spec.satisfies("backend=hip"): args.append(self.define("ALPAKA_ACC_GPU_HIP_ENABLE", True)) - if "backend=hip_only" in spec: + if spec.satisfies("backend=hip_only"): args.append(self.define("ALPAKA_ACC_GPU_HIP_ENABLE", True)) args.append(self.define("ALPAKA_ACC_GPU_HIP_ONLY_MODE", True)) diff --git a/var/spack/repos/builtin/packages/amdfftw/package.py b/var/spack/repos/builtin/packages/amdfftw/package.py index 3d5891c46e..6ac400a013 100644 --- a/var/spack/repos/builtin/packages/amdfftw/package.py +++ b/var/spack/repos/builtin/packages/amdfftw/package.py @@ -165,11 +165,11 @@ class Amdfftw(FftwBase): # Dynamic dispatcher builds a single portable optimized library # that can execute on different x86 CPU architectures. # It is supported for GCC compiler and Linux based systems only. - if "+amd-dynamic-dispatcher" in spec: + if spec.satisfies("+amd-dynamic-dispatcher"): options.append("--enable-dynamic-dispatcher") # Check if compiler is AOCC - if "%aocc" in spec: + if spec.satisfies("%aocc"): options.append("CC={0}".format(os.path.basename(spack_cc))) options.append("FC={0}".format(os.path.basename(spack_fc))) options.append("F77={0}".format(os.path.basename(spack_fc))) @@ -186,10 +186,10 @@ class Amdfftw(FftwBase): "https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf" ) - if "+debug" in spec: + if spec.satisfies("+debug"): options.append("--enable-debug") - if "+mpi" in spec: + if spec.satisfies("+mpi"): options.append("--enable-mpi") options.append("--enable-amd-mpifft") else: @@ -223,7 +223,7 @@ class Amdfftw(FftwBase): simd_features = ["sse2", "avx", "avx2", "avx512"] # "avx512" is supported from amdfftw 4.0 version onwards - if "@2.2:3.2" in self.spec: + if self.spec.satisfies("@2.2:3.2"): simd_features.remove("avx512") simd_options = [] diff --git a/var/spack/repos/builtin/packages/amg2013/package.py b/var/spack/repos/builtin/packages/amg2013/package.py index adbe89e12f..b09a82400f 100644 --- a/var/spack/repos/builtin/packages/amg2013/package.py +++ b/var/spack/repos/builtin/packages/amg2013/package.py @@ -39,15 +39,15 @@ class Amg2013(MakefilePackage): include_cflags = ["-DTIMER_USE_MPI"] include_lflags = ["-lm"] - if "+openmp" in self.spec: + if self.spec.satisfies("+openmp"): include_cflags.append("-DHYPRE_USING_OPENMP") include_cflags.append(self.compiler.openmp_flag) include_lflags.append(self.compiler.openmp_flag) - if "+optflags" in self.spec: + if self.spec.satisfies("+optflags"): include_cflags.append("-DHYPRE_USING_PERSISTENT_COMM") include_cflags.append("-DHYPRE_HOPSCOTCH") - if "+int64" in self.spec: + if self.spec.satisfies("+int64"): include_cflags.append("-DHYPRE_BIGINT") targets.append(f"INCLUDE_CFLAGS={' '.join(include_cflags)}") diff --git a/var/spack/repos/builtin/packages/amgx/package.py b/var/spack/repos/builtin/packages/amgx/package.py index 332cc3cd9e..cf71a11353 100644 --- a/var/spack/repos/builtin/packages/amgx/package.py +++ b/var/spack/repos/builtin/packages/amgx/package.py @@ -45,7 +45,7 @@ class Amgx(CMakePackage, CudaPackage): args = [] args.append("-DCMAKE_NO_MPI={0}".format("1" if "+mpi" not in self.spec else "0")) - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): args.append("-DWITH_CUDA=ON") cuda_arch = self.spec.variants["cuda_arch"].value if cuda_arch != "none": @@ -53,10 +53,10 @@ class Amgx(CMakePackage, CudaPackage): else: args.append("-DWITH_CUDA=OFF") - if "+mkl" in self.spec: + if self.spec.satisfies("+mkl"): args.append("-DMKL_ROOT_DIR={0}".format(self.spec["mkl"].prefix)) - if "+magma" in self.spec: + if self.spec.satisfies("+magma"): args.append("-DMAGMA_ROOT_DIR={0}".format(self.spec["magma"].prefix)) return args diff --git a/var/spack/repos/builtin/packages/amp/package.py b/var/spack/repos/builtin/packages/amp/package.py index 340b473bac..1ef74a1aef 100644 --- a/var/spack/repos/builtin/packages/amp/package.py +++ b/var/spack/repos/builtin/packages/amp/package.py @@ -70,7 +70,7 @@ class Amp(CMakePackage): self.define("USE_MPI", "0"), ] - if "+mpi" in spec: + if spec.satisfies("+mpi"): options.extend( [ self.define("CMAKE_C_COMPILER", spec["mpi"].mpicc), @@ -101,7 +101,7 @@ class Amp(CMakePackage): ] ) - if "+zlib" in spec: + if spec.satisfies("+zlib"): tpl_list.append("ZLIB") options.append(self.define("TPL_ZLIB_INSTALL_DIR", spec["zlib-api"].prefix)) @@ -119,7 +119,7 @@ class Amp(CMakePackage): tpl_list.append(vname.upper()) options.append(self.define(f"TPL_{vname.upper()}_INSTALL_DIR", spec[vname].prefix)) - if "+netcdf" in spec: + if spec.satisfies("+netcdf"): tpl_list.append("NETCDF") options.append(self.define("TPL_NETCDF_INSTALL_DIR", spec["netcdf-c"].prefix)) diff --git a/var/spack/repos/builtin/packages/amrex/package.py b/var/spack/repos/builtin/packages/amrex/package.py index 62813b5681..564fc84955 100644 --- a/var/spack/repos/builtin/packages/amrex/package.py +++ b/var/spack/repos/builtin/packages/amrex/package.py @@ -292,20 +292,20 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): if self.spec.satisfies("%fj"): args.append("-DCMAKE_Fortran_MODDIR_FLAG=-M") - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): args.append("-DAMReX_GPU_BACKEND=CUDA") args.append("-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON") args.append("-DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON") cuda_arch = self.spec.variants["cuda_arch"].value args.append("-DAMReX_CUDA_ARCH=" + self.get_cuda_arch_string(cuda_arch)) - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): args.append("-DCMAKE_CXX_COMPILER={0}".format(self.spec["hip"].hipcc)) args.append("-DAMReX_GPU_BACKEND=HIP") targets = self.spec.variants["amdgpu_target"].value args.append("-DAMReX_AMD_ARCH=" + ";".join(str(x) for x in targets)) - if "+sycl" in self.spec: + if self.spec.satisfies("+sycl"): args.append("-DAMReX_GPU_BACKEND=SYCL") # SYCL GPU backend only supported with Intel's oneAPI or DPC++ compilers sycl_compatible_compilers = ["icpx"] @@ -344,7 +344,7 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): if self.spec.satisfies("%fj"): args.append("-DCMAKE_Fortran_MODDIR_FLAG=-M") - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): cuda_arch = self.spec.variants["cuda_arch"].value args.append("-DCUDA_ARCH=" + self.get_cuda_arch_string(cuda_arch)) @@ -365,11 +365,11 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): args = ["-S{0}".format(join_path(".", "cache", "amrex", "Tests", "SpackSmokeTest"))] args.append("-DAMReX_ROOT=" + self.prefix) - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): args.append("-DMPI_C_COMPILER=" + self.spec["mpi"].mpicc) args.append("-DMPI_CXX_COMPILER=" + self.spec["mpi"].mpicxx) - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): args.append("-DCMAKE_CUDA_COMPILER=" + join_path(self.spec["cuda"].prefix.bin, "nvcc")) args.extend(self.cmake_args()) diff --git a/var/spack/repos/builtin/packages/amrvis/package.py b/var/spack/repos/builtin/packages/amrvis/package.py index 8732d86001..e05668483d 100644 --- a/var/spack/repos/builtin/packages/amrvis/package.py +++ b/var/spack/repos/builtin/packages/amrvis/package.py @@ -148,7 +148,7 @@ class Amrvis(MakefilePackage): # We don't want an AMREX_HOME the user may have set already env.unset("AMREX_HOME") # Help force Amrvis to not pick up random system compilers - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): env.set("MPI_HOME", self.spec["mpi"].prefix) env.set("CC", self.spec["mpi"].mpicc) env.set("CXX", self.spec["mpi"].mpicxx) diff --git a/var/spack/repos/builtin/packages/ams/package.py b/var/spack/repos/builtin/packages/ams/package.py index b59d6e00c3..4f62c16454 100644 --- a/var/spack/repos/builtin/packages/ams/package.py +++ b/var/spack/repos/builtin/packages/ams/package.py @@ -114,31 +114,31 @@ class Ams(CMakePackage, CudaPackage): ) ) - if "+verbose" in spec: + if spec.satisfies("+verbose"): args.append("-DWITH_AMS_DEBUG=On") - if "+hdf5" in spec: + if spec.satisfies("+hdf5"): args.append("-DWITH_HDF5=On") args.append("-DHDF5_Dir={0}".format(spec["hdf5"].prefix)) - if "+cuda" in spec: + if spec.satisfies("+cuda"): args.append("-DWITH_CUDA=On") cuda_arch = spec.variants["cuda_arch"].value[0] args.append("-DAMS_CUDA_ARCH={0}".format(cuda_arch)) - if "+caliper" in spec: + if spec.satisfies("+caliper"): args.append("-DWITH_CALIPER=On") args.append("-DCALIPER_DIR={0}/share/cmake/caliper".format(spec["caliper"].prefix)) else: args.append("-DWITH_CALIPER=Off") - if "+faiss" in spec: + if spec.satisfies("+faiss"): args.append("-DWITH_FAISS=On") args.append("-DFAISS_DIR={0}".format(spec["faiss"].prefix)) else: args.append("-DWITH_FAISS=Off") - if "+torch" in spec: + if spec.satisfies("+torch"): args.append("-DWITH_TORCH=On") args.append( "-DTorch_DIR={0}/lib/python{1}/site-packages" @@ -147,15 +147,15 @@ class Ams(CMakePackage, CudaPackage): ) ) - if "+redis" in spec: + if spec.satisfies("+redis"): args.append("-DWITH_REDIS=On") args.append("-DREDIS_PLUS_PLUS_DIR={0}".format(spec["redis-plus-plus"].prefix)) - if "+rabbitmq" in spec: + if spec.satisfies("+rabbitmq"): args.append("-DWITH_RMQ=On") args.append("-Damqpcpp_DIR={0}/cmake".format(spec["amqp-cpp"].prefix)) - if "+examples" in spec: + if spec.satisfies("+examples"): args.append("-DWITH_EXAMPLES=On") args.append("-DMFEM_DIR={0}".format(spec["mfem"].prefix)) diff --git a/var/spack/repos/builtin/packages/aocc/package.py b/var/spack/repos/builtin/packages/aocc/package.py index db3d1d3755..09ca523fff 100644 --- a/var/spack/repos/builtin/packages/aocc/package.py +++ b/var/spack/repos/builtin/packages/aocc/package.py @@ -80,7 +80,7 @@ class Aocc(Package, CompilerPackage): @run_before("install") def license_reminder(self): - if "+license-agreed" in self.spec: + if self.spec.satisfies("+license-agreed"): tty.msg( "Reminder: by setting +license-agreed you are confirming you agree to the terms " "of the {0} EULA (found at {1})".format(self.spec.name, self.license_url) diff --git a/var/spack/repos/builtin/packages/aocl-compression/package.py b/var/spack/repos/builtin/packages/aocl-compression/package.py index 70ce6a6fdf..b40854b23f 100644 --- a/var/spack/repos/builtin/packages/aocl-compression/package.py +++ b/var/spack/repos/builtin/packages/aocl-compression/package.py @@ -92,21 +92,21 @@ class AoclCompression(CMakePackage): "-DLZ4_FRAME_FORMAT_SUPPORT=ON", "-DAOCL_LZ4HC_DISABLE_PATTERN_ANALYSIS=ON", ] - if "~shared" in spec: + if spec.satisfies("~shared"): args.append("-DBUILD_STATIC_LIBS=ON") - if "~zlib" in spec: + if spec.satisfies("~zlib"): args.append("-DAOCL_EXCLUDE_ZLIB=ON") - if "~bzip2" in spec: + if spec.satisfies("~bzip2"): args.append("-DAOCL_EXCLUDE_BZIP2=ON") - if "~snappy" in spec: + if spec.satisfies("~snappy"): args.append("-DAOCL_EXCLUDE_SNAPPY=ON") - if "~zstd" in spec: + if spec.satisfies("~zstd"): args.append("-DAOCL_EXCLUDE_ZSTD=ON") - if "~lzma" in spec: + if spec.satisfies("~lzma"): args.append("-DAOCL_EXCLUDE_LZMA=ON") - if "~lz4" in spec: + if spec.satisfies("~lz4"): args.append("-DAOCL_EXCLUDE_LZ4=ON") - if "~lz4hc" in spec: + if spec.satisfies("~lz4hc"): args.append("-DAOCL_EXCLUDE_LZ4HC=ON") return args diff --git a/var/spack/repos/builtin/packages/aocl-sparse/package.py b/var/spack/repos/builtin/packages/aocl-sparse/package.py index 84ac678142..7d37966e25 100644 --- a/var/spack/repos/builtin/packages/aocl-sparse/package.py +++ b/var/spack/repos/builtin/packages/aocl-sparse/package.py @@ -121,7 +121,7 @@ class AoclSparse(CMakePackage): "-DAOCL_LIBFLAME_INCLUDE_DIR={0}".format(self.spec["amdlibflame"].prefix.include) ) - if "@4.2:" in self.spec: + if self.spec.satisfies("@4.2:"): args.append(f"-DAOCL_UTILS_LIB={self.spec['aocl-utils'].libs}") args.append( "-DAOCL_UTILS_INCLUDE_DIR={0}".format(self.spec["aocl-utils"].prefix.include) diff --git a/var/spack/repos/builtin/packages/apcomp/package.py b/var/spack/repos/builtin/packages/apcomp/package.py index dd2abe442c..90c86f0096 100644 --- a/var/spack/repos/builtin/packages/apcomp/package.py +++ b/var/spack/repos/builtin/packages/apcomp/package.py @@ -99,7 +99,7 @@ class Apcomp(Package): # Find and record what CMake is used ############################################## - if "+cmake" in spec: + if spec.satisfies("+cmake"): cmake_exe = spec["cmake"].command.path else: cmake_exe = which("cmake") @@ -133,17 +133,17 @@ class Apcomp(Package): cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) # shared vs static libs - if "+shared" in spec: + if spec.satisfies("+shared"): cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "ON")) else: cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF")) - if "+openmp" in spec: + if spec.satisfies("+openmp"): cfg.write(cmake_cache_entry("ENABLE_OPENMP", "ON")) else: cfg.write(cmake_cache_entry("ENABLE_OPENMP", "OFF")) - if "+mpi" in spec: + if spec.satisfies("+mpi"): mpicc_path = spec["mpi"].mpicc mpicxx_path = spec["mpi"].mpicxx # if we are using compiler wrappers on cray systems @@ -156,7 +156,7 @@ class Apcomp(Package): cfg.write(cmake_cache_entry("ENABLE_MPI", "ON")) cfg.write(cmake_cache_entry("MPI_C_COMPILER", mpicc_path)) cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", mpicxx_path)) - if "+blt_find_mpi" in spec: + if spec.satisfies("+blt_find_mpi"): cfg.write(cmake_cache_entry("ENABLE_FIND_MPI", "ON")) else: cfg.write(cmake_cache_entry("ENABLE_FIND_MPI", "OFF")) diff --git a/var/spack/repos/builtin/packages/apex/package.py b/var/spack/repos/builtin/packages/apex/package.py index 0660ccbc6c..24aa59a10f 100644 --- a/var/spack/repos/builtin/packages/apex/package.py +++ b/var/spack/repos/builtin/packages/apex/package.py @@ -146,7 +146,7 @@ class Apex(CMakePackage): # CMake variables were updated in version 2.3.0, to make prefix = "APEX_WITH" test_prefix = "APEX_" - if "@2.2.0" in spec: + if spec.satisfies("@2.2.0"): prefix = "USE" test_prefix = "" @@ -167,29 +167,29 @@ class Apex(CMakePackage): args.append(self.define_from_variant(test_prefix + "BUILD_TESTS", "tests")) args.append(self.define_from_variant(test_prefix + "BUILD_EXAMPLES", "examples")) - if "+activeharmony" in spec: + if spec.satisfies("+activeharmony"): args.append("-DACTIVEHARMONY_ROOT={0}".format(spec["activeharmony"].prefix)) - if "+binutils" in spec: + if spec.satisfies("+binutils"): args.append("-DBFD_ROOT={0}".format(spec["binutils"].prefix)) - if "+binutils ^binutils+nls" in spec: + if spec.satisfies("+binutils ^binutils+nls"): if "intl" in self.spec["gettext"].libs.names: args.append("-DCMAKE_SHARED_LINKER_FLAGS=-lintl") - if "+otf2" in spec: + if spec.satisfies("+otf2"): args.append("-DOTF2_ROOT={0}".format(spec["otf2"].prefix)) - if "+papi" in spec: + if spec.satisfies("+papi"): args.append("-DPAPI_ROOT={0}".format(spec["papi"].prefix)) - if "+gperftools" in spec: + if spec.satisfies("+gperftools"): args.append("-DGPERFTOOLS_ROOT={0}".format(spec["gperftools"].prefix)) - if "+jemalloc" in spec: + if spec.satisfies("+jemalloc"): args.append("-DJEMALLOC_ROOT={0}".format(spec["jemalloc"].prefix)) - if "+hip" in spec: + if spec.satisfies("+hip"): args.append("-DROCM_ROOT={0}".format(spec["hip"].prefix)) args.append("-DROCTRACER_ROOT={0}".format(spec["roctracer-dev"].prefix)) args.append("-DROCTX_ROOT={0}".format(spec["roctracer-dev"].prefix)) diff --git a/var/spack/repos/builtin/packages/apr-util/package.py b/var/spack/repos/builtin/packages/apr-util/package.py index bcc127be85..4fba7209e4 100644 --- a/var/spack/repos/builtin/packages/apr-util/package.py +++ b/var/spack/repos/builtin/packages/apr-util/package.py @@ -58,22 +58,22 @@ class AprUtil(AutotoolsPackage): "--without-oracle", ] - if "+crypto" in spec: + if spec.satisfies("+crypto"): args.extend(["--with-crypto", f"--with-openssl={spec['openssl'].prefix}"]) else: args.append("--without-crypto") - if "+gdbm" in spec: + if spec.satisfies("+gdbm"): args.append(f"--with-gdbm={spec['gdbm'].prefix}") else: args.append("--without-gdbm") - if "+pgsql" in spec: + if spec.satisfies("+pgsql"): args.append(f"--with-pgsql={spec['postgresql'].prefix}") else: args.append("--without-pgsql") - if "+sqlite" in spec: + if spec.satisfies("+sqlite"): if spec.satisfies("^sqlite@3.0:3"): args.extend([f"--with-sqlite3={spec['sqlite'].prefix}", "--without-sqlite2"]) elif spec.satisfies("^sqlite@2.0:2"): @@ -81,7 +81,7 @@ class AprUtil(AutotoolsPackage): else: args.extend(["--without-sqlite2", "--without-sqlite3"]) - if "+odbc" in spec: + if spec.satisfies("+odbc"): args.append(f"--with-odbc={spec['unixodbc'].prefix}") else: args.append("--without-odbc") diff --git a/var/spack/repos/builtin/packages/arbor/package.py b/var/spack/repos/builtin/packages/arbor/package.py index c172ee9590..832078c7bd 100644 --- a/var/spack/repos/builtin/packages/arbor/package.py +++ b/var/spack/repos/builtin/packages/arbor/package.py @@ -117,7 +117,7 @@ class Arbor(CMakePackage, CudaPackage): self.define_from_variant("ARB_VECTORIZE", "vectorize"), ] - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): args.append("-DARB_GPU=cuda") args.append(self.define_from_variant("ARB_USE_GPU_RNG", "gpu_rng")) diff --git a/var/spack/repos/builtin/packages/arborx/package.py b/var/spack/repos/builtin/packages/arborx/package.py index 86615c0b37..b49328a32f 100644 --- a/var/spack/repos/builtin/packages/arborx/package.py +++ b/var/spack/repos/builtin/packages/arborx/package.py @@ -115,10 +115,10 @@ class Arborx(CMakePackage, CudaPackage, ROCmPackage): self.define_from_variant("ARBORX_ENABLE_MPI", "mpi"), ] - if "+cuda" in spec: + if spec.satisfies("+cuda"): # Only Kokkos allows '+cuda' for now options.append("-DCMAKE_CXX_COMPILER=%s" % spec["kokkos"].kokkos_cxx) - if "+rocm" in spec: + if spec.satisfies("+rocm"): options.append("-DCMAKE_CXX_COMPILER=%s" % spec["hip"].hipcc) return options @@ -152,7 +152,7 @@ class Arborx(CMakePackage, CudaPackage, ROCmPackage): ), self.define("ArborX_ROOT", self.spec["arborx".prefix]), ] - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): cmake_args.append(self.define("MPI_HOME", self.spec["mpi"].prefix)) cmake = which(self.spec["cmake"].prefix.bin.cmake) make = which("make") diff --git a/var/spack/repos/builtin/packages/argobots/package.py b/var/spack/repos/builtin/packages/argobots/package.py index 95af52ede5..b91ab5d565 100644 --- a/var/spack/repos/builtin/packages/argobots/package.py +++ b/var/spack/repos/builtin/packages/argobots/package.py @@ -53,20 +53,20 @@ class Argobots(AutotoolsPackage): def configure_args(self): args = [] - if "+perf" in self.spec: + if self.spec.satisfies("+perf"): args.append("--enable-perf-opt") - if "+valgrind" in self.spec: + if self.spec.satisfies("+valgrind"): args.append("--enable-valgrind") else: args.append("--disable-valgrind") - if "+debug" in self.spec: + if self.spec.satisfies("+debug"): args.append("--enable-debug=yes") else: args.append("--disable-debug") - if "+stackunwind" in self.spec: + if self.spec.satisfies("+stackunwind"): args.append("--enable-stack-unwind") args.append("--with-libunwind={0}".format(self.spec["libunwind"].prefix)) @@ -74,10 +74,10 @@ class Argobots(AutotoolsPackage): if stackguard != "none": args.append("--enable-stack-overflow-check={0}".format(stackguard)) - if "+tool" in self.spec: + if self.spec.satisfies("+tool"): args.append("--enable-tool") - if "+affinity" in self.spec: + if self.spec.satisfies("+affinity"): args.append("--enable-affinity") return args diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py index 4036f6f8a6..06435b9248 100644 --- a/var/spack/repos/builtin/packages/arpack-ng/package.py +++ b/var/spack/repos/builtin/packages/arpack-ng/package.py @@ -110,7 +110,7 @@ class ArpackNg(CMakePackage, AutotoolsPackage): # query_parameters = self.spec.last_query.extra_parameters libraries = ["libarpack"] - if "+mpi" in self.spec: + if self.spec.satisfies("+mpi"): libraries = ["libparpack"] + libraries return find_libraries(libraries, root=self.prefix, shared=True, recursive=True) @@ -160,7 +160,7 @@ class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder): + self.enable_or_disable("shared") ) - if "+mpi" in spec: + if spec.satisfies("+mpi"): options.append(f"F77={spec['mpi'].mpif77}") return options diff --git a/var/spack/repos/builtin/packages/arrayfire/package.py b/var/spack/repos/builtin/packages/arrayfire/package.py index d934ae78a0..2e67af18d1 100644 --- a/var/spack/repos/builtin/packages/arrayfire/package.py +++ b/var/spack/repos/builtin/packages/arrayfire/package.py @@ -80,7 +80,7 @@ class Arrayfire(CMakePackage, CudaPackage): ] ) - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): arch_list = [ "{}.{}".format(arch[:-1], arch[-1]) for arch in self.spec.variants["cuda_arch"].value diff --git a/var/spack/repos/builtin/packages/ascent/package.py b/var/spack/repos/builtin/packages/ascent/package.py index 32fd20a20a..4bc1c8922e 100644 --- a/var/spack/repos/builtin/packages/ascent/package.py +++ b/var/spack/repos/builtin/packages/ascent/package.py @@ -396,7 +396,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### c_compiler = env["SPACK_CC"] cpp_compiler = env["SPACK_CXX"] - if "+fortran" in spec: + if spec.satisfies("+fortran"): f_compiler = env["SPACK_FC"] else: f_compiler = None @@ -414,7 +414,7 @@ class Ascent(CMakePackage, CudaPackage): # Find and record what CMake is used ############################################## - if "+cmake" in spec: + if spec.satisfies("+cmake"): cmake_exe = spec["cmake"].command.path else: cmake_exe = which("cmake") @@ -449,14 +449,14 @@ class Ascent(CMakePackage, CudaPackage): cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) cfg.write("# fortran compiler used by spack\n") - if "+fortran" in spec: + if spec.satisfies("+fortran"): cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON")) cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", f_compiler)) else: cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF")) # shared vs static libs - if "+shared" in spec: + if spec.satisfies("+shared"): cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "ON")) else: cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF")) @@ -481,7 +481,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### # Unit Tests ####################### - if "+test" in spec: + if spec.satisfies("+test"): cfg.write(cmake_cache_entry("ENABLE_TESTS", "ON")) else: cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF")) @@ -534,7 +534,7 @@ class Ascent(CMakePackage, CudaPackage): # Serial ####################### - if "+serial" in spec: + if spec.satisfies("+serial"): cfg.write(cmake_cache_entry("ENABLE_SERIAL", "ON")) else: cfg.write(cmake_cache_entry("ENABLE_SERIAL", "OFF")) @@ -545,7 +545,7 @@ class Ascent(CMakePackage, CudaPackage): cfg.write("# MPI Support\n") - if "+mpi" in spec: + if spec.satisfies("+mpi"): mpicc_path = spec["mpi"].mpicc mpicxx_path = spec["mpi"].mpicxx mpifc_path = spec["mpi"].mpifc if "+fortran" in spec else None @@ -560,7 +560,7 @@ class Ascent(CMakePackage, CudaPackage): cfg.write(cmake_cache_entry("ENABLE_MPI", "ON")) cfg.write(cmake_cache_entry("MPI_C_COMPILER", mpicc_path)) cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", mpicxx_path)) - if "+fortran" in spec: + if spec.satisfies("+fortran"): cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", mpifc_path)) mpiexe_bin = join_path(spec["mpi"].prefix.bin, "mpiexec") if os.path.isfile(mpiexe_bin): @@ -571,14 +571,14 @@ class Ascent(CMakePackage, CudaPackage): else: cfg.write(cmake_cache_entry("MPIEXEC", mpiexe_bin)) - if "+blt_find_mpi" in spec: + if spec.satisfies("+blt_find_mpi"): cfg.write(cmake_cache_entry("ENABLE_FIND_MPI", "ON")) else: cfg.write(cmake_cache_entry("ENABLE_FIND_MPI", "OFF")) ################################### # BABELFLOW (also depends on mpi) ################################### - if "+babelflow" in spec: + if spec.satisfies("+babelflow"): cfg.write(cmake_cache_entry("ENABLE_BABELFLOW", "ON")) cfg.write(cmake_cache_entry("BabelFlow_DIR", spec["babelflow"].prefix)) cfg.write(cmake_cache_entry("PMT_DIR", spec["parallelmergetree"].prefix)) @@ -591,12 +591,12 @@ class Ascent(CMakePackage, CudaPackage): cfg.write("# CUDA Support\n") - if "+cuda" in spec: + if spec.satisfies("+cuda"): cfg.write(cmake_cache_entry("ENABLE_CUDA", "ON")) else: cfg.write(cmake_cache_entry("ENABLE_CUDA", "OFF")) - if "+openmp" in spec: + if spec.satisfies("+openmp"): cfg.write(cmake_cache_entry("ENABLE_OPENMP", "ON")) else: cfg.write(cmake_cache_entry("ENABLE_OPENMP", "OFF")) @@ -606,7 +606,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### cfg.write("# vtk-h support \n") - if "+vtkh" in spec: + if spec.satisfies("+vtkh"): cfg.write("# vtk-h\n") if self.spec.satisfies("@0.8.1:"): cfg.write(cmake_cache_entry("ENABLE_VTKH", "ON")) @@ -616,7 +616,7 @@ class Ascent(CMakePackage, CudaPackage): cfg.write("# vtk-m from spack\n") cfg.write(cmake_cache_entry("VTKM_DIR", spec["vtk-m"].prefix)) - if "+cuda" in spec: + if spec.satisfies("+cuda"): cfg.write(cmake_cache_entry("VTKm_ENABLE_CUDA", "ON")) cfg.write(cmake_cache_entry("CMAKE_CUDA_HOST_COMPILER", env["SPACK_CXX"])) else: @@ -632,7 +632,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### # RAJA ####################### - if "+raja" in spec: + if spec.satisfies("+raja"): cfg.write("# RAJA from spack \n") cfg.write(cmake_cache_entry("RAJA_DIR", spec["raja"].prefix)) else: @@ -641,7 +641,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### # Umpire ####################### - if "+umpire" in spec: + if spec.satisfies("+umpire"): cfg.write("# umpire from spack \n") cfg.write(cmake_cache_entry("UMPIRE_DIR", spec["umpire"].prefix)) else: @@ -659,7 +659,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### # MFEM ####################### - if "+mfem" in spec: + if spec.satisfies("+mfem"): cfg.write("# mfem from spack \n") cfg.write(cmake_cache_entry("MFEM_DIR", spec["mfem"].prefix)) else: @@ -668,7 +668,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### # OCCA ####################### - if "+occa" in spec: + if spec.satisfies("+occa"): cfg.write("# occa from spack \n") cfg.write(cmake_cache_entry("OCCA_DIR", spec["occa"].prefix)) else: @@ -677,7 +677,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### # Devil Ray ####################### - if "+dray" in spec: + if spec.satisfies("+dray"): cfg.write("# devil ray\n") if self.spec.satisfies("@0.8.1:"): cfg.write(cmake_cache_entry("ENABLE_DRAY", "ON")) @@ -698,7 +698,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### cfg.write("# adios2 support\n") - if "+adios2" in spec: + if spec.satisfies("+adios2"): cfg.write(cmake_cache_entry("ADIOS2_DIR", spec["adios2"].prefix)) else: cfg.write("# adios2 not built by spack \n") @@ -708,7 +708,7 @@ class Ascent(CMakePackage, CudaPackage): ####################### cfg.write("# Fides support\n") - if "+fides" in spec: + if spec.satisfies("+fides"): cfg.write(cmake_cache_entry("FIDES_DIR", spec["fides"].prefix)) else: cfg.write("# fides not built by spack \n") @@ -717,7 +717,7 @@ class Ascent(CMakePackage, CudaPackage): # Caliper ####################### cfg.write("# caliper from spack \n") - if "+caliper" in spec: + if spec.satisfies("+caliper"): cfg.write(cmake_cache_entry("CALIPER_DIR", spec["caliper"].prefix)) cfg.write(cmake_cache_entry("ADIAK_DIR", spec["adiak"].prefix)) else: diff --git a/var/spack/repos/builtin/packages/athena/package.py b/var/spack/repos/builtin/packages/athena/package.py index a49982a0b4..dad789c8da 100644 --- a/var/spack/repos/builtin/packages/athena/package.py +++ b/var/spack/repos/builtin/packages/athena/package.py @@ -185,7 +185,7 @@ class Athena(AutotoolsPackage): env.set("OPT", "-O3") - if "+mpi" in spec: + if spec.satisfies("+mpi"): env.set("CC", spec["mpi"].mpicc) env.set("LDR", spec["mpi"].mpicc) env.set("MPILIB", spec["mpi"].libs.ld_flags) @@ -194,7 +194,7 @@ class Athena(AutotoolsPackage): env.set("CC", spack_cc) env.set("LDR", spack_cc) - if "+fft" in spec: + if spec.satisfies("+fft"): env.set("FFTWLIB", spec["fftw"].libs.ld_flags) env.set("FFTWINC", spec["fftw"].headers.include_flags) @@ -202,82 +202,82 @@ class Athena(AutotoolsPackage): spec = self.spec args = [] - if "+conduction" in spec: + if spec.satisfies("+conduction"): args.append("--enable-conduction") else: args.append("--disable-conduction") - if "+resistivity" in spec: + if spec.satisfies("+resistivity"): args.append("--enable-resistivity") else: args.append("--disable-resistivity") - if "+special_relativity" in spec: + if spec.satisfies("+special_relativity"): args.append("--enable-special-relativity") else: args.append("--disable-special-relativity") - if "+viscosity" in spec: + if spec.satisfies("+viscosity"): args.append("--enable-viscosity") else: args.append("--disable-viscosity") - if "+single" in spec: + if spec.satisfies("+single"): args.append("--enable-single") else: args.append("--disable-single") - if "+ghost" in spec: + if spec.satisfies("+ghost"): args.append("--enable-ghost") else: args.append("--disable-ghost") - if "+mpi" in spec: + if spec.satisfies("+mpi"): args.append("--enable-mpi") else: args.append("--disable-mpi") - if "+h_correction" in spec: + if spec.satisfies("+h_correction"): args.append("--enable-h-correction") else: args.append("--disable-h-correction") - if "+fft" in spec: + if spec.satisfies("+fft"): args.append("--enable-fft") else: args.append("--disable-fft") - if "+shearing_box" in spec: + if spec.satisfies("+shearing_box"): args.append("--enable-shearing-box") else: args.append("--disable-shearing-box") - if "+fargo" in spec: + if spec.satisfies("+fargo"): args.append("--enable-fargo") else: args.append("--disable-fargo") - if "+sts" in spec: + if spec.satisfies("+sts"): args.append("--enable-sts") else: args.append("--disable-sts") - if "+smr" in spec: + if spec.satisfies("+smr"): args.append("--enable-smr") else: args.append("--disable-smr") - if "+fofc" in spec: + if spec.satisfies("+fofc"): args.append("--enable-fofc") else: args.append("--disable-fofc") - if "+rotating_frame" in spec: + if spec.satisfies("+rotating_frame"): args.append("--enable-rotating_frame") else: args.append("--disable-rotating_frame") - if "+l1_inflow" in spec: + if spec.satisfies("+l1_inflow"): args.append("--enable-l1_inflow") else: args.append("--disable-l1_inflow") diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index 026cf000d6..741e5b554c 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -100,7 +100,7 @@ class Atlas(Package): # https://github.com/macports/macports-ports/blob/master/math/atlas/Portfile # https://github.com/Homebrew/homebrew-science/pull/3571 options = [] - if "+shared" in spec: + if spec.satisfies("+shared"): options.extend(["--shared"]) # TODO: for non GNU add '-Fa', 'alg', '-fPIC' ? @@ -129,7 +129,7 @@ class Atlas(Package): make("check") make("ptcheck") make("time") - if "+shared" in spec: + if spec.satisfies("+shared"): with working_dir("lib"): make("shared_all") @@ -143,7 +143,7 @@ class Atlas(Package): # serial BLAS), and all ATLAS symbols needed to support them. Whereas # libtatlas.[so,dylib,dll ] is parallel (multithreaded) version. is_threaded = self.spec.satisfies("threads=pthreads") - if "+shared" in self.spec: + if self.spec.satisfies("+shared"): to_find = ["libtatlas"] if is_threaded else ["libsatlas"] shared = True else: diff --git a/var/spack/repos/builtin/packages/augustus/package.py b/var/spack/repos/builtin/packages/augustus/package.py index 6a28651cee..bfba305f62 100644 --- a/var/spack/repos/builtin/packages/augustus/package.py +++ b/var/spack/repos/builtin/packages/augustus/package.py @@ -69,7 +69,7 @@ class Augustus(MakefilePackage): def edit(self, spec, prefix): # Set compile commands for each compiler and # Fix for using 'boost' on Spack. (only after ver.3.3.1-tag1) - if "@3.3.1-tag1:3.4.0" in spec: + if spec.satisfies("@3.3.1-tag1:3.4.0"): with working_dir(join_path("auxprogs", "utrrnaseq", "Debug")): filter_file("g++", spack_cxx, "makefile", string=True) filter_file( @@ -108,22 +108,22 @@ class Augustus(MakefilePackage): makefile = FileFilter("Makefile") makefile.filter("BAMTOOLS = .*", f"BAMTOOLS = {bamtools}") makefile.filter("INCLUDES = *", "INCLUDES = -I$(BAMTOOLS)/include/bamtools ") - if "bamtools@2.5:" in spec: + if spec.satisfies("bamtools@2.5:"): makefile.filter( "LIBS = -lbamtools -lz", "LIBS = $(BAMTOOLS)/lib64" "/libbamtools.a -lz" ) - if "bamtools@:2.4" in spec: + if spec.satisfies("bamtools@:2.4"): makefile.filter( "LIBS = -lbamtools -lz", "LIBS = $(BAMTOOLS)/lib/bamtools" "/libbamtools.a -lz" ) with working_dir(join_path("auxprogs", "bam2hints")): makefile = FileFilter("Makefile") makefile.filter("/usr/include/bamtools", f"{bamtools}/include/bamtools") - if "bamtools@2.5:" in spec: + if spec.satisfies("bamtools@2.5:"): makefile.filter( "LIBS = -lbamtools -lz", f"LIBS = {bamtools}/lib64/libbamtools.a -lz" ) - if "bamtools@:2.4" in spec: + if spec.satisfies("bamtools@:2.4"): makefile.filter( "LIBS = -lbamtools -lz", f"LIBS = {bamtools}/lib/bamtools/libbamtools.a -lz" ) @@ -151,7 +151,7 @@ class Augustus(MakefilePackage): with working_dir("src"): makefile = FileFilter("Makefile") makefile.filter(r"/usr/include/mysql\+\+", f"{mysqlpp}/include/mysql++") - if "^mariadb-c-client" in spec: + if spec.satisfies("^mariadb-c-client"): makefile.filter("/usr/include/mysql", f"{mysql}/include/mariadb") else: makefile.filter("/usr/include/mysql", f"{mysql}/include/mysql") @@ -180,10 +180,10 @@ class Augustus(MakefilePackage): htslib = self.spec["htslib"].prefix bamtools = self.spec["bamtools"].prefix - if "@3.4.0" in self.spec: + if self.spec.satisfies("@3.4.0"): env.set("HTSLIBDIR", htslib) - if "@3.5.0:" in self.spec: + if self.spec.satisfies("@3.5.0:"): env.set("HTSLIB_INSTALL_DIR", htslib) env.set("BAMTOOLS_INSTALL_DIR", bamtools) diff --git a/var/spack/repos/builtin/packages/autoconf/package.py b/var/spack/repos/builtin/packages/autoconf/package.py index 94489a1194..939f394b9e 100644 --- a/var/spack/repos/builtin/packages/autoconf/package.py +++ b/var/spack/repos/builtin/packages/autoconf/package.py @@ -84,7 +84,7 @@ class Autoconf(AutotoolsPackage, GNUMirrorPackage): # We save and restore the modification timestamp of the file to prevent # regeneration of the respective man page: with keep_modification_time(patched_file): - if "@2.70:" in self.spec: + if self.spec.satisfies("@2.70:"): shebang_string = "^#! @PERL@" else: shebang_string = "^#! @PERL@ -w" @@ -104,7 +104,7 @@ class Autoconf(AutotoolsPackage, GNUMirrorPackage): # target will try to rebuild the binaries (filter_file updates the # timestamps) - if "@2.70:" in self.spec: + if self.spec.satisfies("@2.70:"): shebang_string = "#! {0}" else: shebang_string = "#! {0} -w" diff --git a/var/spack/repos/builtin/packages/autogen/package.py b/var/spack/repos/builtin/packages/autogen/package.py index 215e379345..2266205e22 100644 --- a/var/spack/repos/builtin/packages/autogen/package.py +++ b/var/spack/repos/builtin/packages/autogen/package.py @@ -39,7 +39,7 @@ class Autogen(AutotoolsPackage, GNUMirrorPackage): "--disable-nls" ] - if "+xml" in spec: + if spec.satisfies("+xml"): args.append(f"--with-libxml2={spec['libxml2'].prefix}") else: args.append("--without-libxml2") diff --git a/var/spack/repos/builtin/packages/automake/package.py b/var/spack/repos/builtin/packages/automake/package.py index 3e5d07085a..4d5943de06 100644 --- a/var/spack/repos/builtin/packages/automake/package.py +++ b/var/spack/repos/builtin/packages/automake/package.py @@ -45,10 +45,10 @@ class Automake(AutotoolsPackage, GNUMirrorPackage): def patch(self): # The full perl shebang might be too long files_to_be_patched_fmt = "bin/{0}.in" - if "@:1.15.1" in self.spec: + if self.spec.satisfies("@:1.15.1"): files_to_be_patched_fmt = "t/wrap/{0}.in" - if "@1.16.3:" in self.spec: + if self.spec.satisfies("@1.16.3:"): shebang_string = "^#!@PERL@" else: shebang_string = "^#!@PERL@ -w" diff --git a/var/spack/repos/builtin/packages/axom/package.py b/var/spack/repos/builtin/packages/axom/package.py index 9e658373d3..c3ebe66c9d 100644 --- a/var/spack/repos/builtin/packages/axom/package.py +++ b/var/spack/repos/builtin/packages/axom/package.py @@ -243,11 +243,11 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): # Are we on a LLNL system then strip node number hostname = hostname.rstrip("1234567890") special_case = "" - if "+cuda" in self.spec: + if self.spec.satisfies("+cuda"): special_case += "_cuda" - if "~fortran" in self.spec: + if self.spec.satisfies("~fortran"): special_case += "_nofortran" - if "+rocm" in self.spec: + if self.spec.satisfies("+rocm"): special_case += "_hip" return "{0}-{1}-{2}@{3}{4}.cmake".format( hostname, @@ -261,7 +261,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): spec = self.spec entries = super().initconfig_compiler_entries() - if "+fortran" in spec: + if spec.satisfies("+fortran"): entries.append(cmake_cache_option("ENABLE_FORTRAN", True)) if self.is_fortran_compiler("gfortran") and "clang" in self.compiler.cxx: libdir = pjoin(os.path.dirname(os.path.dirname(self.compiler.cxx)), "lib") @@ -282,7 +282,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): entries.append(cmake_cache_string("BLT_CXX_STD", "c++14", "")) # Add optimization flag workaround for Debug builds with cray compiler or newer HIP - if "+rocm" in spec: + if spec.satisfies("+rocm"): entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", "-O1 -g -DNDEBUG")) return entries @@ -291,7 +291,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): spec = self.spec entries = super().initconfig_hardware_entries() - if "+cuda" in spec: + if spec.satisfies("+cuda"): entries.append(cmake_cache_option("ENABLE_CUDA", True)) entries.append(cmake_cache_option("CMAKE_CUDA_SEPARABLE_COMPILATION", True)) @@ -304,7 +304,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): if spec.satisfies("^blt@:0.5.1"): # This is handled internally by BLT now - if "+cpp14" in spec: + if spec.satisfies("+cpp14"): cudaflags += " -std=c++14" else: cudaflags += " -std=c++11" @@ -313,7 +313,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): entries.append("# nvcc does not like gtest's 'pthreads' flag\n") entries.append(cmake_cache_option("gtest_disable_pthreads", True)) - if "+rocm" in spec: + if spec.satisfies("+rocm"): entries.append("#------------------{0}\n".format("-" * 60)) entries.append("# Axom ROCm specifics\n") entries.append("#------------------{0}\n\n".format("-" * 60)) @@ -385,7 +385,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): entries.append(cmake_cache_string("BLT_EXE_LINKER_FLAGS", linker_flags, description)) - if "+shared" in spec: + if spec.satisfies("+shared"): linker_flags = "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath," + libdir entries.append( cmake_cache_string("CMAKE_SHARED_LINKER_FLAGS", linker_flags, description) @@ -440,7 +440,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): spec = self.spec entries = super().initconfig_mpi_entries() - if "+mpi" in spec: + if spec.satisfies("+mpi"): entries.append(cmake_cache_option("ENABLE_MPI", True)) if spec["mpi"].name == "spectrum-mpi": entries.append(cmake_cache_string("BLT_MPI_COMMAND_APPEND", "mpibind")) @@ -496,7 +496,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): else: entries.append("# %s not built\n" % dep.upper()) - if "+profiling" in spec: + if spec.satisfies("+profiling"): dep_dir = get_spec_path(spec, "adiak", path_replacements) entries.append(cmake_cache_path("ADIAK_DIR", dep_dir)) @@ -508,7 +508,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): entries.append(cmake_cache_path("CAMP_DIR", dep_dir)) # SCR does not export it's targets so we need to pull in its dependencies - if "+scr" in spec: + if spec.satisfies("+scr"): dep_dir = get_spec_path(spec, "scr", path_replacements) entries.append(cmake_cache_path("SCR_DIR", dep_dir)) @@ -541,7 +541,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): entries.append("#------------------{0}\n".format("-" * 60)) # Add common prefix to path replacement list - if "+devtools" in spec: + if spec.satisfies("+devtools"): # Grab common devtools root and strip the trailing slash path1 = os.path.realpath(spec["cppcheck"].prefix) path2 = os.path.realpath(spec["doxygen"].prefix) |