From 0cd1d4663ba33158aae43fa7dc99d5832441c5de Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Sat, 14 Feb 2026 15:53:35 +0100 Subject: [PATCH 1/2] repo: which(..., required=True) * `which("x")` returns `Optional[Executable]` * `which("x", required=True)` returns `Executable` Signed-off-by: Harmen Stoppels --- .../builtin/packages/acl/package.py | 2 +- .../builtin/packages/adios2/package.py | 2 +- .../builtin/packages/adms/package.py | 2 +- .../builtin/packages/alpgen/package.py | 4 ++-- .../builtin/packages/amdscalapack/package.py | 2 +- .../builtin/packages/aml/package.py | 4 ++-- .../builtin/packages/amrex/package.py | 6 ++--- .../builtin/packages/anaconda3/package.py | 2 +- .../builtin/packages/ant/package.py | 2 +- .../builtin/packages/aocc/package.py | 2 +- .../builtin/packages/aocl_da/package.py | 2 +- .../builtin/packages/apktool/package.py | 2 +- .../builtin/packages/apr_util/package.py | 2 +- .../builtin/packages/arborx/package.py | 6 ++--- .../builtin/packages/archer/package.py | 4 ++-- .../builtin/packages/aretomo/package.py | 2 +- .../builtin/packages/armpl_gcc/package.py | 2 +- .../builtin/packages/aspera_cli/package.py | 4 ++-- .../builtin/packages/astra/package.py | 2 +- .../builtin/packages/audacious/package.py | 2 +- .../builtin/packages/avizo/package.py | 2 +- .../builtin/packages/bats/package.py | 2 +- .../builtin/packages/bazel/package.py | 2 +- .../builtin/packages/beast_tracer/package.py | 2 +- .../builtin/packages/berkeley_db/package.py | 2 +- .../builtin/packages/berkeleygw/package.py | 2 +- .../builtin/packages/binutils/package.py | 2 +- .../builtin/packages/biobambam2/package.py | 2 +- .../builtin/packages/blast2go/package.py | 2 +- .../builtin/packages/bmake/package.py | 2 +- .../builtin/packages/bolt/package.py | 4 ++-- .../builtin/packages/bracken/package.py | 2 +- .../builtin/packages/bricks/package.py | 4 ++-- .../builtin/packages/brltty/package.py | 2 +- .../spack_repo/builtin/packages/c/package.py | 4 ++-- .../builtin/packages/cairo/package.py | 4 ++-- .../builtin/packages/caliper/package.py | 4 ++-- .../builtin/packages/cgdb/package.py | 2 +- .../builtin/packages/cgdcbxd/package.py | 2 +- .../builtin/packages/chapel/package.py | 4 +--- .../builtin/packages/charliecloud/package.py | 2 +- .../builtin/packages/cln/package.py | 6 ++--- .../builtin/packages/cloverleaf/package.py | 2 +- .../builtin/packages/cmake/package.py | 2 +- .../builtin/packages/cmockery/package.py | 2 +- .../builtin/packages/cni_plugins/package.py | 2 +- .../builtin/packages/codecov/package.py | 2 +- .../builtin/packages/conda4aarch64/package.py | 2 +- .../builtin/packages/cosign/package.py | 2 +- .../builtin/packages/cp2k/package.py | 2 +- .../builtin/packages/cpmd/package.py | 4 ++-- .../builtin/packages/cracklib/package.py | 2 +- .../builtin/packages/cronie/package.py | 2 +- .../builtin/packages/ctpl/package.py | 2 +- .../builtin/packages/cuda/package.py | 2 +- .../builtin/packages/cxx/package.py | 2 +- .../packages/darshan_runtime/package.py | 2 +- .../builtin/packages/darshan_util/package.py | 2 +- .../builtin/packages/dataspaces/package.py | 2 +- .../packages/deconseq_standalone/package.py | 2 +- .../builtin/packages/delta/package.py | 2 +- .../builtin/packages/demuxlet/package.py | 2 +- .../builtin/packages/dicom3tools/package.py | 2 +- .../builtin/packages/distcc/package.py | 2 +- .../builtin/packages/dmd/package.py | 4 ++-- .../builtin/packages/docbook_xml/package.py | 2 +- .../builtin/packages/docbook_xsl/package.py | 2 +- .../builtin/packages/dock/package.py | 4 ++-- .../builtin/packages/dramsim3/package.py | 2 +- .../builtin/packages/drishti/package.py | 2 +- .../builtin/packages/dropwatch/package.py | 2 +- .../builtin/packages/dsqss/package.py | 4 ++-- .../builtin/packages/dssp/package.py | 2 +- .../builtin/packages/dust/package.py | 4 ++-- .../builtin/packages/dyninst/package.py | 2 +- .../builtin/packages/ecflow/package.py | 2 +- .../builtin/packages/eigenexa/package.py | 2 +- .../builtin/packages/elk/package.py | 4 ++-- .../builtin/packages/emacs/package.py | 2 +- .../builtin/packages/enca/package.py | 2 +- .../builtin/packages/eq_r/package.py | 8 ++----- .../builtin/packages/etsf_io/package.py | 2 +- .../builtin/packages/exmcutils/package.py | 2 +- .../builtin/packages/fastdfs/package.py | 2 +- .../builtin/packages/fastqc/package.py | 2 +- .../builtin/packages/fftw/package.py | 2 +- .../builtin/packages/fftx/package.py | 2 +- .../builtin/packages/fipscheck/package.py | 2 +- .../builtin/packages/fleur/package.py | 2 +- .../builtin/packages/flibcpp/package.py | 6 ++--- .../builtin/packages/flux_core/package.py | 4 ++-- .../builtin/packages/flux_pmix/package.py | 2 +- .../builtin/packages/flux_sched/package.py | 4 ++-- .../builtin/packages/flux_security/package.py | 4 ++-- .../builtin/packages/font_util/package.py | 2 +- .../builtin/packages/fontconfig/package.py | 2 +- .../builtin/packages/formetis/package.py | 6 ++--- .../builtin/packages/fortran/package.py | 4 ++-- .../builtin/packages/fortrilinos/package.py | 6 ++--- .../spack_repo/builtin/packages/fq/package.py | 2 +- .../builtin/packages/fsl/package.py | 2 +- .../builtin/packages/fujitsu_fftw/package.py | 4 ++-- .../builtin/packages/fullock/package.py | 2 +- .../builtin/packages/gasnet/package.py | 2 +- .../builtin/packages/gaussian_view/package.py | 2 +- .../builtin/packages/ginkgo/package.py | 6 ++--- .../builtin/packages/glib/package.py | 2 +- .../builtin/packages/glusterfs/package.py | 2 +- .../builtin/packages/gnome_common/package.py | 2 +- .../spack_repo/builtin/packages/go/package.py | 2 +- .../builtin/packages/goshimmer/package.py | 4 ++-- .../builtin/packages/gpi_2/package.py | 8 +++---- .../builtin/packages/gptune/package.py | 9 +++++-- .../builtin/packages/grafana/package.py | 2 +- .../builtin/packages/graphviz/package.py | 2 +- .../builtin/packages/green_seet/package.py | 2 +- .../builtin/packages/grnboost/package.py | 2 +- .../builtin/packages/gtkplus/package.py | 2 +- .../builtin/packages/gtksourceview/package.py | 2 +- .../builtin/packages/h5bench/package.py | 8 ++++--- .../builtin/packages/h5hut/package.py | 2 +- .../builtin/packages/harfbuzz/package.py | 2 +- .../builtin/packages/hdf/package.py | 10 ++++---- .../builtin/packages/hdf5/package.py | 8 +++---- .../builtin/packages/hdf5_blosc/package.py | 2 +- .../builtin/packages/hdfview/package.py | 4 ++-- .../builtin/packages/heffte/package.py | 4 ++-- .../builtin/packages/hicup/package.py | 4 ++-- .../builtin/packages/hiop/package.py | 2 +- .../builtin/packages/hip_tests/package.py | 2 +- .../builtin/packages/hipsolver/package.py | 2 +- .../builtin/packages/homer/package.py | 2 +- .../builtin/packages/hpctoolkit/package.py | 6 ++--- .../builtin/packages/hsakmt_roct/package.py | 4 ++-- .../builtin/packages/hub/package.py | 2 +- .../builtin/packages/hunspell/package.py | 2 +- .../builtin/packages/hyperqueue/package.py | 2 +- .../builtin/packages/hypre/package.py | 2 +- .../builtin/packages/hypre_cmake/package.py | 4 ++-- .../builtin/packages/icarus/package.py | 2 +- .../builtin/packages/iegenlib/package.py | 2 +- .../packages/improved_rdock/package.py | 8 +++---- .../intel_oneapi_compilers/package.py | 2 +- .../builtin/packages/interproscan/package.py | 8 +++---- .../builtin/packages/isoquant/package.py | 2 +- .../builtin/packages/kallisto/package.py | 2 +- .../builtin/packages/kmod/package.py | 2 +- .../builtin/packages/krakenuniq/package.py | 2 +- .../builtin/packages/krb5/package.py | 2 +- .../builtin/packages/latex2html/package.py | 4 ++-- .../builtin/packages/legion/package.py | 6 ++--- .../builtin/packages/lhapdfsets/package.py | 4 ++-- .../builtin/packages/libabigail/package.py | 2 +- .../builtin/packages/libbeagle/package.py | 2 +- .../builtin/packages/libcatalyst/package.py | 2 +- .../builtin/packages/libcircle/package.py | 2 +- .../builtin/packages/libconfuse/package.py | 2 +- .../builtin/packages/libcxi/package.py | 2 +- .../builtin/packages/libfabric/package.py | 2 +- .../builtin/packages/libfastcommon/package.py | 2 +- .../builtin/packages/libgeopm/package.py | 2 +- .../builtin/packages/libgeopmd/package.py | 2 +- .../builtin/packages/libgridxc/package.py | 2 +- .../builtin/packages/libharu/package.py | 2 +- .../builtin/packages/libint/package.py | 2 +- .../builtin/packages/libmbim/package.py | 2 +- .../builtin/packages/libnfsidmap/package.py | 2 +- .../builtin/packages/libnsl/package.py | 2 +- .../builtin/packages/libp11/package.py | 2 +- .../builtin/packages/libpam/package.py | 2 +- .../builtin/packages/libpostal/package.py | 2 +- .../builtin/packages/libpressio/package.py | 2 +- .../builtin/packages/libquo/package.py | 2 +- .../builtin/packages/librttopo/package.py | 2 +- .../builtin/packages/libsharp/package.py | 2 +- .../builtin/packages/libsigsegv/package.py | 4 ++-- .../builtin/packages/libtorrent/package.py | 2 +- .../builtin/packages/libunistring/package.py | 4 ++-- .../builtin/packages/libxml2/package.py | 6 ++--- .../builtin/packages/libzmq/package.py | 2 +- .../builtin/packages/llvm/package.py | 2 +- .../builtin/packages/llvm_doe/package.py | 2 +- .../builtin/packages/lp_solve/package.py | 4 ++-- .../builtin/packages/lsof/package.py | 2 +- .../spack_repo/builtin/packages/m4/package.py | 4 ++-- .../builtin/packages/magma/package.py | 4 ++-- .../builtin/packages/maker/package.py | 4 ++-- .../builtin/packages/maqao/package.py | 2 +- .../builtin/packages/mark/package.py | 2 +- .../builtin/packages/mathematica/package.py | 4 ++-- .../builtin/packages/mdsplus/package.py | 2 +- .../builtin/packages/memcached/package.py | 2 +- .../builtin/packages/memkind/package.py | 4 ++-- .../builtin/packages/metis/package.py | 2 +- .../builtin/packages/mfem/package.py | 4 ++-- .../builtin/packages/migraphx/package.py | 3 +-- .../builtin/packages/miniconda3/package.py | 2 +- .../builtin/packages/miniforge3/package.py | 2 +- .../builtin/packages/mitofates/package.py | 2 +- .../builtin/packages/mlhka/package.py | 2 +- .../builtin/packages/mmg/package.py | 2 +- .../builtin/packages/mochi_margo/package.py | 2 +- .../builtin/packages/motif/package.py | 2 +- .../builtin/packages/motioncor2/package.py | 2 +- .../builtin/packages/mpi/package.py | 4 ++-- .../builtin/packages/mpich/package.py | 8 +++---- .../builtin/packages/mptensor/package.py | 4 ++-- .../builtin/packages/mvapich_plus/package.py | 4 ++-- .../builtin/packages/n2p2/package.py | 4 ++-- .../builtin/packages/nalu_wind/package.py | 2 +- .../builtin/packages/navi/package.py | 2 +- .../builtin/packages/nektar/package.py | 2 +- .../packages/netcdf_fortran/package.py | 2 +- .../builtin/packages/netpbm/package.py | 2 +- .../nvidia_container_toolkit/package.py | 2 +- .../packages/nvidia_nsight_systems/package.py | 2 +- .../builtin/packages/nwchem/package.py | 2 +- .../builtin/packages/octopus/package.py | 6 ++--- .../builtin/packages/omega_h/package.py | 6 ++--- .../builtin/packages/ompss_2/package.py | 4 ++-- .../builtin/packages/opencl_clhpp/package.py | 2 +- .../builtin/packages/openmpi/package.py | 6 ++--- .../builtin/packages/openpmd_api/package.py | 2 +- .../builtin/packages/openrasmol/package.py | 8 +++---- .../builtin/packages/pandaseq/package.py | 2 +- .../builtin/packages/papi/package.py | 6 ++--- .../builtin/packages/papyrus/package.py | 4 ++-- .../packages/parallel_netcdf/package.py | 6 ++--- .../builtin/packages/parflow/package.py | 4 ++-- .../builtin/packages/parsec/package.py | 2 +- .../builtin/packages/patchelf/package.py | 4 ++-- .../perl_bio_ensembl_variation/package.py | 4 ++-- .../builtin/packages/perl_fth/package.py | 2 +- .../builtin/packages/petsc/package.py | 12 ++++++---- .../builtin/packages/pgplot/package.py | 2 +- .../builtin/packages/php/package.py | 2 +- .../builtin/packages/pinentry/package.py | 2 +- .../builtin/packages/pixman/package.py | 5 +++- .../builtin/packages/plink_ng/package.py | 2 +- .../builtin/packages/ply/package.py | 2 +- .../builtin/packages/pmix/package.py | 2 +- .../builtin/packages/polypolish/package.py | 2 +- .../builtin/packages/povray/package.py | 4 ++-- .../builtin/packages/powerapi/package.py | 2 +- .../builtin/packages/prinseq_lite/package.py | 2 +- .../packages/process_in_process/package.py | 2 +- .../builtin/packages/procps/package.py | 2 +- .../builtin/packages/pscmc/package.py | 2 +- .../builtin/packages/psrcat/package.py | 2 +- .../builtin/packages/pumi/package.py | 4 ++-- .../builtin/packages/py_accimage/package.py | 2 +- .../builtin/packages/py_amrex/package.py | 6 ++--- .../packages/py_cellprofiler/package.py | 2 +- .../builtin/packages/py_chainer/package.py | 2 +- .../builtin/packages/py_cudf/package.py | 2 +- .../builtin/packages/py_darshan/package.py | 2 +- .../packages/py_deepsig_biocomp/package.py | 2 +- .../packages/py_fenics_ffcx/package.py | 2 +- .../builtin/packages/py_fparser/package.py | 2 +- .../builtin/packages/py_fury/package.py | 2 +- .../builtin/packages/py_hail/package.py | 7 +++--- .../builtin/packages/py_horovod/package.py | 2 +- .../packages/py_iterative_stats/package.py | 2 +- .../builtin/packages/py_jcb/package.py | 2 +- .../builtin/packages/py_psyclone/package.py | 2 +- .../builtin/packages/py_ray/package.py | 2 +- .../packages/py_ruamel_yaml/package.py | 2 +- .../packages/py_scikit_build_core/package.py | 2 +- .../packages/py_scikits_odes/package.py | 2 +- .../packages/py_statsmodels/package.py | 2 +- .../py_tensorboard_data_server/package.py | 2 +- .../builtin/packages/py_waves/package.py | 6 ++--- .../builtin/packages/py_wxflow/package.py | 2 +- .../builtin/packages/qperf/package.py | 2 +- .../spack_repo/builtin/packages/qt/package.py | 2 +- .../builtin/packages/qthreads/package.py | 4 ++-- .../builtin/packages/qucs/package.py | 2 +- .../builtin/packages/rccl/package.py | 2 +- .../builtin/packages/reditools/package.py | 4 ++-- .../builtin/packages/repeatmasker/package.py | 2 +- .../builtin/packages/repeatmodeler/package.py | 2 +- .../builtin/packages/rinetd/package.py | 2 +- .../packages/rocm_clang_ocl/package.py | 2 +- .../builtin/packages/rocm_opencl/package.py | 2 +- .../builtin/packages/rocm_smi_lib/package.py | 4 +++- .../builtin/packages/rose/package.py | 8 +++---- .../builtin/packages/routinator/package.py | 2 +- .../builtin/packages/rpm/package.py | 2 +- .../builtin/packages/sbcl/package.py | 4 ++-- .../packages/sbcl_bootstrap/package.py | 2 +- .../builtin/packages/scale/package.py | 4 ++-- .../builtin/packages/sdsl_lite/package.py | 2 +- .../builtin/packages/selalib/package.py | 2 +- .../builtin/packages/siesta/package.py | 4 ++-- .../builtin/packages/skopeo/package.py | 2 +- .../builtin/packages/slate/package.py | 4 ++-- .../builtin/packages/slepc/package.py | 4 ++-- .../builtin/packages/snphylo/package.py | 2 +- .../builtin/packages/sos/package.py | 2 +- .../builtin/packages/spm/package.py | 4 ++-- .../builtin/packages/sqlite/package.py | 2 +- .../builtin/packages/srilm/package.py | 4 ++-- .../builtin/packages/sst_core/package.py | 2 +- .../builtin/packages/sst_elements/package.py | 2 +- .../builtin/packages/sst_macro/package.py | 2 +- .../builtin/packages/stata/package.py | 4 ++-- .../builtin/packages/strumpack/package.py | 4 ++-- .../builtin/packages/sundials/package.py | 4 ++-- .../builtin/packages/superlu/package.py | 4 ++-- .../builtin/packages/superlu_dist/package.py | 2 +- .../builtin/packages/supermagic/package.py | 2 +- .../builtin/packages/swig/package.py | 2 +- .../spack_repo/builtin/packages/sz/package.py | 4 ++-- .../builtin/packages/sz3/package.py | 4 ++-- .../builtin/packages/tasmanian/package.py | 4 ++-- .../builtin/packages/tau/package.py | 24 +++++++++---------- .../builtin/packages/teckit/package.py | 2 +- .../builtin/packages/tempo/package.py | 2 +- .../builtin/packages/tests_sos/package.py | 2 +- .../builtin/packages/texlive/package.py | 2 +- .../builtin/packages/tmux/package.py | 2 +- .../builtin/packages/totalview/package.py | 4 ++-- .../builtin/packages/tpm2_tss/package.py | 2 +- .../builtin/packages/trident/package.py | 2 +- .../builtin/packages/turbine/package.py | 8 ++----- .../builtin/packages/turbomole/package.py | 2 +- .../builtin/packages/uftrace/package.py | 2 +- .../builtin/packages/umoci/package.py | 2 +- .../packages/universal_ctags/package.py | 2 +- .../builtin/packages/upcxx/package.py | 2 +- .../builtin/packages/userspace_rcu/package.py | 2 +- .../builtin/packages/vapor/package.py | 2 +- .../spack_repo/builtin/packages/vc/package.py | 2 +- .../builtin/packages/veclibfort/package.py | 2 +- .../builtin/packages/vep/package.py | 2 +- .../builtin/packages/vep_cache/package.py | 2 +- .../builtin/packages/verible/package.py | 2 +- .../builtin/packages/verrou/package.py | 6 ++--- .../builtin/packages/visit_cgns/package.py | 2 +- .../builtin/packages/visit_ffp/package.py | 2 +- .../builtin/packages/visit_mfem/package.py | 2 +- .../builtin/packages/visit_silo/package.py | 2 +- .../builtin/packages/visit_unv/package.py | 2 +- .../builtin/packages/vizglow/package.py | 2 +- .../builtin/packages/vmd/package.py | 2 +- .../builtin/packages/warpx/package.py | 2 +- .../builtin/packages/watch/package.py | 2 +- .../builtin/packages/whizard/package.py | 2 +- .../builtin/packages/wps/package.py | 2 +- .../builtin/packages/wrf/package.py | 2 +- .../builtin/packages/wsmancli/package.py | 2 +- .../builtin/packages/xabclib/package.py | 2 +- .../builtin/packages/xdelta/package.py | 2 +- .../builtin/packages/xmlf90/package.py | 2 +- .../builtin/packages/yaksa/package.py | 2 +- .../builtin/packages/ycsb/package.py | 4 ++-- .../builtin/packages/zoltan/package.py | 2 +- .../packages/zookeeper_benchmark/package.py | 2 +- .../packages/cmake_client/package.py | 2 +- 359 files changed, 521 insertions(+), 521 deletions(-) diff --git a/repos/spack_repo/builtin/packages/acl/package.py b/repos/spack_repo/builtin/packages/acl/package.py index b9adcb69d9b..f65bfc7391a 100644 --- a/repos/spack_repo/builtin/packages/acl/package.py +++ b/repos/spack_repo/builtin/packages/acl/package.py @@ -37,5 +37,5 @@ def flag_handler(self, name, flags): return self.build_system_flags(name, flags) def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/adios2/package.py b/repos/spack_repo/builtin/packages/adios2/package.py index ba3c70b2edf..441135e6ae9 100644 --- a/repos/spack_repo/builtin/packages/adios2/package.py +++ b/repos/spack_repo/builtin/packages/adios2/package.py @@ -425,7 +425,7 @@ def test_run_executables(self): f"test_run_executables_{cmd}", purpose=f"run installed adios2 executable {cmd}", ): - exe = which(join_path(self.prefix.bin, cmd)) + exe = which(join_path(self.prefix.bin, cmd), required=True) exe(*opts) def test_python(self): diff --git a/repos/spack_repo/builtin/packages/adms/package.py b/repos/spack_repo/builtin/packages/adms/package.py index 4520cc6e851..06539feb81f 100644 --- a/repos/spack_repo/builtin/packages/adms/package.py +++ b/repos/spack_repo/builtin/packages/adms/package.py @@ -33,5 +33,5 @@ class Adms(AutotoolsPackage): @when("@master") def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("./bootstrap.sh") diff --git a/repos/spack_repo/builtin/packages/alpgen/package.py b/repos/spack_repo/builtin/packages/alpgen/package.py index 9f73f9e27bb..7d1df108049 100644 --- a/repos/spack_repo/builtin/packages/alpgen/package.py +++ b/repos/spack_repo/builtin/packages/alpgen/package.py @@ -54,11 +54,11 @@ def patch(self): class MakefileBuilder(makefile.MakefileBuilder): def build(self, pkg, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./cms_build.sh") def install(self, pkg, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./cms_install.sh", prefix) for root, dirs, files in os.walk(prefix): diff --git a/repos/spack_repo/builtin/packages/amdscalapack/package.py b/repos/spack_repo/builtin/packages/amdscalapack/package.py index 8daee86dbc0..91b4592388f 100644 --- a/repos/spack_repo/builtin/packages/amdscalapack/package.py +++ b/repos/spack_repo/builtin/packages/amdscalapack/package.py @@ -63,7 +63,7 @@ def patch(self): filter_file("-cpp", "", "CMakeLists.txt") # remove the C-style comments in header file that cause issues with flang if self.spec.satisfies("@4.2: %clang@18:"): - which("sed")( + which("sed", required=True)( "-i", "1,23d", join_path(self.stage.source_path, "FRAMEWORK", "SL_Context_fortran_include.h"), diff --git a/repos/spack_repo/builtin/packages/aml/package.py b/repos/spack_repo/builtin/packages/aml/package.py index aa8832fc8af..39cd92a0477 100644 --- a/repos/spack_repo/builtin/packages/aml/package.py +++ b/repos/spack_repo/builtin/packages/aml/package.py @@ -122,7 +122,7 @@ def cache_test_sources(self): def test_check_tutorial(self): """Compile and run the tutorial tests as install checks""" - cc = which(os.environ["CC"]) + cc = which(os.environ["CC"], required=True) cc_options = [ "-o", self.smoke_test, @@ -136,6 +136,6 @@ def test_check_tutorial(self): ] cc(*cc_options) - smoke_test = which(self.smoke_test) + smoke_test = which(self.smoke_test, required=True) out = smoke_test(output=str.split, error=str.split) assert "Hello world" in out diff --git a/repos/spack_repo/builtin/packages/amrex/package.py b/repos/spack_repo/builtin/packages/amrex/package.py index 51581f345a6..eb3d922a204 100644 --- a/repos/spack_repo/builtin/packages/amrex/package.py +++ b/repos/spack_repo/builtin/packages/amrex/package.py @@ -459,13 +459,13 @@ def test_run_install_test(self): args.append("-DCMAKE_PREFIX_PATH=" + ";".join(get_cmake_prefix_path(self))) args.extend(self.cmake_args()) - cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) cmake(*args) - make = which("make") + make = which("make", required=True) make() - install_test = which("install_test") + install_test = which("install_test", required=True) inputs_path = join_path( ".", "cache", "amrex", "Tests", "Amr", "Advection_AmrCore", "Exec", "inputs-ci" ) diff --git a/repos/spack_repo/builtin/packages/anaconda3/package.py b/repos/spack_repo/builtin/packages/anaconda3/package.py index bf3f5ae785b..e76d2d141b9 100644 --- a/repos/spack_repo/builtin/packages/anaconda3/package.py +++ b/repos/spack_repo/builtin/packages/anaconda3/package.py @@ -219,7 +219,7 @@ def url_for_version(self, version): def install(self, spec, prefix): dir, anaconda_script = split(self.stage.archive_file) - bash = which("bash") + bash = which("bash", required=True) bash(anaconda_script, "-b", "-f", "-p", self.prefix) def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/ant/package.py b/repos/spack_repo/builtin/packages/ant/package.py index ea2c111aaa6..51f000b98db 100644 --- a/repos/spack_repo/builtin/packages/ant/package.py +++ b/repos/spack_repo/builtin/packages/ant/package.py @@ -25,5 +25,5 @@ class Ant(Package): def install(self, spec, prefix): env["ANT_HOME"] = self.prefix - bash = which("bash") + bash = which("bash", required=True) bash("./build.sh", "install-lite") diff --git a/repos/spack_repo/builtin/packages/aocc/package.py b/repos/spack_repo/builtin/packages/aocc/package.py index c070d9baedc..e5d86b18b50 100644 --- a/repos/spack_repo/builtin/packages/aocc/package.py +++ b/repos/spack_repo/builtin/packages/aocc/package.py @@ -131,7 +131,7 @@ def cfg_files(self): if self.spec.satisfies("@:5 %gcc") and self.compiler.prefix != "/usr": # help flang{1,2} find libquadmath libdir = self._libquadmath_dir() - patchelf = which("patchelf") + patchelf = which("patchelf", required=True) patchelf.add_default_arg("--set-rpath", libdir) patchelf(join_path(self.prefix.bin, "flang1")) patchelf(join_path(self.prefix.bin, "flang2")) diff --git a/repos/spack_repo/builtin/packages/aocl_da/package.py b/repos/spack_repo/builtin/packages/aocl_da/package.py index 609c45d6b5a..7f5a946dc1f 100644 --- a/repos/spack_repo/builtin/packages/aocl_da/package.py +++ b/repos/spack_repo/builtin/packages/aocl_da/package.py @@ -128,7 +128,7 @@ def cmake_args(self): @on_package_attributes(run_tests=True) def test_python(self): """Perform smoke tests on the installed package.""" - pytest = which("pytest") + pytest = which("pytest", required=True) envmod = EnvironmentModifications() envmod.append_path("PYTHONPATH", join_path(self.prefix, "python_package")) pytest.add_default_envmod(envmod) diff --git a/repos/spack_repo/builtin/packages/apktool/package.py b/repos/spack_repo/builtin/packages/apktool/package.py index 3f59963b5d0..45a07a75665 100644 --- a/repos/spack_repo/builtin/packages/apktool/package.py +++ b/repos/spack_repo/builtin/packages/apktool/package.py @@ -28,7 +28,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def install(self, spec, prefix): gradlew = Executable("./gradlew") gradlew("--info", "--debug", "build", "shadowJar") - ln = which("ln") + ln = which("ln", required=True) mkdir(join_path(prefix, "bin")) install( join_path("brut.apktool", "apktool-cli", "build", "libs", "apktool-cli-all.jar"), diff --git a/repos/spack_repo/builtin/packages/apr_util/package.py b/repos/spack_repo/builtin/packages/apr_util/package.py index da047ce8b82..b57f1319008 100644 --- a/repos/spack_repo/builtin/packages/apr_util/package.py +++ b/repos/spack_repo/builtin/packages/apr_util/package.py @@ -91,7 +91,7 @@ def configure_args(self): if spec.satisfies("+crypto ^openssl~shared"): # Need pkg-config to get zlib and -ldl flags # (see https://dev.apr.apache.narkive.com/pNnO9F1S/configure-bug-openssl) - pkgconf = which("pkg-config") + pkgconf = which("pkg-config", required=True) ssl_libs = pkgconf("--libs", "--static", "openssl", output=str) args.append(f"LIBS={ssl_libs}") diff --git a/repos/spack_repo/builtin/packages/arborx/package.py b/repos/spack_repo/builtin/packages/arborx/package.py index ffaa960420e..5b9ca87fc2a 100644 --- a/repos/spack_repo/builtin/packages/arborx/package.py +++ b/repos/spack_repo/builtin/packages/arborx/package.py @@ -156,9 +156,9 @@ def test_run_ctest(self): ] 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") - ctest = which("ctest") + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) + make = which("make", required=True) + ctest = which("ctest", required=True) with working_dir(self.cached_tests_work_dir): cmake(*cmake_args) diff --git a/repos/spack_repo/builtin/packages/archer/package.py b/repos/spack_repo/builtin/packages/archer/package.py index 75b7c4d4a58..1e689ad9b3c 100644 --- a/repos/spack_repo/builtin/packages/archer/package.py +++ b/repos/spack_repo/builtin/packages/archer/package.py @@ -62,8 +62,8 @@ def test_run_parallel_example(self): test_exe = "parallel-simple" test_src = f"{test_exe}.c" with working_dir(test_dir): - clang = which("clang-archer") + clang = which("clang-archer", required=True) clang("-o", test_exe, test_src) - parallel_simple = which(test_exe) + parallel_simple = which(test_exe, required=True) parallel_simple() diff --git a/repos/spack_repo/builtin/packages/aretomo/package.py b/repos/spack_repo/builtin/packages/aretomo/package.py index 46e9f54769f..72d6109917f 100644 --- a/repos/spack_repo/builtin/packages/aretomo/package.py +++ b/repos/spack_repo/builtin/packages/aretomo/package.py @@ -43,7 +43,7 @@ def install(self, spec, prefix): @run_after("install") def ensure_rpaths(self): - patchelf = which("patchelf") + patchelf = which("patchelf", required=True) patchelf( "--set-rpath", self.spec["cuda"].prefix.lib64, join_path(self.prefix.bin, "AreTomo") ) diff --git a/repos/spack_repo/builtin/packages/armpl_gcc/package.py b/repos/spack_repo/builtin/packages/armpl_gcc/package.py index 302274052b1..a0cf9e43b3c 100644 --- a/repos/spack_repo/builtin/packages/armpl_gcc/package.py +++ b/repos/spack_repo/builtin/packages/armpl_gcc/package.py @@ -430,7 +430,7 @@ class ArmplGcc(Package): # Run the installer with the desired install directory def install(self, spec, prefix): if spec.platform == "darwin": - hdiutil = which("hdiutil") + hdiutil = which("hdiutil", required=True) # Mount image mountpoint = os.path.join(self.stage.path, "mount") if spec.satisfies("@:23"): diff --git a/repos/spack_repo/builtin/packages/aspera_cli/package.py b/repos/spack_repo/builtin/packages/aspera_cli/package.py index 3e1f5541465..e03e7da8e91 100644 --- a/repos/spack_repo/builtin/packages/aspera_cli/package.py +++ b/repos/spack_repo/builtin/packages/aspera_cli/package.py @@ -36,7 +36,7 @@ def install(self, spec, prefix): stop_at="__ARCHIVE_FOLLOWS__", ) # Install - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", runfile) - runfile = which(runfile) + runfile = which(runfile, required=True) runfile() diff --git a/repos/spack_repo/builtin/packages/astra/package.py b/repos/spack_repo/builtin/packages/astra/package.py index b24e3991459..4aae15ae562 100644 --- a/repos/spack_repo/builtin/packages/astra/package.py +++ b/repos/spack_repo/builtin/packages/astra/package.py @@ -80,7 +80,7 @@ def install(self, spec, prefix): install("lineplot/lineplot", prefix.bin) install("pgxwin_server/pgxwin_server", prefix.bin) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", join_path(prefix.bin, "Astra")) chmod("+x", join_path(prefix.bin, "generator")) if spec.satisfies("+gui"): diff --git a/repos/spack_repo/builtin/packages/audacious/package.py b/repos/spack_repo/builtin/packages/audacious/package.py index 28eef79d1fa..5b44a0a6486 100644 --- a/repos/spack_repo/builtin/packages/audacious/package.py +++ b/repos/spack_repo/builtin/packages/audacious/package.py @@ -46,7 +46,7 @@ def patch(self): filter_file("-I m4", search_path_str, "autogen.sh") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/avizo/package.py b/repos/spack_repo/builtin/packages/avizo/package.py index 9c4d33794a5..3a13b36681f 100644 --- a/repos/spack_repo/builtin/packages/avizo/package.py +++ b/repos/spack_repo/builtin/packages/avizo/package.py @@ -69,7 +69,7 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: def install(self, spec, prefix): ver = self.version.joined - sh = which("sh") + sh = which("sh", required=True) sh(f"Avizo-{ver}-Linux64-gcc{self.gcc_ver[self.version.string]}.bin", "--noexec", "--keep") with working_dir("Avizo"): diff --git a/repos/spack_repo/builtin/packages/bats/package.py b/repos/spack_repo/builtin/packages/bats/package.py index 23b47acc252..ba8fde76efc 100644 --- a/repos/spack_repo/builtin/packages/bats/package.py +++ b/repos/spack_repo/builtin/packages/bats/package.py @@ -23,5 +23,5 @@ class Bats(Package): ) def install(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./install.sh", prefix) diff --git a/repos/spack_repo/builtin/packages/bazel/package.py b/repos/spack_repo/builtin/packages/bazel/package.py index 5ccf780cfd3..716dc9bc78c 100644 --- a/repos/spack_repo/builtin/packages/bazel/package.py +++ b/repos/spack_repo/builtin/packages/bazel/package.py @@ -233,7 +233,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: @run_before("install") def bootstrap(self): - bash = which("bash") + bash = which("bash", required=True) bash("./compile.sh") def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/beast_tracer/package.py b/repos/spack_repo/builtin/packages/beast_tracer/package.py index 3d5d3448d9e..6cfccbdedbb 100644 --- a/repos/spack_repo/builtin/packages/beast_tracer/package.py +++ b/repos/spack_repo/builtin/packages/beast_tracer/package.py @@ -25,7 +25,7 @@ class BeastTracer(Package): depends_on("java", type=("build", "run")) def install(self, spec, prefix): - ant = which("ant") + ant = which("ant", required=True) ant("dist") mkdirp(prefix.bin) diff --git a/repos/spack_repo/builtin/packages/berkeley_db/package.py b/repos/spack_repo/builtin/packages/berkeley_db/package.py index 502303a1693..53b26d27c4d 100644 --- a/repos/spack_repo/builtin/packages/berkeley_db/package.py +++ b/repos/spack_repo/builtin/packages/berkeley_db/package.py @@ -108,7 +108,7 @@ def check_exe_version(self, exe): if not os.path.exists(installed_exe): raise SkipTest(f"{exe} is not installed") - exe = which(installed_exe) + exe = which(installed_exe, required=True) out = exe("-V", output=str.split, error=str.split) assert self.spec.version.string in out diff --git a/repos/spack_repo/builtin/packages/berkeleygw/package.py b/repos/spack_repo/builtin/packages/berkeleygw/package.py index 2cf1d1178a8..dacad65ae9e 100644 --- a/repos/spack_repo/builtin/packages/berkeleygw/package.py +++ b/repos/spack_repo/builtin/packages/berkeleygw/package.py @@ -110,7 +110,7 @@ class Berkeleygw(MakefilePackage): def edit(self, spec, prefix): # archive is a tar file, despite the .gz expension - tar = which("tar") + tar = which("tar", required=True) tar("-x", "-o", "-f", self.stage.archive_file, "--strip-components=1") # get generic arch.mk template diff --git a/repos/spack_repo/builtin/packages/binutils/package.py b/repos/spack_repo/builtin/packages/binutils/package.py index 9d81041f7fc..97fb4ef48c4 100644 --- a/repos/spack_repo/builtin/packages/binutils/package.py +++ b/repos/spack_repo/builtin/packages/binutils/package.py @@ -214,7 +214,7 @@ def test_binaries(self): if not os.path.exists(installed_exe): raise SkipTest("{0} is not installed".format(_bin)) - exe = which(installed_exe) + exe = which(installed_exe, required=True) out = exe("--version", output=str.split, error=str.split) assert version in out diff --git a/repos/spack_repo/builtin/packages/biobambam2/package.py b/repos/spack_repo/builtin/packages/biobambam2/package.py index d849c7baa2a..8876c2c5629 100644 --- a/repos/spack_repo/builtin/packages/biobambam2/package.py +++ b/repos/spack_repo/builtin/packages/biobambam2/package.py @@ -51,6 +51,6 @@ def test_short_sort(self): """run testshortsort.sh to check alignments sorted by coordinate""" test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) with working_dir(test_dir): - sh = which("sh") + sh = which("sh", required=True) out = sh("testshortsort.sh", output=str.split, error=str.split) assert "Alignments sorted by coordinate." in out diff --git a/repos/spack_repo/builtin/packages/blast2go/package.py b/repos/spack_repo/builtin/packages/blast2go/package.py index 6329a90caf2..d4fb34a8394 100644 --- a/repos/spack_repo/builtin/packages/blast2go/package.py +++ b/repos/spack_repo/builtin/packages/blast2go/package.py @@ -42,5 +42,5 @@ def install(self, spec, prefix): f.writelines(config_input_data) with open(config_input_file, "r") as f: - bash = which("bash") + bash = which("bash", required=True) bash("Blast2GO_unix_%s.sh" % self.version.underscored, input=f) diff --git a/repos/spack_repo/builtin/packages/bmake/package.py b/repos/spack_repo/builtin/packages/bmake/package.py index 53d12c91275..4c1fe2b6b43 100644 --- a/repos/spack_repo/builtin/packages/bmake/package.py +++ b/repos/spack_repo/builtin/packages/bmake/package.py @@ -31,7 +31,7 @@ def patch(self): filter_file("GetDir /bmake", "GetDir " + self.stage.source_path, "boot-strap", string=True) def install(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("boot-strap", "op=configure") sh("boot-strap", "op=build") sh("boot-strap", "--prefix={0}".format(prefix), "op=install") diff --git a/repos/spack_repo/builtin/packages/bolt/package.py b/repos/spack_repo/builtin/packages/bolt/package.py index a60dcbd274b..2166666c644 100644 --- a/repos/spack_repo/builtin/packages/bolt/package.py +++ b/repos/spack_repo/builtin/packages/bolt/package.py @@ -71,7 +71,7 @@ def test_sample_nested_example(self): test_dir = os.path.dirname(path) with working_dir(test_dir): - cxx = which(os.environ["CXX"]) + cxx = which(os.environ["CXX"], required=True) cxx( "-L{0}".format(self.prefix.lib), "-I{0}".format(self.prefix.include), @@ -82,5 +82,5 @@ def test_sample_nested_example(self): "-lbolt", ) - sample_nested = which(exe) + sample_nested = which(exe, required=True) sample_nested() diff --git a/repos/spack_repo/builtin/packages/bracken/package.py b/repos/spack_repo/builtin/packages/bracken/package.py index a4b6f529e4a..5d1c9101625 100644 --- a/repos/spack_repo/builtin/packages/bracken/package.py +++ b/repos/spack_repo/builtin/packages/bracken/package.py @@ -31,7 +31,7 @@ class Bracken(Package): def install(self, spec, prefix): mkdirp(prefix.bin.src) # installer builds kmer2read_distr in src - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", "./install_bracken.sh") installer = Executable("./install_bracken.sh") installer(self.stage.source_path) diff --git a/repos/spack_repo/builtin/packages/bricks/package.py b/repos/spack_repo/builtin/packages/bricks/package.py index dd8631249a0..de752e0b201 100644 --- a/repos/spack_repo/builtin/packages/bricks/package.py +++ b/repos/spack_repo/builtin/packages/bricks/package.py @@ -89,10 +89,10 @@ def test_bricklib_example(self): raise SkipTest("{0} is missing".format(source_dir)) with working_dir(source_dir): - cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) cmake(".") cmake("--build", ".") - example = which("example") + example = which("example", required=True) example() diff --git a/repos/spack_repo/builtin/packages/brltty/package.py b/repos/spack_repo/builtin/packages/brltty/package.py index bfb030d6fb7..ccff2fba77c 100644 --- a/repos/spack_repo/builtin/packages/brltty/package.py +++ b/repos/spack_repo/builtin/packages/brltty/package.py @@ -32,5 +32,5 @@ class Brltty(AutotoolsPackage): depends_on("alsa-lib", when="platform=linux", type="link") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("autogen") diff --git a/repos/spack_repo/builtin/packages/c/package.py b/repos/spack_repo/builtin/packages/c/package.py index 054eb51f8e7..fef6c1acef1 100644 --- a/repos/spack_repo/builtin/packages/c/package.py +++ b/repos/spack_repo/builtin/packages/c/package.py @@ -17,7 +17,7 @@ class C(Package): def test_c(self): """build and run C examples""" - cc = which(os.environ["CC"]) + cc = which(os.environ["CC"], required=True) expected = ["Hello world", "YES!"] test_source = self.test_suite.current_test_data_dir @@ -26,6 +26,6 @@ def test_c(self): with test_part(self, f"test_c_{test}", f"build and run {exe_name}"): filepath = join_path(test_source, test) cc("-o", exe_name, filepath) - exe = which(exe_name) + exe = which(exe_name, required=True) out = exe(output=str.split, error=str.split) check_outputs(expected, out) diff --git a/repos/spack_repo/builtin/packages/cairo/package.py b/repos/spack_repo/builtin/packages/cairo/package.py index e510f449b0b..3cacd3f49bb 100644 --- a/repos/spack_repo/builtin/packages/cairo/package.py +++ b/repos/spack_repo/builtin/packages/cairo/package.py @@ -179,7 +179,7 @@ class AutotoolsBuilder(autotools.AutotoolsBuilder): def autoreconf(self, pkg, spec, prefix): # Regenerate, directing the script *not* to call configure before Spack # does - which("sh")("./autogen.sh", extra_env={"NOCONFIGURE": "1"}) + which("sh", required=True)("./autogen.sh", extra_env={"NOCONFIGURE": "1"}) def configure_args(self): args = ["--disable-trace", "--enable-tee"] # can cause problems with libiberty @@ -197,7 +197,7 @@ def configure_args(self): args.extend(self.with_or_without("pic")) if self.spec.satisfies("+ft ^freetype~shared"): - pkgconf = which("pkg-config") + pkgconf = which("pkg-config", required=True) ldflags = pkgconf("--libs-only-L", "--static", "freetype2", output=str) libs = pkgconf("--libs-only-l", "--static", "freetype2", output=str) args.append(f"LDFLAGS={ldflags}") diff --git a/repos/spack_repo/builtin/packages/caliper/package.py b/repos/spack_repo/builtin/packages/caliper/package.py index 5457a2b3b16..dd0c4e7fcf2 100644 --- a/repos/spack_repo/builtin/packages/caliper/package.py +++ b/repos/spack_repo/builtin/packages/caliper/package.py @@ -302,7 +302,7 @@ def test_cxx_example(self): lib_dir = self.prefix.lib if os.path.exists(self.prefix.lib) else self.prefix.lib64 - cxx = which(os.environ["CXX"]) + cxx = which(os.environ["CXX"], required=True) test_dir = os.path.dirname(source_path) with working_dir(test_dir): cxx( @@ -316,5 +316,5 @@ def test_cxx_example(self): "-lstdc++", ) - cxx_example = which(exe) + cxx_example = which(exe, required=True) cxx_example() diff --git a/repos/spack_repo/builtin/packages/cgdb/package.py b/repos/spack_repo/builtin/packages/cgdb/package.py index a8695b56fdc..8d7d451d5cc 100644 --- a/repos/spack_repo/builtin/packages/cgdb/package.py +++ b/repos/spack_repo/builtin/packages/cgdb/package.py @@ -38,7 +38,7 @@ class Cgdb(AutotoolsPackage): @when("@master") def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/cgdcbxd/package.py b/repos/spack_repo/builtin/packages/cgdcbxd/package.py index 0201bdd9f36..be22c263324 100644 --- a/repos/spack_repo/builtin/packages/cgdcbxd/package.py +++ b/repos/spack_repo/builtin/packages/cgdcbxd/package.py @@ -30,7 +30,7 @@ class Cgdcbxd(AutotoolsPackage): depends_on("libmnl") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap.sh") @property diff --git a/repos/spack_repo/builtin/packages/chapel/package.py b/repos/spack_repo/builtin/packages/chapel/package.py index 40dd326e478..3843f0ef97f 100644 --- a/repos/spack_repo/builtin/packages/chapel/package.py +++ b/repos/spack_repo/builtin/packages/chapel/package.py @@ -899,9 +899,7 @@ def test_version(self): path = join_path(self.prefix.bin, exe) if not os.path.isfile(path): raise SkipTest(f"{path} is not installed") - prog = which(path) - if prog is None: - raise RuntimeError(f"Could not find {path}") + prog = which(path, required=True) output = prog("--version", output=str.split, error=str.split) assert expected in output diff --git a/repos/spack_repo/builtin/packages/charliecloud/package.py b/repos/spack_repo/builtin/packages/charliecloud/package.py index 42737fe7aa1..4d9e5c294bd 100644 --- a/repos/spack_repo/builtin/packages/charliecloud/package.py +++ b/repos/spack_repo/builtin/packages/charliecloud/package.py @@ -96,7 +96,7 @@ def force_autoreconf(self): return self.spec.satisfies("@0.39:") def autoreconf(self, spec, prefix): - which("bash")("autogen.sh") + which("bash", required=True)("autogen.sh") def configure_args(self): args = ["--with-python=/usr/bin/env python3"] diff --git a/repos/spack_repo/builtin/packages/cln/package.py b/repos/spack_repo/builtin/packages/cln/package.py index 734ffe06c14..d5259e0457b 100644 --- a/repos/spack_repo/builtin/packages/cln/package.py +++ b/repos/spack_repo/builtin/packages/cln/package.py @@ -60,7 +60,7 @@ def autoreconf(self, spec, prefix): for pkg in aclocal_pkg_list: autoreconf_args += ["-I", os.path.join(spec[pkg].prefix, aclocal_path)] - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf(*autoreconf_args) @run_before("autoreconf") @@ -68,10 +68,10 @@ def force_config_rpath(self): source_directory = self.stage.source_path build_aux_directory = os.path.join(source_directory, "build-aux") - mkdir = which("mkdir") + mkdir = which("mkdir", required=True) mkdir(build_aux_directory) - touch = which("touch") + touch = which("touch", required=True) touch(os.path.join(build_aux_directory, "config.rpath")) def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/cloverleaf/package.py b/repos/spack_repo/builtin/packages/cloverleaf/package.py index a945499eed8..7c44a8a3add 100644 --- a/repos/spack_repo/builtin/packages/cloverleaf/package.py +++ b/repos/spack_repo/builtin/packages/cloverleaf/package.py @@ -53,7 +53,7 @@ class Cloverleaf(MakefilePackage): def patch_for_reference_module(self): if self.spec.satisfies("@master %aocc"): fp = join_path(self.package_dir, "aocc_support.patch") - which("patch")("-s", "-p0", "-i", "{0}".format(fp), "-d", ".") + which("patch", required=True)("-s", "-p0", "-i", "{0}".format(fp), "-d", ".") @property def type_of_build(self): diff --git a/repos/spack_repo/builtin/packages/cmake/package.py b/repos/spack_repo/builtin/packages/cmake/package.py index 786fdc47d0f..0f619dfe20d 100644 --- a/repos/spack_repo/builtin/packages/cmake/package.py +++ b/repos/spack_repo/builtin/packages/cmake/package.py @@ -429,7 +429,7 @@ def run_version_check(self, bin): if not os.path.exists(exe_path): raise SkipTest(f"{exe_path} is not installed") - exe = which(exe_path) + exe = which(exe_path, required=True) out = exe("--version", output=str.split, error=str.split) assert f"version {self.spec.version}" in out diff --git a/repos/spack_repo/builtin/packages/cmockery/package.py b/repos/spack_repo/builtin/packages/cmockery/package.py index 8b79505fc77..7b89c032f78 100644 --- a/repos/spack_repo/builtin/packages/cmockery/package.py +++ b/repos/spack_repo/builtin/packages/cmockery/package.py @@ -28,5 +28,5 @@ class Cmockery(AutotoolsPackage): depends_on("libtool", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/cni_plugins/package.py b/repos/spack_repo/builtin/packages/cni_plugins/package.py index 64050c82a3a..9fed76b87d0 100644 --- a/repos/spack_repo/builtin/packages/cni_plugins/package.py +++ b/repos/spack_repo/builtin/packages/cni_plugins/package.py @@ -27,7 +27,7 @@ class CniPlugins(Package): def install(self, spec, prefix): utils = "github.com/containernetworking/plugins/pkg/utils/buildversion" - which("./build_linux.sh")( + which("./build_linux.sh", required=True)( "-ldflags", "-extldflags -static -X {0}.BuildVersion={1}".format(utils, self.version) ) install_tree("bin", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/codecov/package.py b/repos/spack_repo/builtin/packages/codecov/package.py index 6cf2f740819..1d982a6da6c 100644 --- a/repos/spack_repo/builtin/packages/codecov/package.py +++ b/repos/spack_repo/builtin/packages/codecov/package.py @@ -41,7 +41,7 @@ def url_for_version(self, version): def install(self, spec, prefix): codecov = self.stage.archive_file - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", codecov) mkdirp(prefix.bin) install(codecov, prefix.bin.codecov) diff --git a/repos/spack_repo/builtin/packages/conda4aarch64/package.py b/repos/spack_repo/builtin/packages/conda4aarch64/package.py index c0a61dc533c..ec90d32dc33 100644 --- a/repos/spack_repo/builtin/packages/conda4aarch64/package.py +++ b/repos/spack_repo/builtin/packages/conda4aarch64/package.py @@ -25,7 +25,7 @@ class Conda4aarch64(Package): def install(self, spec, prefix): conda_script = self.stage.archive_file - bash = which("bash") + bash = which("bash", required=True) bash(conda_script, "-b", "-f", "-p", self.prefix) def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/cosign/package.py b/repos/spack_repo/builtin/packages/cosign/package.py index 0fafd4374d9..47169456e5a 100644 --- a/repos/spack_repo/builtin/packages/cosign/package.py +++ b/repos/spack_repo/builtin/packages/cosign/package.py @@ -32,7 +32,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: env.prepend_path("GOPATH", self.stage.path) def install(self, spec, prefix): - go = which("go") + go = which("go", required=True) go("build", "-o", "cosign", os.path.join("cmd", "cosign", "main.go")) mkdirp(prefix.bin) install("cosign", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/cp2k/package.py b/repos/spack_repo/builtin/packages/cp2k/package.py index 72da8929435..9ff9a5257e7 100644 --- a/repos/spack_repo/builtin/packages/cp2k/package.py +++ b/repos/spack_repo/builtin/packages/cp2k/package.py @@ -563,7 +563,7 @@ def url_for_version(self, version): class MakefileBuilder(makefile.MakefileBuilder): def edit(self, pkg, spec, prefix): - pkgconf = which("pkg-config") + pkgconf = which("pkg-config", required=True) fftw = spec["fftw-api:openmp" if "+openmp" in spec else "fftw-api"] fftw_header_dir = fftw.headers.directories[0] diff --git a/repos/spack_repo/builtin/packages/cpmd/package.py b/repos/spack_repo/builtin/packages/cpmd/package.py index e7df09fc3c5..65201b22353 100644 --- a/repos/spack_repo/builtin/packages/cpmd/package.py +++ b/repos/spack_repo/builtin/packages/cpmd/package.py @@ -78,7 +78,7 @@ def edit(self, spec, prefix): # create Makefile os.chmod("./scripts/configure.sh", 0o755) - bash = which("bash") + bash = which("bash", required=True) if spec.satisfies("+omp"): bash("./configure.sh", "-omp", cbase) else: @@ -100,7 +100,7 @@ def test_cpmd(self): exe_name = "cpmd.x" opts.append(test_file) opts.append(test_dir) - cpmd = which(exe_name) + cpmd = which(exe_name, required=True) out = cpmd(*opts, output=str.split, error=str.split) expected = [ diff --git a/repos/spack_repo/builtin/packages/cracklib/package.py b/repos/spack_repo/builtin/packages/cracklib/package.py index 5df5fecd7ef..9f300840fc5 100644 --- a/repos/spack_repo/builtin/packages/cracklib/package.py +++ b/repos/spack_repo/builtin/packages/cracklib/package.py @@ -34,7 +34,7 @@ class Cracklib(AutotoolsPackage): def autoreconf(self, spec, prefix): with working_dir("src"): - sh = which("sh") + sh = which("sh", required=True) sh("./autogen.sh") def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/cronie/package.py b/repos/spack_repo/builtin/packages/cronie/package.py index b6c7e2dfa62..0f911223048 100644 --- a/repos/spack_repo/builtin/packages/cronie/package.py +++ b/repos/spack_repo/builtin/packages/cronie/package.py @@ -23,7 +23,7 @@ class Cronie(AutotoolsPackage): depends_on("c", type="build") # generated def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/ctpl/package.py b/repos/spack_repo/builtin/packages/ctpl/package.py index 6673f91108d..426b18ba335 100644 --- a/repos/spack_repo/builtin/packages/ctpl/package.py +++ b/repos/spack_repo/builtin/packages/ctpl/package.py @@ -29,5 +29,5 @@ class Ctpl(AutotoolsPackage): depends_on("glib@2.10:") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/cuda/package.py b/repos/spack_repo/builtin/packages/cuda/package.py index 9adaaa91558..6c628968ccb 100644 --- a/repos/spack_repo/builtin/packages/cuda/package.py +++ b/repos/spack_repo/builtin/packages/cuda/package.py @@ -860,7 +860,7 @@ def install(self, spec, prefix): os.makedirs(os.path.join(prefix, "src")) symlink(includedir, os.path.join(prefix, "include")) - install_shell = which("sh") + install_shell = which("sh", required=True) if self.spec.satisfies("@:8.0.61"): # Perl 5.26 removed current directory from module search path. diff --git a/repos/spack_repo/builtin/packages/cxx/package.py b/repos/spack_repo/builtin/packages/cxx/package.py index 6fc77d1bd04..65401d8c546 100644 --- a/repos/spack_repo/builtin/packages/cxx/package.py +++ b/repos/spack_repo/builtin/packages/cxx/package.py @@ -25,6 +25,6 @@ def test_cxx(self): with test_part(self, f"test_cxx_{test}", f"build and run {exe_name}"): filepath = join_path(test_source, test) cxx("-o", exe_name, filepath) - exe = which(exe_name) + exe = which(exe_name, required=True) out = exe(output=str.split, error=str.split) check_outputs(expected, out) diff --git a/repos/spack_repo/builtin/packages/darshan_runtime/package.py b/repos/spack_repo/builtin/packages/darshan_runtime/package.py index 69072a7eeed..889af8f0840 100644 --- a/repos/spack_repo/builtin/packages/darshan_runtime/package.py +++ b/repos/spack_repo/builtin/packages/darshan_runtime/package.py @@ -203,7 +203,7 @@ def test_mpi_io_test(self): cc(*(link_opt)) # run test program and intercept - mpi_io_test = which(join_path(".", testexe)) + mpi_io_test = which(join_path(".", testexe), required=True) out = mpi_io_test("-f", "tmp.dat", output=str.split, error=str.split) env.pop("LD_PRELOAD") diff --git a/repos/spack_repo/builtin/packages/darshan_util/package.py b/repos/spack_repo/builtin/packages/darshan_util/package.py index 74dbf3df735..7a3ed1991ad 100644 --- a/repos/spack_repo/builtin/packages/darshan_util/package.py +++ b/repos/spack_repo/builtin/packages/darshan_util/package.py @@ -131,6 +131,6 @@ def test_parser(self): r"STDIO\s+0\s+\w+\s+STDIO_OPENS\s+\d+", ] logname = self.test_suite.current_test_cache_dir.join(self.tests_log_path) - parser = which(join_path(self.prefix.bin, "darshan-parser")) + parser = which(join_path(self.prefix.bin, "darshan-parser"), required=True) out = parser(logname, output=str.split, error=str.split) check_outputs(expected_output, out) diff --git a/repos/spack_repo/builtin/packages/dataspaces/package.py b/repos/spack_repo/builtin/packages/dataspaces/package.py index 17e515bd5fd..9e645f140ec 100644 --- a/repos/spack_repo/builtin/packages/dataspaces/package.py +++ b/repos/spack_repo/builtin/packages/dataspaces/package.py @@ -45,7 +45,7 @@ class Dataspaces(AutotoolsPackage): depends_on("mpi", when="+mpi") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def setup_build_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/deconseq_standalone/package.py b/repos/spack_repo/builtin/packages/deconseq_standalone/package.py index 8d5bc638334..88a9669d011 100644 --- a/repos/spack_repo/builtin/packages/deconseq_standalone/package.py +++ b/repos/spack_repo/builtin/packages/deconseq_standalone/package.py @@ -33,7 +33,7 @@ def install(self, spec, prefix): install("splitFasta.pl", prefix.bin) install("DeconSeqConfig.pm", prefix) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", join_path(prefix.bin, "bwa64")) chmod("+x", join_path(prefix.bin, "bwaMAC")) chmod("+x", join_path(prefix.bin, "deconseq.pl")) diff --git a/repos/spack_repo/builtin/packages/delta/package.py b/repos/spack_repo/builtin/packages/delta/package.py index 4bdc734a37e..4d8cd55e555 100644 --- a/repos/spack_repo/builtin/packages/delta/package.py +++ b/repos/spack_repo/builtin/packages/delta/package.py @@ -26,7 +26,7 @@ class Delta(Package): depends_on("java@8", type=("build", "run")) def install(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("build/sbt", "compile") bash("build/sbt", "package") install_tree("target", prefix.target) diff --git a/repos/spack_repo/builtin/packages/demuxlet/package.py b/repos/spack_repo/builtin/packages/demuxlet/package.py index f32b3d535e0..8e3739a4243 100644 --- a/repos/spack_repo/builtin/packages/demuxlet/package.py +++ b/repos/spack_repo/builtin/packages/demuxlet/package.py @@ -50,4 +50,4 @@ def patch(self): filter_file("-lcrypto", "", "Makefile.am", string=True) def autoreconf(self, spec, prefix): - which("autoreconf")("-vfi") + which("autoreconf", required=True)("-vfi") diff --git a/repos/spack_repo/builtin/packages/dicom3tools/package.py b/repos/spack_repo/builtin/packages/dicom3tools/package.py index 2de5a4f550d..36ad82ea1c3 100644 --- a/repos/spack_repo/builtin/packages/dicom3tools/package.py +++ b/repos/spack_repo/builtin/packages/dicom3tools/package.py @@ -71,7 +71,7 @@ def build(self, spec, prefix): "config/generic.cf", ) - imake = which("imake") + imake = which("imake", required=True) imake("-I./config", "-DDefaultUIDRoot={0}".format(uid_root)) make("World") diff --git a/repos/spack_repo/builtin/packages/distcc/package.py b/repos/spack_repo/builtin/packages/distcc/package.py index c5e22ce5cd6..91a89efc74a 100644 --- a/repos/spack_repo/builtin/packages/distcc/package.py +++ b/repos/spack_repo/builtin/packages/distcc/package.py @@ -26,7 +26,7 @@ class Distcc(AutotoolsPackage): depends_on("libiberty") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/dmd/package.py b/repos/spack_repo/builtin/packages/dmd/package.py index 594b6486194..c6b2d7750f9 100644 --- a/repos/spack_repo/builtin/packages/dmd/package.py +++ b/repos/spack_repo/builtin/packages/dmd/package.py @@ -53,9 +53,9 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: def edit(self, spec, prefix): # Move contents to dmd/ - mkdir = which("mkdir") + mkdir = which("mkdir", required=True) mkdir("dmd") - mv = which("mv") + mv = which("mv", required=True) dmd_files = [ f for f in os.listdir(".") diff --git a/repos/spack_repo/builtin/packages/docbook_xml/package.py b/repos/spack_repo/builtin/packages/docbook_xml/package.py index 4a5db5b7396..87fa6eca07a 100644 --- a/repos/spack_repo/builtin/packages/docbook_xml/package.py +++ b/repos/spack_repo/builtin/packages/docbook_xml/package.py @@ -37,7 +37,7 @@ def config_docbook(self): version = self.version docbook = join_path(prefix, "docbook") ent_dir = join_path(prefix, "ent") - xmlcatalog = which("xmlcatalog") + xmlcatalog = which("xmlcatalog", required=True) # create docbook xmlcatalog("--noout", "--create", docbook) diff --git a/repos/spack_repo/builtin/packages/docbook_xsl/package.py b/repos/spack_repo/builtin/packages/docbook_xsl/package.py index eaf18cc5401..20faf2b3c36 100644 --- a/repos/spack_repo/builtin/packages/docbook_xsl/package.py +++ b/repos/spack_repo/builtin/packages/docbook_xsl/package.py @@ -39,7 +39,7 @@ def config_docbook(self): catalog = self.catalog version = self.version xml_xsd = join_path(prefix, "slides", "schema", "xsd", "xml.xsd") - xmlcatalog = which("xmlcatalog") + xmlcatalog = which("xmlcatalog", required=True) # create catalog xmlcatalog("--noout", "--create", catalog) diff --git a/repos/spack_repo/builtin/packages/dock/package.py b/repos/spack_repo/builtin/packages/dock/package.py index d7f42065937..3dcc0152d74 100644 --- a/repos/spack_repo/builtin/packages/dock/package.py +++ b/repos/spack_repo/builtin/packages/dock/package.py @@ -57,8 +57,8 @@ def install(self, spec, prefix): r"(-fno-second-underscore)", r"\1 -fallow-argument-mismatch", config_source ) - which("sh")(*sh_args) - which("make")("YACC=bison -o y.tab.c") + which("sh", required=True)(*sh_args) + which("make", required=True)("YACC=bison -o y.tab.c") mkdirp(prefix.bin) install_tree("bin", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/dramsim3/package.py b/repos/spack_repo/builtin/packages/dramsim3/package.py index dd62a43b605..4eae3061531 100644 --- a/repos/spack_repo/builtin/packages/dramsim3/package.py +++ b/repos/spack_repo/builtin/packages/dramsim3/package.py @@ -31,7 +31,7 @@ class Dramsim3(Package): depends_on("gmake", type="build") def install(self, spec, prefix): - cmake = which("cmake") + cmake = which("cmake", required=True) cmake(".") make() diff --git a/repos/spack_repo/builtin/packages/drishti/package.py b/repos/spack_repo/builtin/packages/drishti/package.py index 5d9f4c4cc0a..be24ed95f1c 100644 --- a/repos/spack_repo/builtin/packages/drishti/package.py +++ b/repos/spack_repo/builtin/packages/drishti/package.py @@ -37,5 +37,5 @@ class Drishti(PythonPackage): def test_help(self): """Run drishti help.""" - drishti = which(self.prefix.bin.drishti) + drishti = which(self.prefix.bin.drishti, required=True) drishti("-h") diff --git a/repos/spack_repo/builtin/packages/dropwatch/package.py b/repos/spack_repo/builtin/packages/dropwatch/package.py index 729eb3b4f49..3638d98cb82 100644 --- a/repos/spack_repo/builtin/packages/dropwatch/package.py +++ b/repos/spack_repo/builtin/packages/dropwatch/package.py @@ -33,7 +33,7 @@ class Dropwatch(AutotoolsPackage): depends_on("readline") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def check(self): diff --git a/repos/spack_repo/builtin/packages/dsqss/package.py b/repos/spack_repo/builtin/packages/dsqss/package.py index bf38ec12bdd..4ba237541fa 100644 --- a/repos/spack_repo/builtin/packages/dsqss/package.py +++ b/repos/spack_repo/builtin/packages/dsqss/package.py @@ -75,10 +75,10 @@ def test_dla(self): exe_name = "dla" opts.append("param.in") with test_part(self, "test_dla_run", purpose="run dla"): - exe = which(exe_name) + exe = which(exe_name, required=True) exe(*opts) with test_part(self, "test_dla_results", purpose="confirming dla results"): - cat = which("cat") + cat = which("cat", required=True) out = cat("sample.log", output=str.split, error=str.split) assert "R ene = -3.74300000e-01 2.96344394e-03" in out diff --git a/repos/spack_repo/builtin/packages/dssp/package.py b/repos/spack_repo/builtin/packages/dssp/package.py index 3d70de268c8..7b711c8dbf7 100644 --- a/repos/spack_repo/builtin/packages/dssp/package.py +++ b/repos/spack_repo/builtin/packages/dssp/package.py @@ -59,6 +59,6 @@ def cache_test_sources(self): def test_mkdssp(self): """calculate structure for example""" pdb_path = self.test_suite.current_test_cache_dir.pdb - mkdssp = which(self.prefix.bin.mkdssp) + mkdssp = which(self.prefix.bin.mkdssp, required=True) with working_dir(pdb_path): mkdssp("1ALK.pdb", "1alk.dssp") diff --git a/repos/spack_repo/builtin/packages/dust/package.py b/repos/spack_repo/builtin/packages/dust/package.py index 4af7d5ee260..680f0af7022 100644 --- a/repos/spack_repo/builtin/packages/dust/package.py +++ b/repos/spack_repo/builtin/packages/dust/package.py @@ -25,7 +25,7 @@ class Dust(Package): sanity_check_is_file = [join_path("bin", "dust")] def install(self, spec, prefix): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("install", "--root", prefix, "--path", ".") @run_after("install") @@ -36,6 +36,6 @@ def check_install(self): def test_run(self): """check dust can execute (with option '--version')""" - dust = which(self.prefix.bin.dust) + dust = which(self.prefix.bin.dust, required=True) out = dust("--version", output=str.split, error=str.split) assert "Dust " in out diff --git a/repos/spack_repo/builtin/packages/dyninst/package.py b/repos/spack_repo/builtin/packages/dyninst/package.py index 81ce46754b0..a15a2f0a167 100644 --- a/repos/spack_repo/builtin/packages/dyninst/package.py +++ b/repos/spack_repo/builtin/packages/dyninst/package.py @@ -112,7 +112,7 @@ def cmake_args(self): def test_ptls(self): """Run parseThat on /bin/ls to rewrite with basic instrumentation""" - parseThat = which(self.prefix.bin.parseThat) + parseThat = which(self.prefix.bin.parseThat, required=True) os.environ["DYNINSTAPI_RT_LIB"] = join_path(self.prefix.lib, "libdyninstAPI_RT.so") parseThat( "--binary-edit={0:s}".format(join_path(self.test_suite.stage, "ls.rewritten")), diff --git a/repos/spack_repo/builtin/packages/ecflow/package.py b/repos/spack_repo/builtin/packages/ecflow/package.py index 571126c1e81..43fd6b444e5 100644 --- a/repos/spack_repo/builtin/packages/ecflow/package.py +++ b/repos/spack_repo/builtin/packages/ecflow/package.py @@ -125,7 +125,7 @@ def remove_recursive_symlink_in_source_code(self): @when("+ssl ^openssl~shared") def patch(self): - pkgconf = which("pkg-config") + pkgconf = which("pkg-config", required=True) liblist_l = pkgconf("--libs-only-l", "--static", "openssl", output=str).split() liblist = " ".join([ll.replace("-l", "") for ll in liblist_l]) for sdir in ["Client", "Server"]: diff --git a/repos/spack_repo/builtin/packages/eigenexa/package.py b/repos/spack_repo/builtin/packages/eigenexa/package.py index d5e4ecca9e2..5121825976f 100644 --- a/repos/spack_repo/builtin/packages/eigenexa/package.py +++ b/repos/spack_repo/builtin/packages/eigenexa/package.py @@ -97,6 +97,6 @@ def test_benchmarks(self): join_path(test_cache_dir, "IN"), ] env["OMP_NUM_THREADS"] = "1" - sh = which("sh") + sh = which("sh", required=True) out = sh(*opts, output=str.split, error=str.split) assert "EigenExa Test Passed !" in out diff --git a/repos/spack_repo/builtin/packages/elk/package.py b/repos/spack_repo/builtin/packages/elk/package.py index a9911f9cb4f..6748fac86db 100644 --- a/repos/spack_repo/builtin/packages/elk/package.py +++ b/repos/spack_repo/builtin/packages/elk/package.py @@ -189,7 +189,7 @@ def edit(self, spec, prefix): config["SRC_FFT"] = "mkl_dfti.f90 zfftifc_mkl.f90" if spec.satisfies("@8.6:"): config["SRC_FFT"] += " cfftifc_mkl.f90" - cp = which("cp") + cp = which("cp", required=True) mkl_prefix = spec["mkl"].prefix cp( join_path(mkl_prefix.include, "mkl_dfti.f90"), @@ -245,5 +245,5 @@ def install(self, spec, prefix): @on_package_attributes(run_tests=True) def check(self): with working_dir("{0}/tests".format(self.build_directory)): - bash = which("bash") + bash = which("bash", required=True) bash("./test.sh") diff --git a/repos/spack_repo/builtin/packages/emacs/package.py b/repos/spack_repo/builtin/packages/emacs/package.py index 733054b3ba3..5c4547e9af8 100644 --- a/repos/spack_repo/builtin/packages/emacs/package.py +++ b/repos/spack_repo/builtin/packages/emacs/package.py @@ -180,6 +180,6 @@ def run_version_check(self, bin): if not os.path.exists(exe_path): raise SkipTest(f"{exe_path} is not installed") - exe = which(exe_path) + exe = which(exe_path, required=True) out = exe("--version", output=str.split, error=str.split) assert str(self.spec.version) in out diff --git a/repos/spack_repo/builtin/packages/enca/package.py b/repos/spack_repo/builtin/packages/enca/package.py index 139d10c38af..94162932afa 100644 --- a/repos/spack_repo/builtin/packages/enca/package.py +++ b/repos/spack_repo/builtin/packages/enca/package.py @@ -28,5 +28,5 @@ class Enca(AutotoolsPackage): depends_on("libtool", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/eq_r/package.py b/repos/spack_repo/builtin/packages/eq_r/package.py index 530fbd8e698..d2b959b9b45 100644 --- a/repos/spack_repo/builtin/packages/eq_r/package.py +++ b/repos/spack_repo/builtin/packages/eq_r/package.py @@ -48,11 +48,7 @@ def configure_args(self): args = ["--with-tcl=" + self.spec["tcl"].prefix] r_location = "{0}/rlib/R".format(self.spec["r"].prefix) if not os.path.exists(r_location): - rscript = which("Rscript") - if rscript is not None: - r_location = rscript("-e", "cat(R.home())", output=str) - else: - msg = "couldn't locate Rscript on your PATH" - raise RuntimeError(msg) + rscript = which("Rscript", required=True) + r_location = rscript("-e", "cat(R.home())", output=str) args.append("--with-r={0}".format(r_location)) return args diff --git a/repos/spack_repo/builtin/packages/etsf_io/package.py b/repos/spack_repo/builtin/packages/etsf_io/package.py index bc177d8faeb..95b0c141081 100644 --- a/repos/spack_repo/builtin/packages/etsf_io/package.py +++ b/repos/spack_repo/builtin/packages/etsf_io/package.py @@ -65,6 +65,6 @@ def install(self, spec, prefix): def test_etsf_io_help(self): """check etsf_io can execute (--help)""" - etsfio = which(self.prefix.bin.etsf_io) + etsfio = which(self.prefix.bin.etsf_io, required=True) out = etsfio("--help", output=str.split, error=str.split) assert "Usage: etsf_io" in out diff --git a/repos/spack_repo/builtin/packages/exmcutils/package.py b/repos/spack_repo/builtin/packages/exmcutils/package.py index 8815a1cb95a..1ebc1ad821e 100644 --- a/repos/spack_repo/builtin/packages/exmcutils/package.py +++ b/repos/spack_repo/builtin/packages/exmcutils/package.py @@ -33,7 +33,7 @@ def configure_directory(self): return "." def autoreconf(self, spec, prefix): - which("bash")("bootstrap") + which("bash", required=True)("bootstrap") depends_on("m4", when="@master") depends_on("autoconf", when="@master") diff --git a/repos/spack_repo/builtin/packages/fastdfs/package.py b/repos/spack_repo/builtin/packages/fastdfs/package.py index ad277bc5f09..d5d8c227944 100644 --- a/repos/spack_repo/builtin/packages/fastdfs/package.py +++ b/repos/spack_repo/builtin/packages/fastdfs/package.py @@ -34,7 +34,7 @@ class Fastdfs(Package): depends_on("libfastcommon", type="build") def install(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("make.sh") sh("make.sh", "install") install_tree(".", prefix) diff --git a/repos/spack_repo/builtin/packages/fastqc/package.py b/repos/spack_repo/builtin/packages/fastqc/package.py index 8ab985f86bb..f793005a409 100644 --- a/repos/spack_repo/builtin/packages/fastqc/package.py +++ b/repos/spack_repo/builtin/packages/fastqc/package.py @@ -46,5 +46,5 @@ def install(self, spec, prefix): install("htsjdk.jar", prefix.lib) for d in ["Configuration", "net", "org", "Templates", "uk"]: install_tree(d, join_path(prefix.lib, d)) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", prefix.bin.fastqc) diff --git a/repos/spack_repo/builtin/packages/fftw/package.py b/repos/spack_repo/builtin/packages/fftw/package.py index 46d9c762f4c..134e418e5e4 100644 --- a/repos/spack_repo/builtin/packages/fftw/package.py +++ b/repos/spack_repo/builtin/packages/fftw/package.py @@ -78,7 +78,7 @@ def patch(self): def autoreconf(self, spec, prefix): if spec.satisfies("+pfft_patches"): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf("-ifv") @property diff --git a/repos/spack_repo/builtin/packages/fftx/package.py b/repos/spack_repo/builtin/packages/fftx/package.py index 920872a749d..76cb06c7c50 100644 --- a/repos/spack_repo/builtin/packages/fftx/package.py +++ b/repos/spack_repo/builtin/packages/fftx/package.py @@ -57,7 +57,7 @@ def create_lib_source_code(self): # From the root directory run the config-fftx-libs.sh script with working_dir(self.stage.source_path): - bash = which("bash") + bash = which("bash", required=True) bash("./config-fftx-libs.sh", backend) def cmake_args(self): diff --git a/repos/spack_repo/builtin/packages/fipscheck/package.py b/repos/spack_repo/builtin/packages/fipscheck/package.py index 25ee4416b83..6e71a25df27 100644 --- a/repos/spack_repo/builtin/packages/fipscheck/package.py +++ b/repos/spack_repo/builtin/packages/fipscheck/package.py @@ -27,5 +27,5 @@ class Fipscheck(AutotoolsPackage): depends_on("pkgconfig", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/fleur/package.py b/repos/spack_repo/builtin/packages/fleur/package.py index 1014a29ecc3..520365f97b3 100644 --- a/repos/spack_repo/builtin/packages/fleur/package.py +++ b/repos/spack_repo/builtin/packages/fleur/package.py @@ -88,7 +88,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: @run_before("install") def configure(self): spec = self.spec - sh = which("bash") + sh = which("bash", required=True) options = { "-link": [], diff --git a/repos/spack_repo/builtin/packages/flibcpp/package.py b/repos/spack_repo/builtin/packages/flibcpp/package.py index 7430433645d..d07924b9214 100644 --- a/repos/spack_repo/builtin/packages/flibcpp/package.py +++ b/repos/spack_repo/builtin/packages/flibcpp/package.py @@ -80,9 +80,9 @@ def test_examples(self): self.define("CMAKE_Fortran_COMPILER", self.compiler.fc), ] cmake_args.append(self.cached_tests_work_dir) - cmake = which(self.spec["cmake"].prefix.bin.cmake) - make = which("make") - sh = which("sh") + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) + make = which("make", required=True) + sh = which("sh", required=True) with working_dir(self.cached_tests_work_dir): cmake(*cmake_args) diff --git a/repos/spack_repo/builtin/packages/flux_core/package.py b/repos/spack_repo/builtin/packages/flux_core/package.py index b3bebec27af..21da9835c47 100644 --- a/repos/spack_repo/builtin/packages/flux_core/package.py +++ b/repos/spack_repo/builtin/packages/flux_core/package.py @@ -170,7 +170,7 @@ def setup(self): def setup(self): with working_dir(self.stage.source_path): # Allow git-describe to get last tag so flux-version works: - git = which("git") + git = which("git", required=True) # When using spack develop, this will already be unshallow try: git("fetch", "--unshallow") @@ -183,7 +183,7 @@ def autoreconf(self, spec, prefix): self.setup() if not os.path.exists("configure"): # Bootstrap with autotools - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") @property diff --git a/repos/spack_repo/builtin/packages/flux_pmix/package.py b/repos/spack_repo/builtin/packages/flux_pmix/package.py index 0bff623436f..87cd386fb65 100644 --- a/repos/spack_repo/builtin/packages/flux_pmix/package.py +++ b/repos/spack_repo/builtin/packages/flux_pmix/package.py @@ -41,7 +41,7 @@ class FluxPmix(AutotoolsPackage): def autoreconf(self, spec, prefix): if not os.path.exists("configure"): # Bootstrap with autotools - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") @run_after("install") diff --git a/repos/spack_repo/builtin/packages/flux_sched/package.py b/repos/spack_repo/builtin/packages/flux_sched/package.py index ca17741eb1e..1f27c843df7 100644 --- a/repos/spack_repo/builtin/packages/flux_sched/package.py +++ b/repos/spack_repo/builtin/packages/flux_sched/package.py @@ -150,7 +150,7 @@ def setup(self): def setup(self): with working_dir(self.stage.source_path): # Allow git-describe to get last tag so flux-version works: - git = which("git") + git = which("git", required=True) # When using spack develop, this will already be unshallow try: git("fetch", "--unshallow") @@ -166,7 +166,7 @@ def autoreconf(self, spec, prefix): # make sure configure doesn't get confused by the staging symlink with working_dir(self.configure_directory): # Bootstrap with autotools - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") @when("@:0.20") diff --git a/repos/spack_repo/builtin/packages/flux_security/package.py b/repos/spack_repo/builtin/packages/flux_security/package.py index f3cf4cc24e1..67556446e1d 100644 --- a/repos/spack_repo/builtin/packages/flux_security/package.py +++ b/repos/spack_repo/builtin/packages/flux_security/package.py @@ -51,7 +51,7 @@ def setup(self): def setup(self): with working_dir(self.stage.source_path): # Allow git-describe to get last tag so flux-version works: - git = which("git") + git = which("git", required=True) # When using spack develop, this will already be unshallow try: git("fetch", "--unshallow") @@ -67,5 +67,5 @@ def autoreconf(self, spec, prefix): # make sure configure doesn't get confused by the staging symlink with working_dir(self.configure_directory): # Bootstrap with autotools - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/font_util/package.py b/repos/spack_repo/builtin/packages/font_util/package.py index 3d7e8397de9..24282df3318 100644 --- a/repos/spack_repo/builtin/packages/font_util/package.py +++ b/repos/spack_repo/builtin/packages/font_util/package.py @@ -252,7 +252,7 @@ def font_install(self): p = join_path(self.spec.prefix, "share", "aclocal") autoconf_args.append(f"--include={p}") fonts = self.spec.variants["fonts"].value - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) for font in fonts: fontroot = find(font, "*", recursive=False) diff --git a/repos/spack_repo/builtin/packages/fontconfig/package.py b/repos/spack_repo/builtin/packages/fontconfig/package.py index 8585bc92c3e..f6a3f623a8d 100644 --- a/repos/spack_repo/builtin/packages/fontconfig/package.py +++ b/repos/spack_repo/builtin/packages/fontconfig/package.py @@ -62,7 +62,7 @@ def configure_args(self): if self.spec["libxml2"].satisfies("~shared"): deps.append("libxml-2.0") if deps: - pc = which("pkg-config") + pc = which("pkg-config", required=True) for lib in deps: ldflags.append(pc(lib, "--static", "--libs-only-L", output=str).strip()) libs.append(pc(lib, "--static", "--libs-only-l", output=str).strip()) diff --git a/repos/spack_repo/builtin/packages/formetis/package.py b/repos/spack_repo/builtin/packages/formetis/package.py index db4c5b1847b..364c404638a 100644 --- a/repos/spack_repo/builtin/packages/formetis/package.py +++ b/repos/spack_repo/builtin/packages/formetis/package.py @@ -71,11 +71,11 @@ def test_metis(self): if self.spec.satisfies("+mpi"): cmake_args.append(self.define("ParMETIS_ROOT", self.spec["parmetis"].prefix)) cmake_args.append(self.cached_tests_work_dir) - cmake = which(self.spec["cmake"].prefix.bin.cmake) - make = which("make") + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) + make = which("make", required=True) with working_dir(self.cached_tests_work_dir): cmake(*cmake_args) make() - metis = which("metis") + metis = which("metis", required=True) metis() diff --git a/repos/spack_repo/builtin/packages/fortran/package.py b/repos/spack_repo/builtin/packages/fortran/package.py index d06df758140..b1705a4525d 100644 --- a/repos/spack_repo/builtin/packages/fortran/package.py +++ b/repos/spack_repo/builtin/packages/fortran/package.py @@ -18,13 +18,13 @@ class Fortran(Package): def test_fortran(self): """Compile and run 'Hello world'""" expected = ["Hello world", "YES!"] - fc = which(os.environ["FC"]) + fc = which(os.environ["FC"], required=True) test_source = self.test_suite.current_test_data_dir for test in os.listdir(test_source): exe_name = f"{test}.exe" with test_part(self, f"test_fortran_{test}", f"run {exe_name}"): fc("-o", exe_name, join_path(test_source, test)) - exe = which(exe_name) + exe = which(exe_name, required=True) out = exe(output=str.split, error=str.split) check_outputs(expected, out) diff --git a/repos/spack_repo/builtin/packages/fortrilinos/package.py b/repos/spack_repo/builtin/packages/fortrilinos/package.py index 5a1019d8a47..1a4459ce0d1 100644 --- a/repos/spack_repo/builtin/packages/fortrilinos/package.py +++ b/repos/spack_repo/builtin/packages/fortrilinos/package.py @@ -99,9 +99,9 @@ def test_installation(self): self.define("CMAKE_Fortran_COMPILER", self.compiler.fc), self.cached_tests_work_dir, ] - cmake = which(self.spec["cmake"].prefix.bin.cmake) - ctest = which("ctest") - make = which("make") + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) + ctest = which("ctest", required=True) + make = which("make", required=True) with working_dir(self.cached_tests_work_dir, create=True): cmake(*cmake_args) diff --git a/repos/spack_repo/builtin/packages/fq/package.py b/repos/spack_repo/builtin/packages/fq/package.py index a70e0af4153..60f28b099ab 100644 --- a/repos/spack_repo/builtin/packages/fq/package.py +++ b/repos/spack_repo/builtin/packages/fq/package.py @@ -23,5 +23,5 @@ class Fq(Package): depends_on("rust") def install(self, spec, prefix): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("install", "--root", prefix, "--path", ".") diff --git a/repos/spack_repo/builtin/packages/fsl/package.py b/repos/spack_repo/builtin/packages/fsl/package.py index 373c0c101d8..4bafb7c13a1 100644 --- a/repos/spack_repo/builtin/packages/fsl/package.py +++ b/repos/spack_repo/builtin/packages/fsl/package.py @@ -168,7 +168,7 @@ def install(self, spec, prefix): build = Executable(join_path(self.stage.source_path, "build")) build() - rm = which("rm") + rm = which("rm", required=True) for file in glob.glob("build*"): rm("-f", file) rm("-r", "-f", "src") diff --git a/repos/spack_repo/builtin/packages/fujitsu_fftw/package.py b/repos/spack_repo/builtin/packages/fujitsu_fftw/package.py index 6a9954c91d1..00447ca2365 100644 --- a/repos/spack_repo/builtin/packages/fujitsu_fftw/package.py +++ b/repos/spack_repo/builtin/packages/fujitsu_fftw/package.py @@ -49,9 +49,9 @@ class FujitsuFftw(FftwBase): requires("target=a64fx") def autoreconf(self, spec, prefix): - touch = which("touch") + touch = which("touch", required=True) touch("ChangeLog") - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf("-ifv") def configure(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/fullock/package.py b/repos/spack_repo/builtin/packages/fullock/package.py index 18808da78b8..785def3ce46 100644 --- a/repos/spack_repo/builtin/packages/fullock/package.py +++ b/repos/spack_repo/builtin/packages/fullock/package.py @@ -34,5 +34,5 @@ class Fullock(AutotoolsPackage): depends_on("m4", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/gasnet/package.py b/repos/spack_repo/builtin/packages/gasnet/package.py index 21d28874df4..bc0ae0b68de 100644 --- a/repos/spack_repo/builtin/packages/gasnet/package.py +++ b/repos/spack_repo/builtin/packages/gasnet/package.py @@ -117,7 +117,7 @@ def install(self, spec, prefix): bootstrapsh() # Record git-describe when fetched from git: try: - git = which("git") + git = which("git", required=True) git("describe", "--long", "--always", output="version.git") except ProcessError: warnings.warn("Omitting version stamp due to git error") diff --git a/repos/spack_repo/builtin/packages/gaussian_view/package.py b/repos/spack_repo/builtin/packages/gaussian_view/package.py index f4cf4f58afd..6c17817ecad 100644 --- a/repos/spack_repo/builtin/packages/gaussian_view/package.py +++ b/repos/spack_repo/builtin/packages/gaussian_view/package.py @@ -61,7 +61,7 @@ def install(self, spec, prefix): # on what is installed on the host # the $ORIGIN prefix is required for the executable to find its # own bundled shared libraries - patchelf = which("patchelf") + patchelf = which("patchelf", required=True) rpath = "$ORIGIN:$ORIGIN/lib" + ":".join( self.spec[dep].libs.directories[0] for dep in ["libx11", "libxext", "libxrender", "libice", "libsm", "gl", "glu"] diff --git a/repos/spack_repo/builtin/packages/ginkgo/package.py b/repos/spack_repo/builtin/packages/ginkgo/package.py index 329e379f742..8faa5813a30 100644 --- a/repos/spack_repo/builtin/packages/ginkgo/package.py +++ b/repos/spack_repo/builtin/packages/ginkgo/package.py @@ -272,12 +272,12 @@ def _build_and_run_test(self, script): cmakelists.write(data) cmakelists.close() - cmake = which(self.spec["cmake"].prefix.bin.cmake) - make = which("make") + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) + make = which("make", required=True) with working_dir(src_dir): cmake(*cmake_args) make() - exe = which(script) + exe = which(script, required=True) output = exe(output=str.split, error=str.split) assert "correctly detected and is complete" in output diff --git a/repos/spack_repo/builtin/packages/glib/package.py b/repos/spack_repo/builtin/packages/glib/package.py index 46791bc563d..f2c99db559b 100644 --- a/repos/spack_repo/builtin/packages/glib/package.py +++ b/repos/spack_repo/builtin/packages/glib/package.py @@ -184,7 +184,7 @@ def fix_dtrace_usr_bin_path(self): # '/usr/bin/python' in the shebang. To work around that # we copy the original script into a temporary folder, and # change the shebang to '/usr/bin/env python' - dtrace = which("dtrace").path + dtrace = which("dtrace", required=True).path dtrace_copy = join_path(self.dtrace_copy_path, "dtrace") with working_dir(self.dtrace_copy_path, create=True): diff --git a/repos/spack_repo/builtin/packages/glusterfs/package.py b/repos/spack_repo/builtin/packages/glusterfs/package.py index 674920524ae..ef21e22f568 100644 --- a/repos/spack_repo/builtin/packages/glusterfs/package.py +++ b/repos/spack_repo/builtin/packages/glusterfs/package.py @@ -46,5 +46,5 @@ def url_for_version(self, version): return url.format(version.up_to(1), version) def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/gnome_common/package.py b/repos/spack_repo/builtin/packages/gnome_common/package.py index 57e7fd49b36..c65596fa82c 100644 --- a/repos/spack_repo/builtin/packages/gnome_common/package.py +++ b/repos/spack_repo/builtin/packages/gnome_common/package.py @@ -33,5 +33,5 @@ class GnomeCommon(AutotoolsPackage): depends_on("libtool", type="build") def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf("-ifv") diff --git a/repos/spack_repo/builtin/packages/go/package.py b/repos/spack_repo/builtin/packages/go/package.py index 7c0e6417bb1..b414596f997 100644 --- a/repos/spack_repo/builtin/packages/go/package.py +++ b/repos/spack_repo/builtin/packages/go/package.py @@ -108,7 +108,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def build(self, spec, prefix): # Build script depend on bash - bash = which("bash") + bash = which("bash", required=True) with working_dir("src"): bash(f"{'all' if self.run_tests else 'make'}.bash") diff --git a/repos/spack_repo/builtin/packages/goshimmer/package.py b/repos/spack_repo/builtin/packages/goshimmer/package.py index 9ab64e60efe..38c81bda09e 100644 --- a/repos/spack_repo/builtin/packages/goshimmer/package.py +++ b/repos/spack_repo/builtin/packages/goshimmer/package.py @@ -35,11 +35,11 @@ def patch(self): filter_file("./snapshot.bin", self.snapbin, file + ".go") def install(self, spec, prefix): - which("go")("build", "-modcacherw", "-tags", "rocksdb,netgo") + which("go", required=True)("build", "-modcacherw", "-tags", "rocksdb,netgo") mkdir(prefix.bin) install("config.default.json", prefix.bin) install("goshimmer", prefix.bin) - which("wget")( + which("wget", required=True)( "-O", self.snapbin, "https://dbfiles-goshimmer.s3.eu-central-1.amazonaws.com/snapshots/nectar/snapshot-latest.bin", diff --git a/repos/spack_repo/builtin/packages/gpi_2/package.py b/repos/spack_repo/builtin/packages/gpi_2/package.py index 4cef96c5ba6..46147f204c0 100644 --- a/repos/spack_repo/builtin/packages/gpi_2/package.py +++ b/repos/spack_repo/builtin/packages/gpi_2/package.py @@ -86,7 +86,7 @@ def set_specific_cflags(self, spec): # GPI-2 without autotools @when("@:1.3.3") def autoreconf(self, spec, prefix): - touch = which("touch") + touch = which("touch", required=True) touch("configure") pass @@ -120,7 +120,7 @@ def old_install(self, spec, prefix): config_args += ["--with-mpi={0}".format(spec["mpi"].prefix)] with working_dir(self.build_directory): - install = which("./install.sh") + install = which("./install.sh", required=True) install(*config_args) @when("@:1.3.3") @@ -130,7 +130,7 @@ def install(self, spec, prefix): # GPI-2 with autotools @when("@1.4.0:") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def with_or_without_infiniband(self, activated): @@ -172,5 +172,5 @@ def set_machines(self): def check(self): self.set_machines() with working_dir("{0}/tests".format(self.build_directory)): - bash = which("bash") + bash = which("bash", required=True) bash("./runtests.sh") diff --git a/repos/spack_repo/builtin/packages/gptune/package.py b/repos/spack_repo/builtin/packages/gptune/package.py index 3e8349077df..2fad7bc64a5 100644 --- a/repos/spack_repo/builtin/packages/gptune/package.py +++ b/repos/spack_repo/builtin/packages/gptune/package.py @@ -217,7 +217,7 @@ def cache_test_sources(self): ) # copy the environment configuration to the python install directory - cp = which("cp") + cp = which("cp", required=True) platlib = self.spec["python"].package.platlib cp(script_path, join_path(self.prefix, platlib, "run_env.sh")) cp( @@ -231,7 +231,12 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: gptune_path = join_path(self.prefix, self.spec["python"].package.platlib, "GPTune") env.prepend_path("PYTHONPATH", gptune_path) - cmd = {"bash": which("bash"), "cp": which("cp"), "git": which("git"), "rm": which("rm")} + cmd = { + "bash": which("bash", required=True), + "cp": which("cp", required=True), + "git": which("git", required=True), + "rm": which("rm", required=True), + } def test_hypre(self): """set up and run hypre example""" diff --git a/repos/spack_repo/builtin/packages/grafana/package.py b/repos/spack_repo/builtin/packages/grafana/package.py index 901942f10c2..e35390c60b9 100644 --- a/repos/spack_repo/builtin/packages/grafana/package.py +++ b/repos/spack_repo/builtin/packages/grafana/package.py @@ -27,6 +27,6 @@ class Grafana(Package): depends_on("go", type="build") def install(self, spec, prefix): - go = which("go") + go = which("go", required=True) go("run", "build.go", "build") install_tree("bin", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/graphviz/package.py b/repos/spack_repo/builtin/packages/graphviz/package.py index d11ee8ef9ae..38e53966a47 100644 --- a/repos/spack_repo/builtin/packages/graphviz/package.py +++ b/repos/spack_repo/builtin/packages/graphviz/package.py @@ -168,7 +168,7 @@ def autoreconf(self, spec, prefix): if os.path.exists(self.configure_abs_path): return # Else bootstrap (disabling auto-configure with NOCONFIG) - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh", "NOCONFIG") @property diff --git a/repos/spack_repo/builtin/packages/green_seet/package.py b/repos/spack_repo/builtin/packages/green_seet/package.py index d26e76eb88e..2144746e370 100644 --- a/repos/spack_repo/builtin/packages/green_seet/package.py +++ b/repos/spack_repo/builtin/packages/green_seet/package.py @@ -54,7 +54,7 @@ def install(self, spec, prefix): # ---------- Step 1: Build green-seet-solvrs ---------- # NOTE: green-seet-solvers will be merged into green-mbpt for next SEET release seet_solvers_src_dir = join_path(self.stage.source_path, "seet_solvers_src") - git = which("git") + git = which("git", required=True) git("clone", "https://github.com/Green-Phys/green-seet-solvers.git", seet_solvers_src_dir) seet_solvers_build_dir = join_path(seet_solvers_src_dir, "spack-build") diff --git a/repos/spack_repo/builtin/packages/grnboost/package.py b/repos/spack_repo/builtin/packages/grnboost/package.py index b8b8d2d0fd2..7e9b25adbc7 100644 --- a/repos/spack_repo/builtin/packages/grnboost/package.py +++ b/repos/spack_repo/builtin/packages/grnboost/package.py @@ -43,6 +43,6 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: env.set("XGBOOST_JAR", xgboost_jar) def install(self, spec, prefix): - sbt = which("sbt") + sbt = which("sbt", required=True) sbt("assembly") install_tree("target", prefix.target) diff --git a/repos/spack_repo/builtin/packages/gtkplus/package.py b/repos/spack_repo/builtin/packages/gtkplus/package.py index d75e381b11d..831fb52f1c7 100644 --- a/repos/spack_repo/builtin/packages/gtkplus/package.py +++ b/repos/spack_repo/builtin/packages/gtkplus/package.py @@ -129,7 +129,7 @@ def check(self): class AutotoolsBuilder(BuildEnvironment, autotools.AutotoolsBuilder): def configure_args(self): - true = which("true") + true = which("true", required=True) args = [ "--prefix={0}".format(self.prefix), # disable building of gtk-doc files following #9771 diff --git a/repos/spack_repo/builtin/packages/gtksourceview/package.py b/repos/spack_repo/builtin/packages/gtksourceview/package.py index 716807019a0..9b6aa640c16 100644 --- a/repos/spack_repo/builtin/packages/gtksourceview/package.py +++ b/repos/spack_repo/builtin/packages/gtksourceview/package.py @@ -75,5 +75,5 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: # TODO: If https://github.com/spack/spack/pull/12344 is merged, this # method is unnecessary. def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf("-ifv") diff --git a/repos/spack_repo/builtin/packages/h5bench/package.py b/repos/spack_repo/builtin/packages/h5bench/package.py index e4b30f723a0..bf76c1862d4 100644 --- a/repos/spack_repo/builtin/packages/h5bench/package.py +++ b/repos/spack_repo/builtin/packages/h5bench/package.py @@ -74,15 +74,17 @@ def setup_build_tests(self): def mpi_launcher(self): commands = ["mpirun", "mpiexec"] - return which(*commands, path=[self.spec["mpi"].prefix.bin]) or which(*commands) + return which(*commands, path=[self.spec["mpi"].prefix.bin]) or which( + *commands, required=True + ) def test_help(self): """Run h5bench help.""" - h5bench = which(self.prefix.bin.h5bench) + h5bench = which(self.prefix.bin.h5bench, required=True) h5bench("-h") def test_h5bench(self): """Run h5bench synchronous write test.""" with working_dir(self.test_suite.current_test_cache_dir): - h5bench = which(self.prefix.bin.h5bench) + h5bench = which(self.prefix.bin.h5bench, required=True) h5bench("--debug", "--abort", "samples/sync-write-1d-contig-contig.json") diff --git a/repos/spack_repo/builtin/packages/h5hut/package.py b/repos/spack_repo/builtin/packages/h5hut/package.py index decf085005f..8feb8fd66e2 100644 --- a/repos/spack_repo/builtin/packages/h5hut/package.py +++ b/repos/spack_repo/builtin/packages/h5hut/package.py @@ -52,7 +52,7 @@ def flag_handler(self, name, flags): return flags, None, build_system_flags def autoreconf(self, spec, prefix): - which("bash")("autogen.sh") + which("bash", required=True)("autogen.sh") def configure_args(self): spec = self.spec diff --git a/repos/spack_repo/builtin/packages/harfbuzz/package.py b/repos/spack_repo/builtin/packages/harfbuzz/package.py index 3276f7bffe5..6b96910399d 100644 --- a/repos/spack_repo/builtin/packages/harfbuzz/package.py +++ b/repos/spack_repo/builtin/packages/harfbuzz/package.py @@ -188,7 +188,7 @@ def configure_args(self): # disable building of gtk-doc files following #9771 args.append("--disable-gtk-doc-html") - true = which("true") + true = which("true", required=True) args.append(f"GTKDOC_CHECK={true}") args.append(f"GTKDOC_CHECK_PATH={true}") args.append(f"GTKDOC_MKPDF={true}") diff --git a/repos/spack_repo/builtin/packages/hdf/package.py b/repos/spack_repo/builtin/packages/hdf/package.py index 0863d738d45..4c9b6adba09 100644 --- a/repos/spack_repo/builtin/packages/hdf/package.py +++ b/repos/spack_repo/builtin/packages/hdf/package.py @@ -242,7 +242,7 @@ def _check_version_match(self, exe): if not os.path.isfile(path): raise SkipTest(f"{exe} is not installed") - exe = which(path) + exe = which(path, required=True) out = exe("-V", output=str.split, error=str.split) vers = f"Version {self.spec.version.up_to(2)}" assert vers in out @@ -281,19 +281,19 @@ def test_gif_converters(self): with test_part( self, "test_gif_converters_hdf2gif", purpose=f"convert {base_name} hdf-to-gif" ): - hdf2gif = which(self.prefix.bin.hdf2gif) + hdf2gif = which(self.prefix.bin.hdf2gif, required=True) hdf2gif(storm_fn, gif_fn) with test_part( self, "test_gif_converters_gif2hdf", purpose=f"convert {base_name} gif-to-hdf" ): - gif2hdf = which(self.prefix.bin.gif2hdf) + gif2hdf = which(self.prefix.bin.gif2hdf, required=True) gif2hdf(gif_fn, new_hdf_fn) with test_part( self, "test_gif_converters_hdiff", purpose=f"compare new and orig {base_name} hdf" ): - hdiff = which(self.prefix.bin.hdiff) + hdiff = which(self.prefix.bin.hdiff, required=True) hdiff(new_hdf_fn, storm_fn) def test_list(self): @@ -308,6 +308,6 @@ def test_list(self): storm_fn = os.path.join(self.cached_tests_work_dir, f"{base_name}.hdf") - hdfls = which(self.prefix.bin.hdfls) + hdfls = which(self.prefix.bin.hdfls, required=True) out = hdfls(storm_fn, output=str.split, error=str.split) check_outputs(expected, out) diff --git a/repos/spack_repo/builtin/packages/hdf5/package.py b/repos/spack_repo/builtin/packages/hdf5/package.py index a17d3150cc4..aa784a96fce 100644 --- a/repos/spack_repo/builtin/packages/hdf5/package.py +++ b/repos/spack_repo/builtin/packages/hdf5/package.py @@ -796,7 +796,7 @@ def test_version(self): if not os.path.isfile(path): raise SkipTest(f"{path} is not installed") - prog = which(path) + prog = which(path, required=True) output = prog(option, output=str.split, error=str.split) assert expected in output @@ -805,15 +805,15 @@ def test_example(self): test_data_dir = self.test_suite.current_test_data_dir with working_dir(test_data_dir, create=True): filename = "spack.h5" - h5dump = which(self.prefix.bin.h5dump) + h5dump = which(self.prefix.bin.h5dump, required=True) out = h5dump(filename, output=str.split, error=str.split) expected = get_escaped_text_output("dump.out") check_outputs(expected, out) - h5copy = which(self.prefix.bin.h5copy) + h5copy = which(self.prefix.bin.h5copy, required=True) copyname = "test.h5" options = ["-i", filename, "-s", "Spack", "-o", copyname, "-d", "Spack"] h5copy(*options) - h5diff = which(self.prefix.bin.h5diff) + h5diff = which(self.prefix.bin.h5diff, required=True) h5diff(filename, copyname) diff --git a/repos/spack_repo/builtin/packages/hdf5_blosc/package.py b/repos/spack_repo/builtin/packages/hdf5_blosc/package.py index 38da271bc24..0d0dbd3f717 100644 --- a/repos/spack_repo/builtin/packages/hdf5_blosc/package.py +++ b/repos/spack_repo/builtin/packages/hdf5_blosc/package.py @@ -197,7 +197,7 @@ def check_install(self, spec): print(output) print("-" * 80) print("Environment:") - env = which("env") + env = which("env", required=True) env() raise RuntimeError("HDF5 Blosc plugin check failed") shutil.rmtree(checkdir) diff --git a/repos/spack_repo/builtin/packages/hdfview/package.py b/repos/spack_repo/builtin/packages/hdfview/package.py index 7301fd85807..6f3f1e77a82 100644 --- a/repos/spack_repo/builtin/packages/hdfview/package.py +++ b/repos/spack_repo/builtin/packages/hdfview/package.py @@ -43,7 +43,7 @@ class Hdfview(Package): depends_on("hdf5@1.14:", when="@3.3:") def install(self, spec, prefix): - ant = which("ant") + ant = which("ant", required=True) ant("-Dbuild.debug=false", "deploy") dir_version = os.listdir("build/HDF_Group/HDFView/")[0] @@ -64,7 +64,7 @@ def install(self, spec, prefix): mkdirp(prefix.bin) install(hdfview, prefix.bin.hdfview) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", self.prefix.bin.hdfview) install_tree(path, prefix) diff --git a/repos/spack_repo/builtin/packages/heffte/package.py b/repos/spack_repo/builtin/packages/heffte/package.py index 5b41d2662ab..e135522c419 100644 --- a/repos/spack_repo/builtin/packages/heffte/package.py +++ b/repos/spack_repo/builtin/packages/heffte/package.py @@ -166,9 +166,9 @@ def test_make_test(self): # Provide the root directory of the MPI installation. options.append(self.define("MPI_HOME", self.spec["mpi"].prefix)) - cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) cmake(*options) - make = which("make") + make = which("make", required=True) make() make("test") diff --git a/repos/spack_repo/builtin/packages/hicup/package.py b/repos/spack_repo/builtin/packages/hicup/package.py index 2f687c53d65..5358f95e227 100644 --- a/repos/spack_repo/builtin/packages/hicup/package.py +++ b/repos/spack_repo/builtin/packages/hicup/package.py @@ -37,8 +37,8 @@ class Hicup(Package): depends_on("bowtie", type="run", when="+bowtie") def edit(self, spec, prefix): - grep = which("grep") - chmod = which("chmod") + grep = which("grep", required=True) + chmod = which("chmod", required=True) perl_files = grep("-lRr", "#!/usr/bin/perl", ".").splitlines() for f in perl_files: filter_file("/usr/bin/perl", self.spec["perl"].command.path, f, backup=False) diff --git a/repos/spack_repo/builtin/packages/hiop/package.py b/repos/spack_repo/builtin/packages/hiop/package.py index baa84a21630..acbcebd571e 100644 --- a/repos/spack_repo/builtin/packages/hiop/package.py +++ b/repos/spack_repo/builtin/packages/hiop/package.py @@ -317,7 +317,7 @@ def run_hiop(self, raja): ["400", "100", "0", "-empty_sp_row", "-selfcheck"], ] - exe = which(exe) + exe = which(exe, required=True) for i, args in enumerate(options): with test_part(self, f"test_{exName}_{i + 1}", purpose=" ".join(args)): diff --git a/repos/spack_repo/builtin/packages/hip_tests/package.py b/repos/spack_repo/builtin/packages/hip_tests/package.py index 6b9c8aa0d31..a81f58ec9b3 100644 --- a/repos/spack_repo/builtin/packages/hip_tests/package.py +++ b/repos/spack_repo/builtin/packages/hip_tests/package.py @@ -196,7 +196,7 @@ def test_samples(self): ".", ] - cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) with working_dir(test_dir, create=True): cmake(*cc_options) make("build_samples") diff --git a/repos/spack_repo/builtin/packages/hipsolver/package.py b/repos/spack_repo/builtin/packages/hipsolver/package.py index 8fcd289abd7..23196068887 100644 --- a/repos/spack_repo/builtin/packages/hipsolver/package.py +++ b/repos/spack_repo/builtin/packages/hipsolver/package.py @@ -124,7 +124,7 @@ class Hipsolver(CMakePackage, CudaPackage, ROCmPackage): def check(self): exe = join_path(self.build_directory, "clients", "staging", "hipsolver-test") - exe = which(exe) + exe = which(exe, required=True) exe(["--gtest_filter=-*known_bug*"]) @classmethod diff --git a/repos/spack_repo/builtin/packages/homer/package.py b/repos/spack_repo/builtin/packages/homer/package.py index 98bb04597c2..4f5c7d98f38 100644 --- a/repos/spack_repo/builtin/packages/homer/package.py +++ b/repos/spack_repo/builtin/packages/homer/package.py @@ -45,7 +45,7 @@ def install(self, spec, prefix): ) # compile/prepare binaries and perl scripts with the correct paths - perl = which("perl") + perl = which("perl", required=True) perl("configureHomer.pl", "-local") # download extra data if requested diff --git a/repos/spack_repo/builtin/packages/hpctoolkit/package.py b/repos/spack_repo/builtin/packages/hpctoolkit/package.py index ef38af8e59e..05a7309149b 100644 --- a/repos/spack_repo/builtin/packages/hpctoolkit/package.py +++ b/repos/spack_repo/builtin/packages/hpctoolkit/package.py @@ -330,15 +330,15 @@ def test_sort(self): cxx = Executable(self["cxx"].cxx) cxx(self.test_suite.current_test_data_dir.join("sort.cpp"), "-o", exe) - hpcrun = which("hpcrun") + hpcrun = which("hpcrun", required=True) meas = "tst-sort.m" hpcrun("-e", "REALTIME@5000", "-t", "-o", meas, "./" + exe) - hpcstruct = which("hpcstruct") + hpcstruct = which("hpcstruct", required=True) struct = "tst-sort.hpcstruct" hpcstruct("-j", "4", "--time", "-o", struct, "./" + exe) - hpcprof = which("hpcprof") + hpcprof = which("hpcprof", required=True) db = "tst-sort.d" hpcprof("-S", struct, "-o", db, meas) diff --git a/repos/spack_repo/builtin/packages/hsakmt_roct/package.py b/repos/spack_repo/builtin/packages/hsakmt_roct/package.py index 40aaf9896c0..0b6c6b8a4cb 100644 --- a/repos/spack_repo/builtin/packages/hsakmt_roct/package.py +++ b/repos/spack_repo/builtin/packages/hsakmt_roct/package.py @@ -92,10 +92,10 @@ def check_install(self): ] cmake = self.spec["cmake"].command cmake(*cc_options) - make = which("make") + make = which("make", required=True) make() os.environ["LD_LIBRARY_PATH"] = hsakmt_path os.environ["BIN_DIR"] = os.getcwd() - run_kfdtest = which(join_path("scripts", "run_kfdtest.sh")) + run_kfdtest = which(join_path("scripts", "run_kfdtest.sh"), required=True) run_kfdtest() make("clean") diff --git a/repos/spack_repo/builtin/packages/hub/package.py b/repos/spack_repo/builtin/packages/hub/package.py index 5b3269beb25..cbdb22d7b97 100644 --- a/repos/spack_repo/builtin/packages/hub/package.py +++ b/repos/spack_repo/builtin/packages/hub/package.py @@ -30,7 +30,7 @@ def install(self, spec, prefix): if spec.version < Version("2.14"): env["GOPATH"] = self.stage.source_path + ":" + env["GOPATH"] env["GO111MODULE"] = "off" - bash = which("bash") + bash = which("bash", required=True) bash(os.path.join("script", "build"), "-o", prefix.bin.hub) return env["GO111MODULE"] = "on" diff --git a/repos/spack_repo/builtin/packages/hunspell/package.py b/repos/spack_repo/builtin/packages/hunspell/package.py index 2c1cfa3245a..4ed7dd3633e 100644 --- a/repos/spack_repo/builtin/packages/hunspell/package.py +++ b/repos/spack_repo/builtin/packages/hunspell/package.py @@ -31,5 +31,5 @@ class Hunspell(AutotoolsPackage): # TODO: If https://github.com/spack/spack/pull/12344 is merged, this # method is unnecessary. def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf("-fiv") diff --git a/repos/spack_repo/builtin/packages/hyperqueue/package.py b/repos/spack_repo/builtin/packages/hyperqueue/package.py index 0dfd8ff4819..3f416987707 100644 --- a/repos/spack_repo/builtin/packages/hyperqueue/package.py +++ b/repos/spack_repo/builtin/packages/hyperqueue/package.py @@ -34,5 +34,5 @@ class Hyperqueue(Package): depends_on("rust@1.59:") def install(self, spec, prefix): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("install", "--root", prefix, "--path", "crates/hyperqueue") diff --git a/repos/spack_repo/builtin/packages/hypre/package.py b/repos/spack_repo/builtin/packages/hypre/package.py index d908c8acd32..476100427e8 100644 --- a/repos/spack_repo/builtin/packages/hypre/package.py +++ b/repos/spack_repo/builtin/packages/hypre/package.py @@ -290,7 +290,7 @@ def test_bigint(self): # build and run cached examples with working_dir(self._cached_tests_work_dir): - make = which("make") + make = which("make", required=True) make("bigint") for name in ["ex5big", "ex15big"]: diff --git a/repos/spack_repo/builtin/packages/hypre_cmake/package.py b/repos/spack_repo/builtin/packages/hypre_cmake/package.py index 6af03859ced..ee408e4c1aa 100644 --- a/repos/spack_repo/builtin/packages/hypre_cmake/package.py +++ b/repos/spack_repo/builtin/packages/hypre_cmake/package.py @@ -128,12 +128,12 @@ def test_bigint(self): # Build and run cached examples with working_dir(self._cached_tests_work_dir): - make = which("make") + make = which("make", required=True) make("bigint") for exe_name in ["ex5big", "ex15big"]: with test_part(self, f"test_bigint_{exe_name}", purpose=f"Ensure {exe_name} runs"): - program = which(exe_name) + program = which(exe_name, required=True) if program is None: raise SkipTest(f"{exe_name} does not exist in version {self.version}") diff --git a/repos/spack_repo/builtin/packages/icarus/package.py b/repos/spack_repo/builtin/packages/icarus/package.py index 6db00262968..40075883354 100644 --- a/repos/spack_repo/builtin/packages/icarus/package.py +++ b/repos/spack_repo/builtin/packages/icarus/package.py @@ -36,7 +36,7 @@ class Icarus(AutotoolsPackage): patch("fix-gcc-10.patch", when="@v10_3") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autoconf.sh") @run_before("install") diff --git a/repos/spack_repo/builtin/packages/iegenlib/package.py b/repos/spack_repo/builtin/packages/iegenlib/package.py index 82341feb186..de6a0cefbb1 100644 --- a/repos/spack_repo/builtin/packages/iegenlib/package.py +++ b/repos/spack_repo/builtin/packages/iegenlib/package.py @@ -37,7 +37,7 @@ class Iegenlib(CMakePackage): @run_before("cmake") def make_dirs(self): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) with working_dir("lib/isl"): autoreconf("-i") mkdirp("spack-build/bin") diff --git a/repos/spack_repo/builtin/packages/improved_rdock/package.py b/repos/spack_repo/builtin/packages/improved_rdock/package.py index 585cefa9094..bb384e8d00d 100644 --- a/repos/spack_repo/builtin/packages/improved_rdock/package.py +++ b/repos/spack_repo/builtin/packages/improved_rdock/package.py @@ -70,11 +70,11 @@ def test_rdock(self): copy(join_path(self.prefix.example, "1sj0", "*"), ".") with test_part(self, "test_rdock_rbcavity", purpose="Check rbcavity"): - rbcavity = which("rbcavity") + rbcavity = which("rbcavity", required=True) rbcavity("-r", "1sj0_rdock.prm", "-was") with test_part(self, "test_rdock_rbdock", purpose="Use mpirun to run rbdock in parallel"): - mpiexe = which(str(self.spec["mpi"].prefix.bin.mpirun)) + mpiexe = which(str(self.spec["mpi"].prefix.bin.mpirun), required=True) opts = [ self.prefix.bin.rbdock, "-r", @@ -93,12 +93,12 @@ def test_rdock(self): mpiexe(*opts) with test_part(self, "test_rdock_test_sh", purpose="Sort the output"): - bash = which("bash") + bash = which("bash", required=True) opts = [join_path(self.test_suite.current_test_data_dir, "test.sh")] bash(*opts) with test_part(self, "test_rdock_sdrmsd", purpose="Check sdrmsd calculations"): - pythonexe = which(str(self.spec["python"].command.path)) + pythonexe = which(str(self.spec["python"].command.path), required=True) opts = [self.spec.prefix.bin.sdrmsd, "1sj0_ligand.sd", "1sj0_docking_out_sorted.sd"] expected = ["1\t0.55", "100\t7.91"] out = pythonexe(*opts, out=str.split, error=str.split) diff --git a/repos/spack_repo/builtin/packages/intel_oneapi_compilers/package.py b/repos/spack_repo/builtin/packages/intel_oneapi_compilers/package.py index ca0f83543bb..e01053defaf 100644 --- a/repos/spack_repo/builtin/packages/intel_oneapi_compilers/package.py +++ b/repos/spack_repo/builtin/packages/intel_oneapi_compilers/package.py @@ -625,7 +625,7 @@ def inject_rpaths(self): return # 2024 fixed all but these 2 - patchelf = which("patchelf") + patchelf = which("patchelf", required=True) if self.spec.satisfies("@2024:"): patchelf.add_default_arg("--set-rpath", self.component_prefix.lib) patchelf(self.component_prefix.bin.join("sycl-post-link")) diff --git a/repos/spack_repo/builtin/packages/interproscan/package.py b/repos/spack_repo/builtin/packages/interproscan/package.py index 719cf49651b..ec2f19fe8d2 100644 --- a/repos/spack_repo/builtin/packages/interproscan/package.py +++ b/repos/spack_repo/builtin/packages/interproscan/package.py @@ -114,11 +114,11 @@ class Interproscan(Package): def install(self, spec, prefix): with working_dir("core"): if self.run_tests: - which("mvn")("verify") + which("mvn", required=True)("verify") else: - which("mvn")("clean", "install", "-DskipTests") + which("mvn", required=True)("clean", "install", "-DskipTests") with working_dir("jms-implementation"): - which("mvn")("clean", "package", "-DskipTests") + which("mvn", required=True)("clean", "package", "-DskipTests") target = join_path("core", "jms-implementation", "target", "interproscan-5-dist") install_tree(target, prefix) @@ -132,7 +132,7 @@ def install(self, spec, prefix): @when("@:4.8") def install(self, spec, prefix): - perl = which("perl") + perl = which("perl", required=True) src = join_path(self.stage.source_path, "iprscan", "bin", "Linux") dst = join_path(self.stage.source_path, "bin", "binaries") diff --git a/repos/spack_repo/builtin/packages/isoquant/package.py b/repos/spack_repo/builtin/packages/isoquant/package.py index 9a7e295f22d..589048bf87a 100644 --- a/repos/spack_repo/builtin/packages/isoquant/package.py +++ b/repos/spack_repo/builtin/packages/isoquant/package.py @@ -39,7 +39,7 @@ class Isoquant(Package): depends_on("py-seaborn@0.10.0:", type="run") def install(self, spec, prefix): - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", "isoquant.py", "visualize.py") mkdirp(prefix.bin) install("*.py", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/kallisto/package.py b/repos/spack_repo/builtin/packages/kallisto/package.py index 1685987c60f..f671ea91d97 100644 --- a/repos/spack_repo/builtin/packages/kallisto/package.py +++ b/repos/spack_repo/builtin/packages/kallisto/package.py @@ -52,7 +52,7 @@ def autoreconf(self): # config.sub in the tree. if self.spec.satisfies("@0.44.0:^autoconf@2.70:"): with working_dir(join_path(self.stage.source_path, "ext", "htslib")): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf("--install") # Including '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' in the cmake args diff --git a/repos/spack_repo/builtin/packages/kmod/package.py b/repos/spack_repo/builtin/packages/kmod/package.py index ae4455cac1b..e0711cd7a02 100644 --- a/repos/spack_repo/builtin/packages/kmod/package.py +++ b/repos/spack_repo/builtin/packages/kmod/package.py @@ -32,7 +32,7 @@ class Kmod(AutotoolsPackage): depends_on("xz") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/krakenuniq/package.py b/repos/spack_repo/builtin/packages/krakenuniq/package.py index f2d80d6e6d3..8dfc3f60554 100644 --- a/repos/spack_repo/builtin/packages/krakenuniq/package.py +++ b/repos/spack_repo/builtin/packages/krakenuniq/package.py @@ -35,7 +35,7 @@ class Krakenuniq(Package): depends_on("wget", when="+jellyfish") def install(self, spec, prefix): - local_script = which("./install_krakenuniq.sh") + local_script = which("./install_krakenuniq.sh", required=True) if self.spec.satisfies("+jellyfish"): local_script("-j", prefix.bin) else: diff --git a/repos/spack_repo/builtin/packages/krb5/package.py b/repos/spack_repo/builtin/packages/krb5/package.py index 9d5976a352d..5b050b45693 100644 --- a/repos/spack_repo/builtin/packages/krb5/package.py +++ b/repos/spack_repo/builtin/packages/krb5/package.py @@ -79,7 +79,7 @@ def configure_args(self): args.append("CFLAGS=-fcommon") if spec["openssl"].satisfies("~shared"): - pkgconf = which("pkg-config") + pkgconf = which("pkg-config", required=True) ssllibs = pkgconf("--static", "--libs", "openssl", output=str) args.append(f"LDFLAGS={ssllibs}") diff --git a/repos/spack_repo/builtin/packages/latex2html/package.py b/repos/spack_repo/builtin/packages/latex2html/package.py index 7a8019db5a9..25092915db4 100644 --- a/repos/spack_repo/builtin/packages/latex2html/package.py +++ b/repos/spack_repo/builtin/packages/latex2html/package.py @@ -118,7 +118,7 @@ def configure_args(self): else: # This should be the only needed code if texlive where # to set its proper dependent_build_environment - exe = which(p) + exe = which(p, required=True) if exe: args.append("--with-{0}={1}".format(p, str(exe))) if spec.satisfies("+svg"): @@ -127,7 +127,7 @@ def configure_args(self): if os.path.exists(exe): args.append("--with-{0}={1}".format(p, exe)) else: - exe = which(p) + exe = which(p, required=True) if exe: args.append("--with-{0}={1}".format(p, str(exe))) diff --git a/repos/spack_repo/builtin/packages/legion/package.py b/repos/spack_repo/builtin/packages/legion/package.py index 384809a7848..82a46d33a87 100644 --- a/repos/spack_repo/builtin/packages/legion/package.py +++ b/repos/spack_repo/builtin/packages/legion/package.py @@ -456,7 +456,7 @@ def build(self, spec, prefix): super().build(spec, prefix) if spec.satisfies("+prof"): with working_dir(join_path(self.stage.source_path, "tools", "legion_prof_rs")): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("install", "--root", "out", "--path", ".", "--all-features", "--locked") def install(self, spec, prefix): @@ -491,8 +491,8 @@ def test_run_local_function_tasks(self): cmake = self.spec["cmake"].command cmake(*cmake_args) - make = which("make") + make = which("make", required=True) make() - exe = which("local_function_tasks") + exe = which("local_function_tasks", required=True) exe() diff --git a/repos/spack_repo/builtin/packages/lhapdfsets/package.py b/repos/spack_repo/builtin/packages/lhapdfsets/package.py index 3464fe55eee..70ac37031e9 100644 --- a/repos/spack_repo/builtin/packages/lhapdfsets/package.py +++ b/repos/spack_repo/builtin/packages/lhapdfsets/package.py @@ -39,8 +39,8 @@ class Lhapdfsets(BundlePackage): def install(self, spec, prefix): mkdirp(self.prefix.share.lhapdfsets) - tar = which("tar") - curl = which("curl") + tar = which("tar", required=True) + curl = which("curl", required=True) sets = self.spec.variants["sets"].value if len(sets) == 1: if sets[0] == "all": diff --git a/repos/spack_repo/builtin/packages/libabigail/package.py b/repos/spack_repo/builtin/packages/libabigail/package.py index 3fcb272e84f..82203fa1b06 100644 --- a/repos/spack_repo/builtin/packages/libabigail/package.py +++ b/repos/spack_repo/builtin/packages/libabigail/package.py @@ -64,7 +64,7 @@ def configure_args(self): return config_args def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) with working_dir(self.configure_directory): # We need force (f) because without it, looks for RedHat library autoreconf("-ivf") diff --git a/repos/spack_repo/builtin/packages/libbeagle/package.py b/repos/spack_repo/builtin/packages/libbeagle/package.py index 06815ff140c..4eb0ee9f91e 100644 --- a/repos/spack_repo/builtin/packages/libbeagle/package.py +++ b/repos/spack_repo/builtin/packages/libbeagle/package.py @@ -66,7 +66,7 @@ def patch(self): ) def autoreconf(self, spec, prefix): - which("bash")("autogen.sh") + which("bash", required=True)("autogen.sh") def configure_args(self): args = [ diff --git a/repos/spack_repo/builtin/packages/libcatalyst/package.py b/repos/spack_repo/builtin/packages/libcatalyst/package.py index ff17fd55fbb..fb9a7177cb8 100644 --- a/repos/spack_repo/builtin/packages/libcatalyst/package.py +++ b/repos/spack_repo/builtin/packages/libcatalyst/package.py @@ -87,7 +87,7 @@ def build_test(self): # for the current package being tested, including the package # itself make_package_test_rpath(self, adapter0_test_path) - cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) with working_dir(testdir, create=True): cmake(*cmake_args) diff --git a/repos/spack_repo/builtin/packages/libcircle/package.py b/repos/spack_repo/builtin/packages/libcircle/package.py index 946104acde2..d3cf8ab0d71 100644 --- a/repos/spack_repo/builtin/packages/libcircle/package.py +++ b/repos/spack_repo/builtin/packages/libcircle/package.py @@ -46,5 +46,5 @@ def force_autoreconf(self): def autoreconf(self, spec, prefix): with working_dir(self.configure_directory): # Bootstrap with autotools - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/libconfuse/package.py b/repos/spack_repo/builtin/packages/libconfuse/package.py index 93fbd1d16b7..3994a7940cd 100644 --- a/repos/spack_repo/builtin/packages/libconfuse/package.py +++ b/repos/spack_repo/builtin/packages/libconfuse/package.py @@ -29,5 +29,5 @@ class Libconfuse(AutotoolsPackage): depends_on("flex", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/libcxi/package.py b/repos/spack_repo/builtin/packages/libcxi/package.py index e228e89b3f3..c7b7191c7a8 100644 --- a/repos/spack_repo/builtin/packages/libcxi/package.py +++ b/repos/spack_repo/builtin/packages/libcxi/package.py @@ -60,7 +60,7 @@ def patch(self): ) def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") def setup_build_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/libfabric/package.py b/repos/spack_repo/builtin/packages/libfabric/package.py index c19da170d10..9bfd5f6348d 100644 --- a/repos/spack_repo/builtin/packages/libfabric/package.py +++ b/repos/spack_repo/builtin/packages/libfabric/package.py @@ -235,7 +235,7 @@ def setup_dependent_run_environment( @when("@main") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/libfastcommon/package.py b/repos/spack_repo/builtin/packages/libfastcommon/package.py index dd805cf83fd..d16e10d9c59 100644 --- a/repos/spack_repo/builtin/packages/libfastcommon/package.py +++ b/repos/spack_repo/builtin/packages/libfastcommon/package.py @@ -28,7 +28,7 @@ class Libfastcommon(Package): depends_on("c", type="build") # generated def install(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("make.sh") sh("make.sh", "install") install_tree(".", prefix) diff --git a/repos/spack_repo/builtin/packages/libgeopm/package.py b/repos/spack_repo/builtin/packages/libgeopm/package.py index aec30d5187c..ff4f9ab5ed7 100644 --- a/repos/spack_repo/builtin/packages/libgeopm/package.py +++ b/repos/spack_repo/builtin/packages/libgeopm/package.py @@ -95,7 +95,7 @@ def install_targets(self): return target def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) with working_dir(self.configure_directory): if not spec.version.isdevelop(): version_file = "VERSION" diff --git a/repos/spack_repo/builtin/packages/libgeopmd/package.py b/repos/spack_repo/builtin/packages/libgeopmd/package.py index 64ccffaac33..9ba283375e4 100644 --- a/repos/spack_repo/builtin/packages/libgeopmd/package.py +++ b/repos/spack_repo/builtin/packages/libgeopmd/package.py @@ -101,7 +101,7 @@ class Libgeopmd(AutotoolsPackage): configure_directory = "libgeopmd" def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) with working_dir(self.configure_directory): if not spec.version.isdevelop(): version_file = "VERSION" diff --git a/repos/spack_repo/builtin/packages/libgridxc/package.py b/repos/spack_repo/builtin/packages/libgridxc/package.py index 4dd6a3e64c9..a540876e74f 100644 --- a/repos/spack_repo/builtin/packages/libgridxc/package.py +++ b/repos/spack_repo/builtin/packages/libgridxc/package.py @@ -40,7 +40,7 @@ class Libgridxc(MakefilePackage): parallel = False def edit(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) with working_dir("build", create=True): sh("../src/config.sh") copy("../extra/fortran.mk", "fortran.mk") diff --git a/repos/spack_repo/builtin/packages/libharu/package.py b/repos/spack_repo/builtin/packages/libharu/package.py index 970c4184576..551c4e0d901 100644 --- a/repos/spack_repo/builtin/packages/libharu/package.py +++ b/repos/spack_repo/builtin/packages/libharu/package.py @@ -61,7 +61,7 @@ class AutotoolsBuilder(autotools.AutotoolsBuilder): def autoreconf(self, spec, prefix): """execute their autotools wrapper script""" if os.path.exists("./buildconf.sh"): - bash = which("bash") + bash = which("bash", required=True) bash("./buildconf.sh", "--force") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/libint/package.py b/repos/spack_repo/builtin/packages/libint/package.py index 35b4bc64871..0f5b20cd336 100644 --- a/repos/spack_repo/builtin/packages/libint/package.py +++ b/repos/spack_repo/builtin/packages/libint/package.py @@ -99,7 +99,7 @@ def url_for_version(self, version): def autoreconf(self, spec, prefix): if self.spec.satisfies("@2:"): - which("bash")("autogen.sh") + which("bash", required=True)("autogen.sh") else: # Fall back since autogen is not available libtoolize() diff --git a/repos/spack_repo/builtin/packages/libmbim/package.py b/repos/spack_repo/builtin/packages/libmbim/package.py index 08f6119b3a3..d2a2faa20f7 100644 --- a/repos/spack_repo/builtin/packages/libmbim/package.py +++ b/repos/spack_repo/builtin/packages/libmbim/package.py @@ -33,5 +33,5 @@ class Libmbim(AutotoolsPackage): depends_on("glib@:2.62.0") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/libnfsidmap/package.py b/repos/spack_repo/builtin/packages/libnfsidmap/package.py index 5c931beba26..24f5d01449d 100644 --- a/repos/spack_repo/builtin/packages/libnfsidmap/package.py +++ b/repos/spack_repo/builtin/packages/libnfsidmap/package.py @@ -24,5 +24,5 @@ class Libnfsidmap(AutotoolsPackage): depends_on("m4", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/libnsl/package.py b/repos/spack_repo/builtin/packages/libnsl/package.py index c9dff223be2..fa077c67010 100644 --- a/repos/spack_repo/builtin/packages/libnsl/package.py +++ b/repos/spack_repo/builtin/packages/libnsl/package.py @@ -38,5 +38,5 @@ class Libnsl(AutotoolsPackage): depends_on("libtirpc") def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) autoreconf("-fi") diff --git a/repos/spack_repo/builtin/packages/libp11/package.py b/repos/spack_repo/builtin/packages/libp11/package.py index 787f22c6f74..29605e31875 100644 --- a/repos/spack_repo/builtin/packages/libp11/package.py +++ b/repos/spack_repo/builtin/packages/libp11/package.py @@ -37,5 +37,5 @@ class Libp11(AutotoolsPackage): depends_on("openssl") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap") diff --git a/repos/spack_repo/builtin/packages/libpam/package.py b/repos/spack_repo/builtin/packages/libpam/package.py index f31b4e223df..4f99d8d7c09 100644 --- a/repos/spack_repo/builtin/packages/libpam/package.py +++ b/repos/spack_repo/builtin/packages/libpam/package.py @@ -29,5 +29,5 @@ class Libpam(AutotoolsPackage): depends_on("linux-pam") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap.sh") diff --git a/repos/spack_repo/builtin/packages/libpostal/package.py b/repos/spack_repo/builtin/packages/libpostal/package.py index ee03497517f..06acd64a1d4 100644 --- a/repos/spack_repo/builtin/packages/libpostal/package.py +++ b/repos/spack_repo/builtin/packages/libpostal/package.py @@ -36,7 +36,7 @@ class Libpostal(AutotoolsPackage): depends_on("pkgconfig", type="build") def autoreconf(self, spec, prefix): - which("sh")("bootstrap.sh") + which("sh", required=True)("bootstrap.sh") def configure_args(self): args = ["--datadir={0}".format(self.prefix.share)] diff --git a/repos/spack_repo/builtin/packages/libpressio/package.py b/repos/spack_repo/builtin/packages/libpressio/package.py index 288c2a8363d..14ed251ec46 100644 --- a/repos/spack_repo/builtin/packages/libpressio/package.py +++ b/repos/spack_repo/builtin/packages/libpressio/package.py @@ -438,7 +438,7 @@ def test_smoke(self): cmake(*args) cmake("--build", ".") - exe = which("pressio_smoke_tests") + exe = which("pressio_smoke_tests", required=True) out = exe(output=str.split, error=str.split) expected = "all passed" diff --git a/repos/spack_repo/builtin/packages/libquo/package.py b/repos/spack_repo/builtin/packages/libquo/package.py index 29022398831..c1899010f4e 100644 --- a/repos/spack_repo/builtin/packages/libquo/package.py +++ b/repos/spack_repo/builtin/packages/libquo/package.py @@ -40,7 +40,7 @@ class Libquo(AutotoolsPackage): @when("@develop") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/librttopo/package.py b/repos/spack_repo/builtin/packages/librttopo/package.py index 9e44f402648..8ebfcf008b4 100644 --- a/repos/spack_repo/builtin/packages/librttopo/package.py +++ b/repos/spack_repo/builtin/packages/librttopo/package.py @@ -31,5 +31,5 @@ class Librttopo(AutotoolsPackage): depends_on("m4", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/libsharp/package.py b/repos/spack_repo/builtin/packages/libsharp/package.py index 7d349002239..9680a1135ba 100644 --- a/repos/spack_repo/builtin/packages/libsharp/package.py +++ b/repos/spack_repo/builtin/packages/libsharp/package.py @@ -35,7 +35,7 @@ class Libsharp(AutotoolsPackage): def autoreconf(self, spec, prefix): """Generate autotools configuration""" - bash = which("bash") + bash = which("bash", required=True) bash("autoconf") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/libsigsegv/package.py b/repos/spack_repo/builtin/packages/libsigsegv/package.py index d1f2efba690..35f170dd2d9 100644 --- a/repos/spack_repo/builtin/packages/libsigsegv/package.py +++ b/repos/spack_repo/builtin/packages/libsigsegv/package.py @@ -56,10 +56,10 @@ def test_smoke_test(self): "{0}{1}".format(self.compiler.cc_rpath_arg, self.prefix.lib), ] - cc = which(os.environ["CC"]) + cc = which(os.environ["CC"], required=True) cc(*options) - exe = which(prog) + exe = which(prog, required=True) out = exe(output=str.split, error=str.split) expected = get_escaped_text_output(data_dir.join("smoke_test.out")) check_outputs(expected, out) diff --git a/repos/spack_repo/builtin/packages/libtorrent/package.py b/repos/spack_repo/builtin/packages/libtorrent/package.py index 7ebf90c2f31..42c0d9e8e45 100644 --- a/repos/spack_repo/builtin/packages/libtorrent/package.py +++ b/repos/spack_repo/builtin/packages/libtorrent/package.py @@ -21,5 +21,5 @@ class Libtorrent(AutotoolsPackage): depends_on("cxx", type="build") # generated def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/libunistring/package.py b/repos/spack_repo/builtin/packages/libunistring/package.py index cdf20f5670c..b4d11defe6a 100644 --- a/repos/spack_repo/builtin/packages/libunistring/package.py +++ b/repos/spack_repo/builtin/packages/libunistring/package.py @@ -55,5 +55,5 @@ def flag_handler(self, name, flags): @when("@master") def autoreconf(self, spec, prefix): - which("./gitsub.sh")("pull") - which("./autogen.sh")() + which("./gitsub.sh", required=True)("pull") + which("./autogen.sh", required=True)() diff --git a/repos/spack_repo/builtin/packages/libxml2/package.py b/repos/spack_repo/builtin/packages/libxml2/package.py index 63805e772f7..a63a53f8786 100644 --- a/repos/spack_repo/builtin/packages/libxml2/package.py +++ b/repos/spack_repo/builtin/packages/libxml2/package.py @@ -119,7 +119,7 @@ def test_xmlcatalog(self): if not os.path.exists(path): raise SkipTest("xmlcatalog is not installed") - xmlcatalog = which(path) + xmlcatalog = which(path, required=True) out = xmlcatalog("--create", output=str.split, error=str.split) expected = [r"'] @@ -131,7 +131,7 @@ def test_xml2_config(self): if not os.path.exists(path): raise SkipTest("xml2-config is not installed") - xml2_config = which(path) + xml2_config = which(path, required=True) out = xml2_config("--version", output=str.split, error=str.split) assert str(self.spec.version) in out @@ -142,7 +142,7 @@ def test_xmllint(self): raise SkipTest("xmllint is not installed") test_filename = "test.xml" - xmllint = which(path) + xmllint = which(path, required=True) with test_part(self, "test_xmllint_auto", purpose="generate {0}".format(test_filename)): xmllint("--auto", "-o", test_filename) diff --git a/repos/spack_repo/builtin/packages/libzmq/package.py b/repos/spack_repo/builtin/packages/libzmq/package.py index bc4306eeaab..991f1dfd39b 100644 --- a/repos/spack_repo/builtin/packages/libzmq/package.py +++ b/repos/spack_repo/builtin/packages/libzmq/package.py @@ -105,7 +105,7 @@ def url_for_version(self, version): @when("@master") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/llvm/package.py b/repos/spack_repo/builtin/packages/llvm/package.py index 7f50ff0c1f7..4b6fcceaada 100644 --- a/repos/spack_repo/builtin/packages/llvm/package.py +++ b/repos/spack_repo/builtin/packages/llvm/package.py @@ -852,7 +852,7 @@ def libs(self): @run_before("cmake") def codesign_check(self): if self.spec.satisfies("+code_signing"): - codesign = which("codesign") + codesign = which("codesign", required=True) mkdir("tmp") llvm_check_file = join_path("tmp", "llvm_check") copy("/usr/bin/false", llvm_check_file) diff --git a/repos/spack_repo/builtin/packages/llvm_doe/package.py b/repos/spack_repo/builtin/packages/llvm_doe/package.py index 48bb7ebf5fd..b7d22dc0252 100644 --- a/repos/spack_repo/builtin/packages/llvm_doe/package.py +++ b/repos/spack_repo/builtin/packages/llvm_doe/package.py @@ -346,7 +346,7 @@ def f77(self): @run_before("cmake") def codesign_check(self): if self.spec.satisfies("+code_signing"): - codesign = which("codesign") + codesign = which("codesign", required=True) mkdir("tmp") llvm_check_file = join_path("tmp", "llvm_check") copy("/usr/bin/false", llvm_check_file) diff --git a/repos/spack_repo/builtin/packages/lp_solve/package.py b/repos/spack_repo/builtin/packages/lp_solve/package.py index fb6d2cb780b..13102e768cd 100644 --- a/repos/spack_repo/builtin/packages/lp_solve/package.py +++ b/repos/spack_repo/builtin/packages/lp_solve/package.py @@ -20,12 +20,12 @@ class LpSolve(Package): def install(self, spec, prefix): with working_dir("lpsolve55"): mkdir(prefix.lib) - sh = which("sh") + sh = which("sh", required=True) sh("-x", "ccc") install_tree("bin/ux64", prefix.lib) with working_dir("lp_solve"): mkdir(prefix.bin) - sh = which("sh") + sh = which("sh", required=True) sh("-x", "ccc") install_tree("bin/ux64", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/lsof/package.py b/repos/spack_repo/builtin/packages/lsof/package.py index 7f834475939..e531cd6d189 100644 --- a/repos/spack_repo/builtin/packages/lsof/package.py +++ b/repos/spack_repo/builtin/packages/lsof/package.py @@ -23,7 +23,7 @@ class Lsof(Package): depends_on("gmake", type="build") def install(self, spec, prefix): - tar = which("tar") + tar = which("tar", required=True) tar("xf", "lsof_{0}_src.tar".format(self.version)) with working_dir("lsof_{0}_src".format(self.version)): diff --git a/repos/spack_repo/builtin/packages/m4/package.py b/repos/spack_repo/builtin/packages/m4/package.py index 5284c686ead..2fdac042637 100644 --- a/repos/spack_repo/builtin/packages/m4/package.py +++ b/repos/spack_repo/builtin/packages/m4/package.py @@ -146,7 +146,7 @@ def configure_args(self): def test_version(self): """ensure m4 version matches installed spec""" - m4 = which(self.prefix.bin.m4) + m4 = which(self.prefix.bin.m4, required=True) out = m4("--version", output=str.split, error=str.split) assert str(self.spec.version) in out @@ -154,7 +154,7 @@ def test_hello(self): """ensure m4 hello example runs""" test_data_dir = self.test_suite.current_test_data_dir hello_file = test_data_dir.join("hello.m4") - m4 = which(self.prefix.bin.m4) + m4 = which(self.prefix.bin.m4, required=True) out = m4(hello_file, output=str.split, error=str.split) expected = get_escaped_text_output(test_data_dir.join("hello.out")) diff --git a/repos/spack_repo/builtin/packages/magma/package.py b/repos/spack_repo/builtin/packages/magma/package.py index 9f6286b5273..5077dec068d 100644 --- a/repos/spack_repo/builtin/packages/magma/package.py +++ b/repos/spack_repo/builtin/packages/magma/package.py @@ -211,7 +211,7 @@ def test_c(self): for test, desc in tests: with test_part(self, f"test_c_{test}", purpose=f"Run {desc} example"): - exe = which(test) + exe = which(test, required=True) exe() make("clean") @@ -227,6 +227,6 @@ def test_fortran(self): with set_env(PKG_CONFIG_PATH=pkg_config_path): make = self.spec["gmake"].command make("fortran") - example_f = which("example_f") + example_f = which("example_f", required=True) example_f() make("clean") diff --git a/repos/spack_repo/builtin/packages/maker/package.py b/repos/spack_repo/builtin/packages/maker/package.py index faf857d39d1..001adb7dc58 100644 --- a/repos/spack_repo/builtin/packages/maker/package.py +++ b/repos/spack_repo/builtin/packages/maker/package.py @@ -77,8 +77,8 @@ def install(self, spec, prefix): repl = "my $go = 1;" filter_file(pattern, repl, "Build.PL", backup=False) - perl = which("perl") - rm = which("rm") + perl = which("perl", required=True) + rm = which("rm", required=True) with working_dir("src"): perl("Build.PL", "--install_base", prefix) perl("Build", "install") diff --git a/repos/spack_repo/builtin/packages/maqao/package.py b/repos/spack_repo/builtin/packages/maqao/package.py index b3efe529305..c2d08db0867 100644 --- a/repos/spack_repo/builtin/packages/maqao/package.py +++ b/repos/spack_repo/builtin/packages/maqao/package.py @@ -53,6 +53,6 @@ def install(self, spec, prefix): ) ) # Installing from archive - tar = which("tar") + tar = which("tar", required=True) tar("xJf", self.stage.archive_file) install_tree(".", prefix) diff --git a/repos/spack_repo/builtin/packages/mark/package.py b/repos/spack_repo/builtin/packages/mark/package.py index 4b6483b81c5..f306932f578 100644 --- a/repos/spack_repo/builtin/packages/mark/package.py +++ b/repos/spack_repo/builtin/packages/mark/package.py @@ -37,5 +37,5 @@ def install(self, spec, prefix): mkdir(prefix.bin) install("mark", prefix.bin) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", prefix.bin.mark) diff --git a/repos/spack_repo/builtin/packages/mathematica/package.py b/repos/spack_repo/builtin/packages/mathematica/package.py index 6f14584cc25..e818214a341 100644 --- a/repos/spack_repo/builtin/packages/mathematica/package.py +++ b/repos/spack_repo/builtin/packages/mathematica/package.py @@ -56,7 +56,7 @@ def install(self, spec, prefix): # Backup .spack because Mathematica moves it but never restores it copy_tree(join_path(prefix, ".spack"), join_path(self.stage.path, ".spack")) - sh = which("sh") + sh = which("sh", required=True) sh( self.stage.archive_file, "--", @@ -70,7 +70,7 @@ def install(self, spec, prefix): # does not symlink it ws_link_path = os.path.join(prefix.bin, "wolframscript") if not os.path.exists(ws_link_path): - ln = which("ln") + ln = which("ln", required=True) ws_path = os.path.join(prefix, "Executables", "wolframscript") ln("-s", ws_path, ws_link_path) diff --git a/repos/spack_repo/builtin/packages/mdsplus/package.py b/repos/spack_repo/builtin/packages/mdsplus/package.py index 77defa6475f..9f115b59d74 100644 --- a/repos/spack_repo/builtin/packages/mdsplus/package.py +++ b/repos/spack_repo/builtin/packages/mdsplus/package.py @@ -56,7 +56,7 @@ def configure_args(self): return self.enable_or_disable("java") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap") def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/memcached/package.py b/repos/spack_repo/builtin/packages/memcached/package.py index dcfad9751b1..c87c41ffcf0 100644 --- a/repos/spack_repo/builtin/packages/memcached/package.py +++ b/repos/spack_repo/builtin/packages/memcached/package.py @@ -36,7 +36,7 @@ class Memcached(AutotoolsPackage): depends_on("libevent", type="build") def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("./autogen.sh") autoreconf("--install", "--verbose", "--force") diff --git a/repos/spack_repo/builtin/packages/memkind/package.py b/repos/spack_repo/builtin/packages/memkind/package.py index d62427e7933..905bcd68236 100644 --- a/repos/spack_repo/builtin/packages/memkind/package.py +++ b/repos/spack_repo/builtin/packages/memkind/package.py @@ -61,10 +61,10 @@ def patch(self): @run_before("autoreconf") def build_jemalloc(self): if os.path.exists("build_jemalloc.sh"): - bash = which("bash") + bash = which("bash", required=True) bash("./build_jemalloc.sh") def autoreconf(self, spec, prefix): if os.path.exists("autogen.sh"): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/metis/package.py b/repos/spack_repo/builtin/packages/metis/package.py index f189618bedc..70263a2e9d4 100644 --- a/repos/spack_repo/builtin/packages/metis/package.py +++ b/repos/spack_repo/builtin/packages/metis/package.py @@ -250,7 +250,7 @@ def install_headers(self): def check(self): # On some systems, the installed binaries for METIS cannot # be executed without first being read. - ls = which("ls") + ls = which("ls", required=True) ls("-a", "-l", self.prefix.bin) graphchk = Executable(join_path(self.prefix.bin, "graphchk")) diff --git a/repos/spack_repo/builtin/packages/mfem/package.py b/repos/spack_repo/builtin/packages/mfem/package.py index 91ede220bd8..5ec687965db 100644 --- a/repos/spack_repo/builtin/packages/mfem/package.py +++ b/repos/spack_repo/builtin/packages/mfem/package.py @@ -1344,10 +1344,10 @@ def test_ex10(self): test_exe = "ex10p" if ("+mpi" in self.spec) else "ex10" with working_dir(test_dir): - make = which("make") + make = which("make", required=True) make(f"CONFIG_MK={self.config_mk}", test_exe, "parallel=False") - ex10 = which(test_exe) + ex10 = which(test_exe, required=True) ex10("--mesh", mesh) # this patch is only needed for mfem 4.1, where a few diff --git a/repos/spack_repo/builtin/packages/migraphx/package.py b/repos/spack_repo/builtin/packages/migraphx/package.py index 96b8cfd560e..6962a4b95c4 100644 --- a/repos/spack_repo/builtin/packages/migraphx/package.py +++ b/repos/spack_repo/builtin/packages/migraphx/package.py @@ -189,6 +189,5 @@ def cmake_args(self): def test_unit_tests(self): """Run installed UnitTests""" - unit_tests = which(self.prefix.bin.UnitTests) - assert unit_tests is not None, "UnitTests is not installed!" + unit_tests = which(self.prefix.bin.UnitTests, required=True) unit_tests() diff --git a/repos/spack_repo/builtin/packages/miniconda3/package.py b/repos/spack_repo/builtin/packages/miniconda3/package.py index c8589fb4262..270ae5352b3 100644 --- a/repos/spack_repo/builtin/packages/miniconda3/package.py +++ b/repos/spack_repo/builtin/packages/miniconda3/package.py @@ -200,7 +200,7 @@ def install(self, spec, prefix): # peel the name of the script out of the pathname of the # downloaded file dir, script = split(self.stage.archive_file) - bash = which("bash") + bash = which("bash", required=True) bash(script, "-b", "-f", "-p", self.prefix) def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/miniforge3/package.py b/repos/spack_repo/builtin/packages/miniforge3/package.py index de76ab833d1..640e71f71ca 100644 --- a/repos/spack_repo/builtin/packages/miniforge3/package.py +++ b/repos/spack_repo/builtin/packages/miniforge3/package.py @@ -57,7 +57,7 @@ def url_for_version(self, version): def install(self, spec, prefix): dir, script = split(self.stage.archive_file) - bash = which("bash") + bash = which("bash", required=True) bash(script, "-b", "-f", "-p", self.prefix) @run_after("install") diff --git a/repos/spack_repo/builtin/packages/mitofates/package.py b/repos/spack_repo/builtin/packages/mitofates/package.py index dee61aa953d..990967606fd 100644 --- a/repos/spack_repo/builtin/packages/mitofates/package.py +++ b/repos/spack_repo/builtin/packages/mitofates/package.py @@ -43,7 +43,7 @@ def patch(self): def install(self, spec, prefix): install_tree("bin", prefix.bin) install("MitoFates.pl", prefix) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", join_path(prefix, "MitoFates.pl")) def setup_run_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/mlhka/package.py b/repos/spack_repo/builtin/packages/mlhka/package.py index 4418524c20c..213416ae83f 100644 --- a/repos/spack_repo/builtin/packages/mlhka/package.py +++ b/repos/spack_repo/builtin/packages/mlhka/package.py @@ -21,7 +21,7 @@ class Mlhka(Package): depends_on("cxx", type="build") # generated def install(self, spec, prefix): - cxx = which("c++") + cxx = which("c++", required=True) cxx("MLHKA_version{0}.cpp".format(self.version), "-o", "MLHKA") mkdirp(prefix.bin) install("MLHKA", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/mmg/package.py b/repos/spack_repo/builtin/packages/mmg/package.py index 1eab4312f6c..8e5015c94b4 100644 --- a/repos/spack_repo/builtin/packages/mmg/package.py +++ b/repos/spack_repo/builtin/packages/mmg/package.py @@ -84,6 +84,6 @@ def cmake_args(self): @run_after("install") def install_source(self): prefix = self.spec.prefix - cp = which("cp") + cp = which("cp", required=True) cp("-r", os.path.join(self.stage.source_path, "src"), prefix) cp("-r", os.path.join(self.build_directory, "src"), prefix) diff --git a/repos/spack_repo/builtin/packages/mochi_margo/package.py b/repos/spack_repo/builtin/packages/mochi_margo/package.py index dfcabe992d5..1df20dd24e8 100644 --- a/repos/spack_repo/builtin/packages/mochi_margo/package.py +++ b/repos/spack_repo/builtin/packages/mochi_margo/package.py @@ -118,5 +118,5 @@ def cmake_args(self): return args def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("./prepare.sh") diff --git a/repos/spack_repo/builtin/packages/motif/package.py b/repos/spack_repo/builtin/packages/motif/package.py index 63bf38b3f97..c614ff4fde6 100644 --- a/repos/spack_repo/builtin/packages/motif/package.py +++ b/repos/spack_repo/builtin/packages/motif/package.py @@ -56,6 +56,6 @@ def patch(self): ) def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) with working_dir(self.configure_directory): autoreconf("-ivf") diff --git a/repos/spack_repo/builtin/packages/motioncor2/package.py b/repos/spack_repo/builtin/packages/motioncor2/package.py index 557199e2d11..a2a65bee7f8 100644 --- a/repos/spack_repo/builtin/packages/motioncor2/package.py +++ b/repos/spack_repo/builtin/packages/motioncor2/package.py @@ -43,7 +43,7 @@ def install(self, spec, prefix): @run_after("install") def ensure_rpaths(self): - patchelf = which("patchelf") + patchelf = which("patchelf", required=True) patchelf( "--set-rpath", self.spec["cuda"].prefix.lib64, join_path(self.prefix.bin, "MotionCor2") ) diff --git a/repos/spack_repo/builtin/packages/mpi/package.py b/repos/spack_repo/builtin/packages/mpi/package.py index 7dfcd57ddff..b6d2794e862 100644 --- a/repos/spack_repo/builtin/packages/mpi/package.py +++ b/repos/spack_repo/builtin/packages/mpi/package.py @@ -21,8 +21,8 @@ def test_mpi_hello(self): filename = self.test_suite.current_test_data_dir.join("mpi_hello." + lang) compiler_var = "MPICC" if lang == "c" else "MPIF90" - compiler = which(os.environ[compiler_var]) - mpirun = which(self.prefix.bin.mpirun) + compiler = which(os.environ[compiler_var], required=True) + mpirun = which(self.prefix.bin.mpirun, required=True) exe_name = "mpi_hello_%s" % lang diff --git a/repos/spack_repo/builtin/packages/mpich/package.py b/repos/spack_repo/builtin/packages/mpich/package.py index e305c91829f..42838784042 100644 --- a/repos/spack_repo/builtin/packages/mpich/package.py +++ b/repos/spack_repo/builtin/packages/mpich/package.py @@ -513,7 +513,7 @@ def autoreconf(self, spec, prefix): if os.path.exists(self.configure_abs_path) and not spec.satisfies("@3.3 +hwloc"): return # Else bootstrap with autotools - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def configure_args(self): @@ -670,7 +670,7 @@ def mpi_launcher(self): ] if "+slurm" in self.spec: commands.insert(0, join_path(self.spec["slurm"].prefix.bin)) - return which(*commands) + return which(*commands, required=True) def run_mpich_test(self, subdir, exe, num_procs=1): """Compile and run the test program.""" @@ -680,7 +680,7 @@ def run_mpich_test(self, subdir, exe, num_procs=1): if not os.path.isfile(src): raise SkipTest(f"{src} is missing") - mpicc = which(os.environ["MPICC"]) + mpicc = which(os.environ["MPICC"], required=True) mpicc("-Wall", "-g", "-o", exe, src) if num_procs > 1: launcher = self.mpi_launcher() @@ -688,7 +688,7 @@ def run_mpich_test(self, subdir, exe, num_procs=1): launcher("-n", str(num_procs), exe) return - test_exe = which(exe) + test_exe = which(exe, required=True) test_exe() def test_cpi(self): diff --git a/repos/spack_repo/builtin/packages/mptensor/package.py b/repos/spack_repo/builtin/packages/mptensor/package.py index bdc178df58d..7e90a7b41be 100644 --- a/repos/spack_repo/builtin/packages/mptensor/package.py +++ b/repos/spack_repo/builtin/packages/mptensor/package.py @@ -102,10 +102,10 @@ def test_tensor_test(self): math_libs = self.spec["scalapack"].libs + self.spec["lapack"].libs + self.spec["blas"].libs with working_dir(self.test_suite.current_test_cache_dir.tests): - make = which("make") + make = which("make", required=True) make(f"LDFLAGS={math_libs.ld_flags}") - mpirun = which(self.spec["mpi"].prefix.bin.mpirun) + mpirun = which(self.spec["mpi"].prefix.bin.mpirun, required=True) mpirun("-n", "1", "tensor_test.out") # Test of mptensor has checker diff --git a/repos/spack_repo/builtin/packages/mvapich_plus/package.py b/repos/spack_repo/builtin/packages/mvapich_plus/package.py index 518bcf4ae74..8940adab127 100644 --- a/repos/spack_repo/builtin/packages/mvapich_plus/package.py +++ b/repos/spack_repo/builtin/packages/mvapich_plus/package.py @@ -153,8 +153,8 @@ def install(self, spec, prefix): rpm = f"mvapich-plus-{mvp_ver}-{gpu}{gpu_ver}.{rhel}.ofed{ofed}.{netmod}.{comp}\ {slurm}{apu}-4.1-1.{el}.x86_64.rpm" - install_shell = which("bash") - io = which("rpm2cpio").path + install_shell = which("bash", required=True) + io = which("rpm2cpio", required=True).path arguments = [ runfile, # the install script "--prefix=%s" % prefix, # Where to install diff --git a/repos/spack_repo/builtin/packages/n2p2/package.py b/repos/spack_repo/builtin/packages/n2p2/package.py index 3b6790a12bb..9d7c304706a 100644 --- a/repos/spack_repo/builtin/packages/n2p2/package.py +++ b/repos/spack_repo/builtin/packages/n2p2/package.py @@ -113,7 +113,7 @@ def test_result_check(self): if not os.path.exists(result_check_script): raise SkipTest("Required result-check.sh is missing from the repository directory") - make = which("make") + make = which("make", required=True) with working_dir(self.test_suite.current_test_cache_dir.test): make("clean") @@ -152,5 +152,5 @@ def test_result_check(self): make("python", parallel=False) assert os.path.isfile(python_output), f"{python_output} was not produced" - result_check = which(result_check_script) + result_check = which(result_check_script, required=True) result_check(cpp_output, python_output, expected_file) diff --git a/repos/spack_repo/builtin/packages/nalu_wind/package.py b/repos/spack_repo/builtin/packages/nalu_wind/package.py index c44e4c8d375..6d58cfdd126 100644 --- a/repos/spack_repo/builtin/packages/nalu_wind/package.py +++ b/repos/spack_repo/builtin/packages/nalu_wind/package.py @@ -232,5 +232,5 @@ def cmake_args(self): @run_before("cmake") def add_submodules(self): if self.run_tests or self.spec.satisfies("+wind-utils"): - git = which("git") + git = which("git", required=True) git("submodule", "update", "--init", "--recursive") diff --git a/repos/spack_repo/builtin/packages/navi/package.py b/repos/spack_repo/builtin/packages/navi/package.py index 5d807d049aa..23c365f7cc5 100644 --- a/repos/spack_repo/builtin/packages/navi/package.py +++ b/repos/spack_repo/builtin/packages/navi/package.py @@ -21,5 +21,5 @@ class Navi(Package): depends_on("rust") def install(self, spec, prefix): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("install", "--root", prefix, "--path", ".") diff --git a/repos/spack_repo/builtin/packages/nektar/package.py b/repos/spack_repo/builtin/packages/nektar/package.py index c3c118fbafb..f6480c17fe2 100644 --- a/repos/spack_repo/builtin/packages/nektar/package.py +++ b/repos/spack_repo/builtin/packages/nektar/package.py @@ -166,7 +166,7 @@ def hasfeature(feature): def install(self, spec, prefix): super(Nektar, self).install(spec, prefix) if "+python" in spec: - python = which("python") + python = which("python", required=True) with working_dir(self.build_directory): python("setup.py", "install", "--prefix", prefix) diff --git a/repos/spack_repo/builtin/packages/netcdf_fortran/package.py b/repos/spack_repo/builtin/packages/netcdf_fortran/package.py index db1926bb0f2..74fbcbc0560 100644 --- a/repos/spack_repo/builtin/packages/netcdf_fortran/package.py +++ b/repos/spack_repo/builtin/packages/netcdf_fortran/package.py @@ -143,7 +143,7 @@ def configure_args(self): config_args.append("ac_cv_func_MPI_File_open=yes") if "~shared" in netcdf_c_spec: - nc_config = which("nc-config") + nc_config = which("nc-config", required=True) config_args.append("LIBS={0}".format(nc_config("--libs", output=str).strip())) if any(s in netcdf_c_spec for s in ["+mpi", "+parallel-netcdf", "^hdf5+mpi~shared"]): config_args.append("CC=%s" % self.spec["mpi"].mpicc) diff --git a/repos/spack_repo/builtin/packages/netpbm/package.py b/repos/spack_repo/builtin/packages/netpbm/package.py index d4ebd9fbb15..14045280d36 100644 --- a/repos/spack_repo/builtin/packages/netpbm/package.py +++ b/repos/spack_repo/builtin/packages/netpbm/package.py @@ -148,7 +148,7 @@ def edit(self, spec, prefix): config.append("JBIGLIB={0}".format(spec["jbigkit"].libs.ld_flags)) config.append("JBIGHDR_DIR={0}".format(spec["jbigkit"].headers.directories[0])) if "+X" in spec: - pkg_config = which("pkg-config") + pkg_config = which("pkg-config", required=True) if not pkg_config("x11", "--exists"): config.append("X11LIB={0}".format(spec["libx11"].libs.ld_flags)) config.append("X11HDR_DIR={0}".format(spec["libx11"].headers.directories[0])) diff --git a/repos/spack_repo/builtin/packages/nvidia_container_toolkit/package.py b/repos/spack_repo/builtin/packages/nvidia_container_toolkit/package.py index a1cc3f98bde..fc6a7584b1a 100644 --- a/repos/spack_repo/builtin/packages/nvidia_container_toolkit/package.py +++ b/repos/spack_repo/builtin/packages/nvidia_container_toolkit/package.py @@ -40,7 +40,7 @@ class NvidiaContainerToolkit(Package): version(ver, sha256=pkg[0], url=pkg[1], expand=False) def install(self, spec, prefix): - bsdtar = which("bsdtar") + bsdtar = which("bsdtar", required=True) tar_file = glob(join_path(self.stage.source_path, "nvidia-container-toolkit*.tar.gz"))[0] tar_params = ["-x", "-f", tar_file] bsdtar(*tar_params) diff --git a/repos/spack_repo/builtin/packages/nvidia_nsight_systems/package.py b/repos/spack_repo/builtin/packages/nvidia_nsight_systems/package.py index bf0a72eb586..dcfc9dd55d0 100644 --- a/repos/spack_repo/builtin/packages/nvidia_nsight_systems/package.py +++ b/repos/spack_repo/builtin/packages/nvidia_nsight_systems/package.py @@ -82,7 +82,7 @@ def determine_version(cls, exe): return match.group(1) if match else None def install(self, spec, prefix): - bsdtar = which("bsdtar") + bsdtar = which("bsdtar", required=True) rpm_file = glob(join_path(self.stage.source_path, "nsight-systems*.rpm"))[0] params = ["-x", "-f", rpm_file] ver = prefix.split("/")[-1].split("-")[-2] diff --git a/repos/spack_repo/builtin/packages/nwchem/package.py b/repos/spack_repo/builtin/packages/nwchem/package.py index 102301dfdd8..1dba12f1e1c 100644 --- a/repos/spack_repo/builtin/packages/nwchem/package.py +++ b/repos/spack_repo/builtin/packages/nwchem/package.py @@ -250,7 +250,7 @@ def install(self, spec, prefix): install_tree(join_path("nwpw", "libraryps"), join_path(share_path, "libraryps")) b_path = join_path(self.stage.source_path, "bin", target, "nwchem") - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", b_path) install(b_path, prefix.bin) diff --git a/repos/spack_repo/builtin/packages/octopus/package.py b/repos/spack_repo/builtin/packages/octopus/package.py index 8b9be7eff46..d25f28014fd 100644 --- a/repos/spack_repo/builtin/packages/octopus/package.py +++ b/repos/spack_repo/builtin/packages/octopus/package.py @@ -201,7 +201,7 @@ def test_version(self): # spack-v0.17.2$ octopus --version # octopus 11.3 (git commit ) - exe = which(self.spec.prefix.bin.octopus) + exe = which(self.spec.prefix.bin.octopus, required=True) out = exe("--version", output=str.split, error=str.split) assert "octopus " in out @@ -229,7 +229,7 @@ def test_recipe(self): with working_dir("example-recipe", create=True): print("Current working directory (in example-recipe)") copy(join_path(os.path.dirname(__file__), "test", "recipe.inp"), "inp") - exe = which(self.spec.prefix.bin.octopus) + exe = which(self.spec.prefix.bin.octopus, required=True) out = exe(output=str.split, error=str.split) check_outputs(expected, out) @@ -258,7 +258,7 @@ def test_he(self): with working_dir("example-he", create=True): print("Current working directory (in example-he)") copy(join_path(os.path.dirname(__file__), "test", "he.inp"), "inp") - exe = which(self.spec.prefix.bin.octopus) + exe = which(self.spec.prefix.bin.octopus, required=True) out = exe(output=str.split, error=str.split) check_outputs(expected, out) diff --git a/repos/spack_repo/builtin/packages/omega_h/package.py b/repos/spack_repo/builtin/packages/omega_h/package.py index 5b1e632232c..a2dbba451ce 100644 --- a/repos/spack_repo/builtin/packages/omega_h/package.py +++ b/repos/spack_repo/builtin/packages/omega_h/package.py @@ -187,14 +187,14 @@ def test_mesh(self): raise SkipTest("Package must be installed as version 9.34.1 or later") with test_part(self, "test_mesh_create", purpose="mesh construction"): - exe = which(self.prefix.bin.osh_box) + exe = which(self.prefix.bin.osh_box, required=True) exe("1", "1", "1", "2", "2", "2", "box.osh") with test_part(self, "test_mesh_adapt", purpose="mesh adaptation"): - exe = which(self.prefix.bin.osh_scale) + exe = which(self.prefix.bin.osh_scale, required=True) actual = exe("box.osh", "100", "box_100.osh", output=str.split, error=str.split) assert "adapting took" in actual with test_part(self, "test_mesh_convert", purpose="mesh to vtu conversion"): - exe = which(self.prefix.bin.osh2vtk) + exe = which(self.prefix.bin.osh2vtk, required=True) exe("box_100.osh", "box_100_vtk") diff --git a/repos/spack_repo/builtin/packages/ompss_2/package.py b/repos/spack_repo/builtin/packages/ompss_2/package.py index 4c736d89101..15b2371f55c 100644 --- a/repos/spack_repo/builtin/packages/ompss_2/package.py +++ b/repos/spack_repo/builtin/packages/ompss_2/package.py @@ -75,7 +75,7 @@ def install_jemalloc(self, spec, prefix): def install_mcxx(self, spec, prefix): os.chdir(glob.glob("./mcxx-*").pop()) - reconf = which("autoreconf") + reconf = which("autoreconf", required=True) reconf("-fiv") configure("--prefix=%s" % prefix, "--with-nanos6=%s" % prefix, "--enable-ompss-2") @@ -88,7 +88,7 @@ def install_llvm(self, spec, prefix): mkdirp("./build") os.chdir("./build") - cmake = which("cmake") + cmake = which("cmake", required=True) cmake( "../llvm", "-G Unix Makefiles", diff --git a/repos/spack_repo/builtin/packages/opencl_clhpp/package.py b/repos/spack_repo/builtin/packages/opencl_clhpp/package.py index 2120a51bfda..049d8cbfaf1 100644 --- a/repos/spack_repo/builtin/packages/opencl_clhpp/package.py +++ b/repos/spack_repo/builtin/packages/opencl_clhpp/package.py @@ -36,5 +36,5 @@ class OpenclClhpp(CMakePackage): @run_after("install") def post_install(self): if sys.platform == "darwin": - ln = which("ln") + ln = which("ln", required=True) ln("-s", prefix.include.CL, prefix.include.OpenCL) diff --git a/repos/spack_repo/builtin/packages/openmpi/package.py b/repos/spack_repo/builtin/packages/openmpi/package.py index 3d889b09556..9d3dad94486 100644 --- a/repos/spack_repo/builtin/packages/openmpi/package.py +++ b/repos/spack_repo/builtin/packages/openmpi/package.py @@ -1126,14 +1126,14 @@ def with_or_without_tm(self, activated): @when("@main") def autoreconf(self, spec, prefix): - perl = which("perl") + perl = which("perl", required=True) perl("autogen.pl") if spec.satisfies("+two_level_namespace platform=darwin"): filter_file(r"-flat_namespace", "-commons,use_dylibs", "configure") @when("@5.0.0:5.0.1") def autoreconf(self, spec, prefix): - perl = which("perl") + perl = which("perl", required=True) perl("autogen.pl", "--force") if spec.satisfies("+two_level_namespace platform=darwin"): filter_file(r"-flat_namespace", "-commons,use_dylibs", "configure") @@ -1394,7 +1394,7 @@ def run_installed_binary(self, bin, options, expected): if not os.path.exists(exe_path): raise SkipTest(f"{bin} is not installed") - exe = which(exe_path) + exe = which(exe_path, required=True) out = exe(*options, output=str.split, error=str.split) check_outputs(expected, out) diff --git a/repos/spack_repo/builtin/packages/openpmd_api/package.py b/repos/spack_repo/builtin/packages/openpmd_api/package.py index a0ba18295e3..73163bf36ba 100644 --- a/repos/spack_repo/builtin/packages/openpmd_api/package.py +++ b/repos/spack_repo/builtin/packages/openpmd_api/package.py @@ -199,6 +199,6 @@ def test_run_openpmd_ls(self): """Test if openpmd-ls runs correctly""" if self.spec.satisfies("@:0.11.0"): raise SkipTest("Package must be installed as version 0.11.1 or later") - exe = which(join_path(self.prefix.bin, "openpmd-ls")) + exe = which(join_path(self.prefix.bin, "openpmd-ls"), required=True) out = exe(output=str.split, error=str.split) assert str(self.spec.version) in out diff --git a/repos/spack_repo/builtin/packages/openrasmol/package.py b/repos/spack_repo/builtin/packages/openrasmol/package.py index cf28ab37a2c..d5dee5de387 100644 --- a/repos/spack_repo/builtin/packages/openrasmol/package.py +++ b/repos/spack_repo/builtin/packages/openrasmol/package.py @@ -36,7 +36,7 @@ class Openrasmol(MakefilePackage): def edit(self, spec, prefix): with working_dir("src"): # Imakefile - bash = which("bash") + bash = which("bash", required=True) bash("./rasmol_build_options.sh") # host.def with open("host.def", "w") as f: @@ -53,14 +53,14 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def build(self, spec, prefix): with working_dir("src"): - bash = which("bash") + bash = which("bash", required=True) bash("./build_all.sh") def install(self, spec, prefix): install_tree("./data", prefix.sample) install_tree("./doc", prefix.doc) with working_dir("src"): - bash = which("bash") + bash = which("bash", required=True) bash("./rasmol_install.sh", "--prefix={0}".format(prefix)) def test_rasmol(self): @@ -71,5 +71,5 @@ def test_rasmol(self): join_path(self.test_suite.current_test_data_dir, "test.rsc"), join_path(self.prefix.sample, "1crn.pdb"), ] - rasmol = which(self.prefix.bin.rasmol) + rasmol = which(self.prefix.bin.rasmol, required=True) rasmol(*opts) diff --git a/repos/spack_repo/builtin/packages/pandaseq/package.py b/repos/spack_repo/builtin/packages/pandaseq/package.py index 837d7a5c2ea..440f02fa51b 100644 --- a/repos/spack_repo/builtin/packages/pandaseq/package.py +++ b/repos/spack_repo/builtin/packages/pandaseq/package.py @@ -31,5 +31,5 @@ class Pandaseq(AutotoolsPackage): depends_on("bzip2", type="link") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/papi/package.py b/repos/spack_repo/builtin/packages/papi/package.py index 73fb7d5dbc8..7b038ce93bd 100644 --- a/repos/spack_repo/builtin/packages/papi/package.py +++ b/repos/spack_repo/builtin/packages/papi/package.py @@ -146,7 +146,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: @when("@6.0.0:%oneapi") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("-c", "cd src && autoreconf -ivf") def configure_args(self): @@ -242,7 +242,7 @@ def test_smoke(self): with set_env(PAPIROOT=self.prefix): make = self.spec["gmake"].command make() - exe_simple = which("simple") + exe_simple = which("simple", required=True) exe_simple() - exe_threads = which("threads") + exe_threads = which("threads", required=True) exe_threads() diff --git a/repos/spack_repo/builtin/packages/papyrus/package.py b/repos/spack_repo/builtin/packages/papyrus/package.py index a22d9ff2a8a..bd7569e36db 100644 --- a/repos/spack_repo/builtin/packages/papyrus/package.py +++ b/repos/spack_repo/builtin/packages/papyrus/package.py @@ -73,10 +73,10 @@ def _build_and_run_kv_test(self, test): "-lm", ] - mpicxx = which(self.spec["mpi"].mpicxx) + mpicxx = which(self.spec["mpi"].mpicxx, required=True) mpicxx(*options) - mpirun = which(self.spec["mpi"].prefix.bin.mpirun) + mpirun = which(self.spec["mpi"].prefix.bin.mpirun, required=True) mpirun("-np", "4", test) def test_01_open_close(self): diff --git a/repos/spack_repo/builtin/packages/parallel_netcdf/package.py b/repos/spack_repo/builtin/packages/parallel_netcdf/package.py index 81e6592afc3..7f52f0b7f8c 100644 --- a/repos/spack_repo/builtin/packages/parallel_netcdf/package.py +++ b/repos/spack_repo/builtin/packages/parallel_netcdf/package.py @@ -184,7 +184,7 @@ def test_column_wise(self): ] with working_dir(test_dir): - mpicxx = which(self.spec["mpi"].prefix.bin.mpicxx) + mpicxx = which(self.spec["mpi"].prefix.bin.mpicxx, required=True) mpicxx(*options) mpiexe_list = [ @@ -198,9 +198,9 @@ def test_column_wise(self): try: args = ["--immediate=30"] if mpiexe == "srun" else [] args += ["-n", "1", test_exe] - exe = which(mpiexe) + exe = which(mpiexe, required=True) exe(*args) - rm = which("rm") + rm = which("rm", required=True) rm("-f", "column_wise") return diff --git a/repos/spack_repo/builtin/packages/parflow/package.py b/repos/spack_repo/builtin/packages/parflow/package.py index 8510bbef09f..d4ece42d5c1 100644 --- a/repos/spack_repo/builtin/packages/parflow/package.py +++ b/repos/spack_repo/builtin/packages/parflow/package.py @@ -73,11 +73,11 @@ def test_single_phase_flow(self): run_path = join_path(self.spec.prefix, self.examples_dir) options = ["default_single.tcl", "1", "1", "1"] with working_dir(run_path): - exe = which(f"{self.spec['tcl'].prefix.bin}/tclsh") + exe = which(f"{self.spec['tcl'].prefix.bin}/tclsh", required=True) exe(*options) def test_check_version(self): """Test if exe executes""" - exe = which(join_path(self.prefix.bin, "parflow")) + exe = which(join_path(self.prefix.bin, "parflow"), required=True) out = exe("-v", output=str.split, error=str.split) assert str(self.spec.version) in out diff --git a/repos/spack_repo/builtin/packages/parsec/package.py b/repos/spack_repo/builtin/packages/parsec/package.py index 3bda4805055..e2cb723057b 100644 --- a/repos/spack_repo/builtin/packages/parsec/package.py +++ b/repos/spack_repo/builtin/packages/parsec/package.py @@ -128,7 +128,7 @@ def test_contrib(self): for name in ["dtd_test_allreduce", "write_check"]: with test_part(self, f"test_contrib_{name}", f"run {name}"): - exe = which(name) + exe = which(name, required=True) exe() @run_after("install") diff --git a/repos/spack_repo/builtin/packages/patchelf/package.py b/repos/spack_repo/builtin/packages/patchelf/package.py index b17709e5757..1463b6cd864 100644 --- a/repos/spack_repo/builtin/packages/patchelf/package.py +++ b/repos/spack_repo/builtin/packages/patchelf/package.py @@ -76,7 +76,7 @@ def url_for_version(self, version): def test_version(self): """ensure patchelf version match""" # Check patchelf in prefix and reports the correct version - patchelf = which(self.prefix.bin.patchelf) + patchelf = which(self.prefix.bin.patchelf, required=True) out = patchelf("--version", output=str.split, error=str.split) expected = f"patchelf {self.spec.version}" assert expected in out, f"Expected '{expected}' in output" @@ -86,7 +86,7 @@ def test_rpath_change(self): currdir = os.getcwd() hello_file = self.test_suite.current_test_data_dir.join("hello") - patchelf = which(self.prefix.bin.patchelf) + patchelf = which(self.prefix.bin.patchelf, required=True) patchelf("--set-rpath", currdir, hello_file) out = patchelf("--print-rpath", hello_file, output=str.split, error=str.split) assert currdir in out, f"Expected '{currdir}' in output" diff --git a/repos/spack_repo/builtin/packages/perl_bio_ensembl_variation/package.py b/repos/spack_repo/builtin/packages/perl_bio_ensembl_variation/package.py index e23ae2bcddc..ea06066d984 100644 --- a/repos/spack_repo/builtin/packages/perl_bio_ensembl_variation/package.py +++ b/repos/spack_repo/builtin/packages/perl_bio_ensembl_variation/package.py @@ -58,12 +58,12 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def build(self, spec, prefix): if spec.satisfies("+ld"): - make = which("make") + make = which("make", required=True) with working_dir("C_code"): make() if spec.satisfies("+tools"): # Fix the fact that phenotype_annotation isn't executable - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", "tools/phenotype_annotation/phenotype_annotation") def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/perl_fth/package.py b/repos/spack_repo/builtin/packages/perl_fth/package.py index c945989e4ac..b35d0955c5e 100644 --- a/repos/spack_repo/builtin/packages/perl_fth/package.py +++ b/repos/spack_repo/builtin/packages/perl_fth/package.py @@ -113,7 +113,7 @@ def install(self, spec, prefix): for exe in checks: fic = exe + ".pl" if os.path.exists(fic): - dos2unix = which("dos2unix") + dos2unix = which("dos2unix", required=True) dos2unix(fic) fthfile = FileFilter(fic) fthfile.filter("#!/usr/bin/perl", mstr, backup=False) diff --git a/repos/spack_repo/builtin/packages/petsc/package.py b/repos/spack_repo/builtin/packages/petsc/package.py index af1ab33cf2e..84c51306496 100644 --- a/repos/spack_repo/builtin/packages/petsc/package.py +++ b/repos/spack_repo/builtin/packages/petsc/package.py @@ -731,17 +731,19 @@ def get_runner(self): env["PETSC_DIR"] = self.prefix env["PETSC_ARCH"] = "" if "+mpi" in spec: - runexe = which(spec["mpi"].prefix.bin.mpiexec) + runexe = which(spec["mpi"].prefix.bin.mpiexec, required=True) runopt = ["-n", "4"] else: - runexe = which(join_path(self.prefix.lib.petsc.bin, "petsc-mpiexec.uni")) + runexe = which( + join_path(self.prefix.lib.petsc.bin, "petsc-mpiexec.uni"), required=True + ) runopt = ["-n", "1"] return runexe, runopt def test_ex50(self): """build and run ex50 to solve Poisson equation in 2D""" # solve Poisson equation in 2D to make sure nothing is broken: - make = which("make") + make = which("make", required=True) runexe, runopts = self.get_runner() w_dir = self.test_suite.current_test_cache_dir.src.ksp.ksp.tutorials @@ -767,7 +769,7 @@ def test_ex7(self): if "+cuda" not in self.spec: raise SkipTest("Package must be built with +cuda") - make = which("make") + make = which("make", required=True) runexe, runopts = self.get_runner() w_dir = self.test_suite.current_test_cache_dir.src.ksp.ksp.tutorials @@ -794,7 +796,7 @@ def test_ex3k(self): if "+kokkos" not in self.spec: raise SkipTest("Package must be built with +kokkos") - make = which("make") + make = which("make", required=True) runexe, runopts = self.get_runner() w_dir = self.test_suite.current_test_cache_dir.src.snes.tutorials diff --git a/repos/spack_repo/builtin/packages/pgplot/package.py b/repos/spack_repo/builtin/packages/pgplot/package.py index f7ed73192eb..0694576de27 100644 --- a/repos/spack_repo/builtin/packages/pgplot/package.py +++ b/repos/spack_repo/builtin/packages/pgplot/package.py @@ -128,7 +128,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: env.append_flags("LIBS", self.spec["libpng"].libs.ld_flags) def build(self, spec, prefix): - makemake = which("./makemake") + makemake = which("./makemake", required=True) makemake(self.build_directory, "linux", "g77_gcc") make() make("clean") diff --git a/repos/spack_repo/builtin/packages/php/package.py b/repos/spack_repo/builtin/packages/php/package.py index 36432d0312c..87c30206d49 100644 --- a/repos/spack_repo/builtin/packages/php/package.py +++ b/repos/spack_repo/builtin/packages/php/package.py @@ -62,7 +62,7 @@ def patch(self): ) def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./buildconf", "--force") @when("@8:") diff --git a/repos/spack_repo/builtin/packages/pinentry/package.py b/repos/spack_repo/builtin/packages/pinentry/package.py index d424facf7c0..0dd6e915709 100644 --- a/repos/spack_repo/builtin/packages/pinentry/package.py +++ b/repos/spack_repo/builtin/packages/pinentry/package.py @@ -100,7 +100,7 @@ def configure_args(self): def check_version(self, exe_name): """Version check""" - exe = which(join_path(self.prefix.bin, exe_name)) + exe = which(join_path(self.prefix.bin, exe_name), required=True) out = exe("--version", output=str.split, error=str.split) assert str(self.version) in out diff --git a/repos/spack_repo/builtin/packages/pixman/package.py b/repos/spack_repo/builtin/packages/pixman/package.py index 1a5d102195c..057c246f419 100644 --- a/repos/spack_repo/builtin/packages/pixman/package.py +++ b/repos/spack_repo/builtin/packages/pixman/package.py @@ -133,7 +133,10 @@ def configure_args(self): png = self.spec["libpng"] if not png.satisfies("libs=shared"): args.append( - "LIBS=%s" % which("libpng-config")("--static", "--ldflags", output=str).strip() + "LIBS=%s" + % which("libpng-config", required=True)( + "--static", "--ldflags", output=str + ).strip() ) # The Fujitsu compiler does not support assembler macros. diff --git a/repos/spack_repo/builtin/packages/plink_ng/package.py b/repos/spack_repo/builtin/packages/plink_ng/package.py index 5da11e0b949..8167a057bf3 100644 --- a/repos/spack_repo/builtin/packages/plink_ng/package.py +++ b/repos/spack_repo/builtin/packages/plink_ng/package.py @@ -34,5 +34,5 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def install(self, spec, prefix): ld_flags = [spec["lapack"].libs.ld_flags, spec["blas"].libs.ld_flags] filter_file("-llapack -lcblas -lblas", " ".join(ld_flags), "build.sh", string=True) - which("sh")("build.sh") + which("sh", required=True)("build.sh") install_tree(".", prefix) diff --git a/repos/spack_repo/builtin/packages/ply/package.py b/repos/spack_repo/builtin/packages/ply/package.py index 0fd47acbcda..8c19abebcf9 100644 --- a/repos/spack_repo/builtin/packages/ply/package.py +++ b/repos/spack_repo/builtin/packages/ply/package.py @@ -27,5 +27,5 @@ class Ply(AutotoolsPackage): depends_on("m4", type="build") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/pmix/package.py b/repos/spack_repo/builtin/packages/pmix/package.py index 9a24204cfbb..0ec321d4f87 100644 --- a/repos/spack_repo/builtin/packages/pmix/package.py +++ b/repos/spack_repo/builtin/packages/pmix/package.py @@ -101,7 +101,7 @@ def autoreconf(self, spec, prefix): if os.path.exists(self.configure_abs_path): return # Else bootstrap with autotools - perl = which("perl") + perl = which("perl", required=True) perl("./autogen.pl") def find_external_lib_path(self, pkg_name, path_match_str=""): diff --git a/repos/spack_repo/builtin/packages/polypolish/package.py b/repos/spack_repo/builtin/packages/polypolish/package.py index d953db33427..bd9837f5911 100644 --- a/repos/spack_repo/builtin/packages/polypolish/package.py +++ b/repos/spack_repo/builtin/packages/polypolish/package.py @@ -27,6 +27,6 @@ class Polypolish(Package): depends_on("bwa", type="run") def install(self, spec, prefix): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("install", "--root", prefix, "--path", ".") install("scripts/polypolish_insert_filter.py", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/povray/package.py b/repos/spack_repo/builtin/packages/povray/package.py index 7612edc73c4..f24ded37158 100644 --- a/repos/spack_repo/builtin/packages/povray/package.py +++ b/repos/spack_repo/builtin/packages/povray/package.py @@ -93,7 +93,7 @@ def run_prebuild_script(self): # and it must be run from within the directory containing it unix_dir = join_path(self.build_directory, "unix") prebuild_path = join_path(unix_dir, "prebuild.sh") - prebuild_script = which(prebuild_path) + prebuild_script = which(prebuild_path, required=True) prebuild_script() def configure_args(self): @@ -153,7 +153,7 @@ def test_render_sample(self): """Render sample file""" povs = find(self.prefix.share, "biscuit.pov")[0] copy(povs, ".") - exe = which("povray") + exe = which("povray", required=True) out = exe("biscuit.pov", output=str.split, error=str.split) expected = "POV-Ray finished" assert expected in out diff --git a/repos/spack_repo/builtin/packages/powerapi/package.py b/repos/spack_repo/builtin/packages/powerapi/package.py index ed43bce6f5e..886ce345ee1 100644 --- a/repos/spack_repo/builtin/packages/powerapi/package.py +++ b/repos/spack_repo/builtin/packages/powerapi/package.py @@ -37,7 +37,7 @@ class Powerapi(AutotoolsPackage): patch("add_space.patch") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/prinseq_lite/package.py b/repos/spack_repo/builtin/packages/prinseq_lite/package.py index b8e78a80941..e8f4eeb2291 100644 --- a/repos/spack_repo/builtin/packages/prinseq_lite/package.py +++ b/repos/spack_repo/builtin/packages/prinseq_lite/package.py @@ -35,6 +35,6 @@ def install(self, spec, prefix): install("prinseq-graphs-noPCA.pl", prefix.bin) install("prinseq-lite.pl", prefix.bin) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", join_path(self.prefix.bin, "prinseq-graphs-noPCA.pl")) chmod("+x", join_path(self.prefix.bin, "prinseq-lite.pl")) diff --git a/repos/spack_repo/builtin/packages/process_in_process/package.py b/repos/spack_repo/builtin/packages/process_in_process/package.py index 63f35b0c49d..5cb0abb9551 100644 --- a/repos/spack_repo/builtin/packages/process_in_process/package.py +++ b/repos/spack_repo/builtin/packages/process_in_process/package.py @@ -132,7 +132,7 @@ def install(self, spec, prefix): if target.family not in ["x86_64", "aarch64"]: raise InstallError("PiP only supports x86_64 and aarch64") - bash = which("bash") + bash = which("bash", required=True) # installing PiP-glibc glibc_builddir = join_path("PiP-glibc", "PiP-glibc.build") diff --git a/repos/spack_repo/builtin/packages/procps/package.py b/repos/spack_repo/builtin/packages/procps/package.py index 64ac865df53..aa0ed6fdf7d 100644 --- a/repos/spack_repo/builtin/packages/procps/package.py +++ b/repos/spack_repo/builtin/packages/procps/package.py @@ -56,7 +56,7 @@ class Procps(AutotoolsPackage): patch("libintl-4.0.1.patch", when="@4.0.1:4.0.3") def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/pscmc/package.py b/repos/spack_repo/builtin/packages/pscmc/package.py index a301800d1be..c3e48816ae7 100644 --- a/repos/spack_repo/builtin/packages/pscmc/package.py +++ b/repos/spack_repo/builtin/packages/pscmc/package.py @@ -42,6 +42,6 @@ def build(self, spec, prefix): def install(self, spec, prefix): mkdir(prefix.source) - ln = which("ln") + ln = which("ln", required=True) ln("-s", prefix.source, prefix.bin) install_tree("./", prefix) diff --git a/repos/spack_repo/builtin/packages/psrcat/package.py b/repos/spack_repo/builtin/packages/psrcat/package.py index 2a03406f43c..4ad70f062a1 100644 --- a/repos/spack_repo/builtin/packages/psrcat/package.py +++ b/repos/spack_repo/builtin/packages/psrcat/package.py @@ -20,7 +20,7 @@ class Psrcat(MakefilePackage): depends_on("c", type="build") # generated def build(self, spec, prefix): - makeit = which("./makeit") + makeit = which("./makeit", required=True) makeit() def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/pumi/package.py b/repos/spack_repo/builtin/packages/pumi/package.py index c1385f79da4..aa630a18aeb 100644 --- a/repos/spack_repo/builtin/packages/pumi/package.py +++ b/repos/spack_repo/builtin/packages/pumi/package.py @@ -136,7 +136,7 @@ def test_partition(self): tty.info(f"Attempting to build and launch with {os.path.basename(mpiexe)}") try: options = ["--immediate=30"] + options if mpiexe == "srun" else options - exe = which(mpiexe) + exe = which(mpiexe, required=True) out = exe(*options, output=str.split, error=str.split) assert "mesh pipe_2_.smb written" in out return @@ -154,6 +154,6 @@ def test_refine(self): join_path(self.prefix.share.testdata, "pipe.smb"), "pipe_unif.smb", ] - exe = which(self.prefix.bin.uniform) + exe = which(self.prefix.bin.uniform, required=True) out = exe(*options, output=str.split, error=str.split) assert "mesh pipe_unif.smb written" in out diff --git a/repos/spack_repo/builtin/packages/py_accimage/package.py b/repos/spack_repo/builtin/packages/py_accimage/package.py index 4146d77178c..b3fa1f4c47d 100644 --- a/repos/spack_repo/builtin/packages/py_accimage/package.py +++ b/repos/spack_repo/builtin/packages/py_accimage/package.py @@ -35,5 +35,5 @@ class PyAccimage(PythonPackage): @run_after("install") @on_package_attributes(run_tests=True) def build_test(self): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest("test.py") diff --git a/repos/spack_repo/builtin/packages/py_amrex/package.py b/repos/spack_repo/builtin/packages/py_amrex/package.py index 7b0384efdb4..ffc315a971d 100644 --- a/repos/spack_repo/builtin/packages/py_amrex/package.py +++ b/repos/spack_repo/builtin/packages/py_amrex/package.py @@ -135,7 +135,7 @@ def cmake_args(self): def check(self): """Checks after the build phase""" - pytest = which("pytest") + pytest = which("pytest", required=True) pytest(join_path(self.stage.source_path, self.tests_src_dir)) @run_after("install") @@ -148,7 +148,5 @@ def test_pytest(self): """Perform smoke tests on the installed package.""" test_dir = join_path(self.test_suite.current_test_cache_dir, self.tests_src_dir) with working_dir(test_dir): - pytest = which("pytest") - # TODO: Remove once test dependencies made available - assert pytest is not None, "Make sure a suitable 'pytest' is in your path" + pytest = which("pytest", required=True) pytest() diff --git a/repos/spack_repo/builtin/packages/py_cellprofiler/package.py b/repos/spack_repo/builtin/packages/py_cellprofiler/package.py index 446dc125a8a..24a5afd9c4c 100644 --- a/repos/spack_repo/builtin/packages/py_cellprofiler/package.py +++ b/repos/spack_repo/builtin/packages/py_cellprofiler/package.py @@ -143,7 +143,7 @@ def patch(self): # 1412 passed, 16 skipped, 75 deselected def test_cellprofiler_no_gui(self): """Test installed package.""" - pytest = which("pytest") + pytest = which("pytest", required=True) prefix = join_path(python_purelib, self.dir_tests) pytest( "-v", diff --git a/repos/spack_repo/builtin/packages/py_chainer/package.py b/repos/spack_repo/builtin/packages/py_chainer/package.py index 51517be7b09..b8f426383ab 100644 --- a/repos/spack_repo/builtin/packages/py_chainer/package.py +++ b/repos/spack_repo/builtin/packages/py_chainer/package.py @@ -61,7 +61,7 @@ def test_chainermn(self): raise SkipTest("Test only supported when built with +mn") mnist_file = join_path(install_test_root(self).examples.chainermn.mnist, "train_mnist.py") - mpirun = which(self.spec["mpi"].prefix.bin.mpirun) + mpirun = which(self.spec["mpi"].prefix.bin.mpirun, required=True) opts = ["-n", "4", python.path, mnist_file, "-o", "."] env["OMP_NUM_THREADS"] = "4" diff --git a/repos/spack_repo/builtin/packages/py_cudf/package.py b/repos/spack_repo/builtin/packages/py_cudf/package.py index f58de4710d2..1a3f42cd522 100644 --- a/repos/spack_repo/builtin/packages/py_cudf/package.py +++ b/repos/spack_repo/builtin/packages/py_cudf/package.py @@ -44,7 +44,7 @@ class PyCudf(PythonPackage): @run_before("install") def cmake(self): - cmake = which("cmake") + cmake = which("cmake", required=True) build_dir = os.path.join(self.stage.source_path, "cpp", "build") diff --git a/repos/spack_repo/builtin/packages/py_darshan/package.py b/repos/spack_repo/builtin/packages/py_darshan/package.py index ce6882ec8e5..de7fee880fc 100644 --- a/repos/spack_repo/builtin/packages/py_darshan/package.py +++ b/repos/spack_repo/builtin/packages/py_darshan/package.py @@ -60,5 +60,5 @@ class PyDarshan(PythonPackage): @on_package_attributes(run_tests=True) def install_test(self): with working_dir("./darshan/tests"): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest() diff --git a/repos/spack_repo/builtin/packages/py_deepsig_biocomp/package.py b/repos/spack_repo/builtin/packages/py_deepsig_biocomp/package.py index 435c40c0d48..3eeffbdf34c 100644 --- a/repos/spack_repo/builtin/packages/py_deepsig_biocomp/package.py +++ b/repos/spack_repo/builtin/packages/py_deepsig_biocomp/package.py @@ -31,7 +31,7 @@ class PyDeepsigBiocomp(PythonPackage): def create_share_folder(self): share_dir = join_path(self.prefix, "share", "deepsig") mkdirp(share_dir) - mv = which("mv") + mv = which("mv", required=True) for d in ("models", "tools"): mv(d, share_dir) diff --git a/repos/spack_repo/builtin/packages/py_fenics_ffcx/package.py b/repos/spack_repo/builtin/packages/py_fenics_ffcx/package.py index de101992a1e..bd4190e05be 100644 --- a/repos/spack_repo/builtin/packages/py_fenics_ffcx/package.py +++ b/repos/spack_repo/builtin/packages/py_fenics_ffcx/package.py @@ -59,5 +59,5 @@ class PyFenicsFfcx(PythonPackage): @on_package_attributes(run_tests=True) def check_build(self): with working_dir("test"): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest("--ignore=test_cmdline.py") diff --git a/repos/spack_repo/builtin/packages/py_fparser/package.py b/repos/spack_repo/builtin/packages/py_fparser/package.py index 97d3973695c..6de33b9beb7 100644 --- a/repos/spack_repo/builtin/packages/py_fparser/package.py +++ b/repos/spack_repo/builtin/packages/py_fparser/package.py @@ -61,7 +61,7 @@ class PyFparser(PythonPackage): @run_after("install") @on_package_attributes(run_tests=True) def check_build(self): - pytest = which("pytest") + pytest = which("pytest", required=True) # Limit pystest to search inside the build tree with working_dir("src"): pytest() diff --git a/repos/spack_repo/builtin/packages/py_fury/package.py b/repos/spack_repo/builtin/packages/py_fury/package.py index ad76b799dc8..824e0a85824 100644 --- a/repos/spack_repo/builtin/packages/py_fury/package.py +++ b/repos/spack_repo/builtin/packages/py_fury/package.py @@ -32,7 +32,7 @@ class PyFury(PythonPackage): @on_package_attributes(run_tests=True) def install_test(self): with working_dir("spack-test", create=True): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest( join_path(python_purelib, "fury"), # 'Some warning' is not propagated to __warningregistry__ so diff --git a/repos/spack_repo/builtin/packages/py_hail/package.py b/repos/spack_repo/builtin/packages/py_hail/package.py index 321988782fc..808b4652c16 100644 --- a/repos/spack_repo/builtin/packages/py_hail/package.py +++ b/repos/spack_repo/builtin/packages/py_hail/package.py @@ -222,7 +222,7 @@ def build_targets(self): def install(self, spec, prefix): spec = self.spec - pip = which("pip") + pip = which("pip", required=True) wheel = self.build_wheel_file_path # This mimics the install-on-cluster target but avoids anything @@ -232,6 +232,5 @@ def install(self, spec, prefix): backend = spec.variants["query_backend"].value if backend != "undefined": - hailctl = which("hailctl") # Should be installed from above - if hailctl is not None: # but it might not be - hailctl("config", "set", "query/backend", f"{backend}") + hailctl = which("hailctl", required=True) + hailctl("config", "set", "query/backend", f"{backend}") diff --git a/repos/spack_repo/builtin/packages/py_horovod/package.py b/repos/spack_repo/builtin/packages/py_horovod/package.py index 72b401a02ab..92479f85ab7 100644 --- a/repos/spack_repo/builtin/packages/py_horovod/package.py +++ b/repos/spack_repo/builtin/packages/py_horovod/package.py @@ -302,5 +302,5 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def test_check_build(self): """run horovodrun --check-build""" - horovodrun = which(self.prefix.bin.horovodrun) + horovodrun = which(self.prefix.bin.horovodrun, required=True) horovodrun("--check-build") diff --git a/repos/spack_repo/builtin/packages/py_iterative_stats/package.py b/repos/spack_repo/builtin/packages/py_iterative_stats/package.py index eb79bb6eb68..eef25cc6602 100644 --- a/repos/spack_repo/builtin/packages/py_iterative_stats/package.py +++ b/repos/spack_repo/builtin/packages/py_iterative_stats/package.py @@ -38,5 +38,5 @@ class PyIterativeStats(PythonPackage): @run_after("install") @on_package_attributes(run_tests=True) def install_test(self): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest() diff --git a/repos/spack_repo/builtin/packages/py_jcb/package.py b/repos/spack_repo/builtin/packages/py_jcb/package.py index 35f35deabd1..ea59562bca7 100644 --- a/repos/spack_repo/builtin/packages/py_jcb/package.py +++ b/repos/spack_repo/builtin/packages/py_jcb/package.py @@ -36,5 +36,5 @@ def check(self): env["PYTHONPATH"] = ":".join( (join_path(self.build_directory, "build/lib"), env["PYTHONPATH"]) ) - pytest = which(join_path(self.spec["py-pytest"].prefix.bin, "pytest")) + pytest = which(join_path(self.spec["py-pytest"].prefix.bin, "pytest"), required=True) pytest("-v", self.build_directory) diff --git a/repos/spack_repo/builtin/packages/py_psyclone/package.py b/repos/spack_repo/builtin/packages/py_psyclone/package.py index 6c6672e09c9..3115242b910 100644 --- a/repos/spack_repo/builtin/packages/py_psyclone/package.py +++ b/repos/spack_repo/builtin/packages/py_psyclone/package.py @@ -80,7 +80,7 @@ def url_for_version(self, version): @run_after("install") @on_package_attributes(run_tests=True) def check_build(self): - pytest = which("pytest") + pytest = which("pytest", required=True) # Limit pytest to search inside the build tree with working_dir("src"): pytest() diff --git a/repos/spack_repo/builtin/packages/py_ray/package.py b/repos/spack_repo/builtin/packages/py_ray/package.py index 4dc5c9d0a27..642a7c689ea 100644 --- a/repos/spack_repo/builtin/packages/py_ray/package.py +++ b/repos/spack_repo/builtin/packages/py_ray/package.py @@ -94,6 +94,6 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: @run_before("install") def build_dashboard(self): with working_dir(join_path("python", "ray", "dashboard", "client")): - npm = which("npm") + npm = which("npm", required=True) npm("ci") npm("run", "build") diff --git a/repos/spack_repo/builtin/packages/py_ruamel_yaml/package.py b/repos/spack_repo/builtin/packages/py_ruamel_yaml/package.py index 5594d9f00d9..f33ba48f1ab 100644 --- a/repos/spack_repo/builtin/packages/py_ruamel_yaml/package.py +++ b/repos/spack_repo/builtin/packages/py_ruamel_yaml/package.py @@ -43,5 +43,5 @@ class PyRuamelYaml(PythonPackage): @run_after("install") def fix_import_error(self): if str(self.spec["python"].version.up_to(1)) == "2": - touch = which("touch") + touch = which("touch", required=True) touch(join_path(python_purelib, "ruamel", "__init__.py")) diff --git a/repos/spack_repo/builtin/packages/py_scikit_build_core/package.py b/repos/spack_repo/builtin/packages/py_scikit_build_core/package.py index 206ed996839..ae75b0f5372 100644 --- a/repos/spack_repo/builtin/packages/py_scikit_build_core/package.py +++ b/repos/spack_repo/builtin/packages/py_scikit_build_core/package.py @@ -89,4 +89,4 @@ class PyScikitBuildCore(PythonPackage): @on_package_attributes(run_tests=True) def install_test(self): with working_dir("tests"): - which("pytest")() + which("pytest", required=True)() diff --git a/repos/spack_repo/builtin/packages/py_scikits_odes/package.py b/repos/spack_repo/builtin/packages/py_scikits_odes/package.py index 91942f223bc..992568a0a10 100644 --- a/repos/spack_repo/builtin/packages/py_scikits_odes/package.py +++ b/repos/spack_repo/builtin/packages/py_scikits_odes/package.py @@ -52,5 +52,5 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: @on_package_attributes(run_tests=True) def install_test(self): with working_dir("spack-test", create=True): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest(join_path(python_purelib, "scikits", "odes", "tests")) diff --git a/repos/spack_repo/builtin/packages/py_statsmodels/package.py b/repos/spack_repo/builtin/packages/py_statsmodels/package.py index 000b0ef41ac..f2d0950ebfb 100644 --- a/repos/spack_repo/builtin/packages/py_statsmodels/package.py +++ b/repos/spack_repo/builtin/packages/py_statsmodels/package.py @@ -70,5 +70,5 @@ def remove_generated_sources(self): def build_test(self): dirs = glob.glob("build/lib*") # There can be only one... with working_dir(dirs[0]): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest("statsmodels") diff --git a/repos/spack_repo/builtin/packages/py_tensorboard_data_server/package.py b/repos/spack_repo/builtin/packages/py_tensorboard_data_server/package.py index 6f35025903f..9e912dc9b17 100644 --- a/repos/spack_repo/builtin/packages/py_tensorboard_data_server/package.py +++ b/repos/spack_repo/builtin/packages/py_tensorboard_data_server/package.py @@ -41,7 +41,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def install(self, spec, prefix): with working_dir(join_path("tensorboard", "data", "server")): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("build", "--release") with working_dir(join_path("tensorboard", "data", "server", "pip_package")): diff --git a/repos/spack_repo/builtin/packages/py_waves/package.py b/repos/spack_repo/builtin/packages/py_waves/package.py index 9ba95aa9d99..533ec0e67c4 100644 --- a/repos/spack_repo/builtin/packages/py_waves/package.py +++ b/repos/spack_repo/builtin/packages/py_waves/package.py @@ -92,7 +92,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: def install(self, spec, prefix): if self.spec.satisfies("@0.12.10:"): with working_dir(self.build_directory): - scons = which("scons") + scons = which("scons", required=True) scons("install", f"--prefix={self.prefix}") else: with working_dir(self.build_directory): @@ -118,7 +118,7 @@ def install(self, spec, prefix): # installation logic to be a ``@run_after("install")`` function. f"dist/waves-{self.version}.tar.gz", ) - scons = which("scons") + scons = which("scons", required=True) scons("html", "man") site_packages_directory = list( @@ -144,5 +144,5 @@ def install_test(self): custom_arguments.insert(0, "--ignore=_tests/test_salib_sampler.py") with working_dir(installed_package): - pytest = which("pytest") + pytest = which("pytest", required=True) pytest(*custom_arguments) diff --git a/repos/spack_repo/builtin/packages/py_wxflow/package.py b/repos/spack_repo/builtin/packages/py_wxflow/package.py index eb6494dc8be..7593bfc67c6 100644 --- a/repos/spack_repo/builtin/packages/py_wxflow/package.py +++ b/repos/spack_repo/builtin/packages/py_wxflow/package.py @@ -43,5 +43,5 @@ def check(self): env["PYTHONPATH"] = ":".join( (join_path(self.build_directory, "build/lib"), env["PYTHONPATH"]) ) - pytest = which(join_path(self.spec["py-pytest"].prefix.bin, "pytest")) + pytest = which(join_path(self.spec["py-pytest"].prefix.bin, "pytest"), required=True) pytest("-v", self.build_directory) diff --git a/repos/spack_repo/builtin/packages/qperf/package.py b/repos/spack_repo/builtin/packages/qperf/package.py index 5f8dea55307..e127ad0346b 100644 --- a/repos/spack_repo/builtin/packages/qperf/package.py +++ b/repos/spack_repo/builtin/packages/qperf/package.py @@ -33,5 +33,5 @@ class Qperf(AutotoolsPackage): depends_on("rdma-core", when="+verbs") def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") diff --git a/repos/spack_repo/builtin/packages/qt/package.py b/repos/spack_repo/builtin/packages/qt/package.py index ce2345b080b..c8537f26af4 100644 --- a/repos/spack_repo/builtin/packages/qt/package.py +++ b/repos/spack_repo/builtin/packages/qt/package.py @@ -773,7 +773,7 @@ def configure(self, spec, prefix): config_args.extend(["-nomake", "demos"]) if MACOS_VERSION: - sdkpath = which("xcrun")("--show-sdk-path", output=str).strip() + sdkpath = which("xcrun", required=True)("--show-sdk-path", output=str).strip() config_args.extend(["-cocoa", "-sdk", sdkpath]) if IS_WINDOWS: diff --git a/repos/spack_repo/builtin/packages/qthreads/package.py b/repos/spack_repo/builtin/packages/qthreads/package.py index 00bd118f5a4..5935cfc3a6f 100644 --- a/repos/spack_repo/builtin/packages/qthreads/package.py +++ b/repos/spack_repo/builtin/packages/qthreads/package.py @@ -130,10 +130,10 @@ def _build_and_run_test(self, test): "-lqthread", f"{self.compiler.cc_rpath_arg}{self.prefix.lib}", ] - cc = which(os.environ["CC"]) + cc = which(os.environ["CC"], required=True) cc(*options) - exe = which(join_path(".", test)) + exe = which(join_path(".", test), required=True) exe() def test_hello_world(self): diff --git a/repos/spack_repo/builtin/packages/qucs/package.py b/repos/spack_repo/builtin/packages/qucs/package.py index 917841b34d7..0b42c6f0581 100644 --- a/repos/spack_repo/builtin/packages/qucs/package.py +++ b/repos/spack_repo/builtin/packages/qucs/package.py @@ -59,7 +59,7 @@ class Qucs(AutotoolsPackage): depends_on("xyce", type="run", when="simulators=xyce") def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) if os.path.exists("bootstrap"): sh("./bootstrap") else: diff --git a/repos/spack_repo/builtin/packages/rccl/package.py b/repos/spack_repo/builtin/packages/rccl/package.py index a0e949fd71b..e9126fc7537 100644 --- a/repos/spack_repo/builtin/packages/rccl/package.py +++ b/repos/spack_repo/builtin/packages/rccl/package.py @@ -193,5 +193,5 @@ def cmake_args(self): def test_unit(self): """Run unit tests""" - unit_tests = which(join_path(self.prefix.bin, "rccl-UnitTests")) + unit_tests = which(join_path(self.prefix.bin, "rccl-UnitTests"), required=True) unit_tests() diff --git a/repos/spack_repo/builtin/packages/reditools/package.py b/repos/spack_repo/builtin/packages/reditools/package.py index d8daa56c3b1..4cfbc5bb2eb 100644 --- a/repos/spack_repo/builtin/packages/reditools/package.py +++ b/repos/spack_repo/builtin/packages/reditools/package.py @@ -67,11 +67,11 @@ class Reditools(PythonPackage): def p2_to_p3(self): if "^python@3:" in self.spec: # clean up space/tab mixing - reindent = which("reindent") + reindent = which("reindent", required=True) reindent("--nobackup", "--recurse", ".") # convert to be python3 compatible - p2_to_p3 = which("2to3") + p2_to_p3 = which("2to3", required=True) p2_to_p3("--nobackups", "--write", ".") @run_after("install") diff --git a/repos/spack_repo/builtin/packages/repeatmasker/package.py b/repos/spack_repo/builtin/packages/repeatmasker/package.py index 762df1d92db..4aee5b261af 100644 --- a/repos/spack_repo/builtin/packages/repeatmasker/package.py +++ b/repos/spack_repo/builtin/packages/repeatmasker/package.py @@ -94,7 +94,7 @@ def install(self, spec, prefix): f.write("\n".join(config_answers)) with open(config_answers_filename, "r") as f: - perl = which("perl") + perl = which("perl", required=True) perl("configure", input=f) # fix perl paths diff --git a/repos/spack_repo/builtin/packages/repeatmodeler/package.py b/repos/spack_repo/builtin/packages/repeatmodeler/package.py index 828e6118999..cf15a0d40c9 100644 --- a/repos/spack_repo/builtin/packages/repeatmodeler/package.py +++ b/repos/spack_repo/builtin/packages/repeatmodeler/package.py @@ -142,7 +142,7 @@ def install(self, spec, prefix): f.write("\n".join(config_answers)) with open(config_filename, "r") as f: - perl = which("perl") + perl = which("perl", required=True) perl("configure", input=f) install_tree(".", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/rinetd/package.py b/repos/spack_repo/builtin/packages/rinetd/package.py index 336a85f7250..55ac7b2b37f 100644 --- a/repos/spack_repo/builtin/packages/rinetd/package.py +++ b/repos/spack_repo/builtin/packages/rinetd/package.py @@ -29,5 +29,5 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: env.prepend_path("PATH", self.prefix.sbin) def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap") diff --git a/repos/spack_repo/builtin/packages/rocm_clang_ocl/package.py b/repos/spack_repo/builtin/packages/rocm_clang_ocl/package.py index 8d406deb6d0..e994999048b 100644 --- a/repos/spack_repo/builtin/packages/rocm_clang_ocl/package.py +++ b/repos/spack_repo/builtin/packages/rocm_clang_ocl/package.py @@ -47,5 +47,5 @@ def test_make(self): with working_dir(test_dir): cmake = self.spec["cmake"].command cmake(f"-DCMAKE_PREFIX_PATH={self.prefix}", ".") - make = which("make") + make = which("make", required=True) make() diff --git a/repos/spack_repo/builtin/packages/rocm_opencl/package.py b/repos/spack_repo/builtin/packages/rocm_opencl/package.py index 36f4e23b24b..2f9506f2c09 100644 --- a/repos/spack_repo/builtin/packages/rocm_opencl/package.py +++ b/repos/spack_repo/builtin/packages/rocm_opencl/package.py @@ -185,7 +185,7 @@ def test_ocltst(self): os.environ["LD_LIBRARY_PATH"] += os.pathsep + join_path(self.prefix, test_dir) - ocltst = which(join_path(self.prefix, test_dir, "ocltst")) + ocltst = which(join_path(self.prefix, test_dir, "ocltst"), required=True) with test_part(self, "test_ocltst_runtime", purpose="check runtime"): ocltst("-m", "liboclruntime.so", "-A", "oclruntime.exclude") diff --git a/repos/spack_repo/builtin/packages/rocm_smi_lib/package.py b/repos/spack_repo/builtin/packages/rocm_smi_lib/package.py index 298e8bda6cf..03cb1982fc9 100644 --- a/repos/spack_repo/builtin/packages/rocm_smi_lib/package.py +++ b/repos/spack_repo/builtin/packages/rocm_smi_lib/package.py @@ -149,5 +149,7 @@ def determine_version(cls, lib): @run_after("build") @on_package_attributes(run_tests=True) def check_build(self): - exe = which(join_path(self.build_directory, "tests", "rocm_smi_test", "rsmitst")) + exe = which( + join_path(self.build_directory, "tests", "rocm_smi_test", "rsmitst"), required=True + ) exe() diff --git a/repos/spack_repo/builtin/packages/rose/package.py b/repos/spack_repo/builtin/packages/rose/package.py index d6f3b8729a5..f740276bb7b 100644 --- a/repos/spack_repo/builtin/packages/rose/package.py +++ b/repos/spack_repo/builtin/packages/rose/package.py @@ -133,11 +133,11 @@ class Rose(AutotoolsPackage): def autoreconf(self, spec, prefix): with working_dir(self.stage.source_path): - bash = which("bash") + bash = which("bash", required=True) bash("build") if "+edg_source" in spec: - git = which("git") + git = which("git", required=True) git( "clone", "rose-dev@rosecompiler1.llnl.gov:rose/edg4x/edg.git", @@ -240,13 +240,13 @@ def build(self, spec, prefix): make() if "+polyopt" in spec: - mkdir = which("mkdir") + mkdir = which("mkdir", required=True) mkdir("-p", "projects/PolyOpt2") with working_dir("projects/PolyOpt2"): env["ROSE_SRC"] = self.stage.source_path env["ROSE_ROOT"] = self.prefix - bash = which("bash") + bash = which("bash", required=True) bash(join_path(self.stage.source_path, "projects/PolyOpt2/install.sh")) def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/routinator/package.py b/repos/spack_repo/builtin/packages/routinator/package.py index 75e9f0abc22..88f0303130f 100644 --- a/repos/spack_repo/builtin/packages/routinator/package.py +++ b/repos/spack_repo/builtin/packages/routinator/package.py @@ -24,5 +24,5 @@ class Routinator(Package): depends_on("rust@1.70:", when="@0.13.0:") def install(self, spec, prefix): - cargo = which("cargo") + cargo = which("cargo", required=True) cargo("install", "--root", prefix, "--path", ".") diff --git a/repos/spack_repo/builtin/packages/rpm/package.py b/repos/spack_repo/builtin/packages/rpm/package.py index 856efb832b7..393d40c35dc 100644 --- a/repos/spack_repo/builtin/packages/rpm/package.py +++ b/repos/spack_repo/builtin/packages/rpm/package.py @@ -114,7 +114,7 @@ class Rpm(AutotoolsPackage): conflicts("~lua", when="@4.17:") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh", "--noconfigure") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/sbcl/package.py b/repos/spack_repo/builtin/packages/sbcl/package.py index 91eb32ec5b2..1496f0bac6a 100644 --- a/repos/spack_repo/builtin/packages/sbcl/package.py +++ b/repos/spack_repo/builtin/packages/sbcl/package.py @@ -55,7 +55,7 @@ class Sbcl(MakefilePackage): phases = ["build", "install"] def build(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) version_str = str(spec.version) @@ -77,5 +77,5 @@ def build(self, spec, prefix): sh("make.sh", *build_args) def install(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("install.sh") diff --git a/repos/spack_repo/builtin/packages/sbcl_bootstrap/package.py b/repos/spack_repo/builtin/packages/sbcl_bootstrap/package.py index 8c9ef73cd2f..7c50a37cb81 100644 --- a/repos/spack_repo/builtin/packages/sbcl_bootstrap/package.py +++ b/repos/spack_repo/builtin/packages/sbcl_bootstrap/package.py @@ -109,6 +109,6 @@ def url_for_version(self, version): return sbcl_url.format(version=version, target=sbcl_targets[target], os=os) def install(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) with set_env(INSTALL_ROOT=self.spec.prefix): sh("install.sh") diff --git a/repos/spack_repo/builtin/packages/scale/package.py b/repos/spack_repo/builtin/packages/scale/package.py index bf49e5f95ae..542b804ba38 100644 --- a/repos/spack_repo/builtin/packages/scale/package.py +++ b/repos/spack_repo/builtin/packages/scale/package.py @@ -66,7 +66,7 @@ def build(self, spec, prefix): env["SCALE_SYS"] = scale_sys_str # set SCALE_NETCDF_INCLUDE - nc_config = which("nc-config") + nc_config = which("nc-config", required=True) nc_str = nc_config("--cflags", "--fflags", output=str) try: env["SCALE_NETCDF_INCLUDE"] = nc_str.replace("\n", " ") @@ -74,7 +74,7 @@ def build(self, spec, prefix): env["SCALE_NETCDF_INCLUDE"] = nc_str.decode().replace("\n", " ") # set SCALE_NETCDF_LIBS - nc_config = which("nc-config") + nc_config = which("nc-config", required=True) nc_str = nc_config("--libs", "--flibs", output=str) try: env["SCALE_NETCDF_LIBS"] = nc_str.replace("\n", " ") diff --git a/repos/spack_repo/builtin/packages/sdsl_lite/package.py b/repos/spack_repo/builtin/packages/sdsl_lite/package.py index 568c34abb63..7813426e755 100644 --- a/repos/spack_repo/builtin/packages/sdsl_lite/package.py +++ b/repos/spack_repo/builtin/packages/sdsl_lite/package.py @@ -35,7 +35,7 @@ def install(self, spec, prefix): # spack will fail to expand the archive on its own due to a link loop # expand it manually here and run the install helper - tar = which("tar") + tar = which("tar", required=True) tar("-xvf", self.stage.archive_file) with working_dir("sdsl-lite-{0}".format(spec.version.dotted)): diff --git a/repos/spack_repo/builtin/packages/selalib/package.py b/repos/spack_repo/builtin/packages/selalib/package.py index 670e0f12b75..674f59f9272 100644 --- a/repos/spack_repo/builtin/packages/selalib/package.py +++ b/repos/spack_repo/builtin/packages/selalib/package.py @@ -71,7 +71,7 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: @on_package_attributes(run_tests=True) def quick_serial_ctest(self): """quickly run a serial subset of tests for sanity check""" - ctest = which("ctest") + ctest = which("ctest", required=True) with working_dir(self.build_directory): ctest("--output-on-failure", "-R", "test_mud2") ctest("--output-on-failure", "-R", "sparse_grid_4d") diff --git a/repos/spack_repo/builtin/packages/siesta/package.py b/repos/spack_repo/builtin/packages/siesta/package.py index a39616d42c9..ce91548b3d4 100644 --- a/repos/spack_repo/builtin/packages/siesta/package.py +++ b/repos/spack_repo/builtin/packages/siesta/package.py @@ -100,7 +100,7 @@ def flag_handler(self, name, flags): return flags, None, None def edit(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) if "+cray" in spec: netcdff_prefix = os.environ.get("NETCDF_DIR", "") hdf5_prefix = os.environ.get("HDF5_DIR", "") @@ -233,7 +233,7 @@ def build(self, spec, prefix): with working_dir("Obj_trans"): make("transiesta", parallel=False) with working_dir("Util"): - sh = which("sh") + sh = which("sh", required=True) sh("build_all.sh") def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/skopeo/package.py b/repos/spack_repo/builtin/packages/skopeo/package.py index 76e3c751067..ec73f608856 100644 --- a/repos/spack_repo/builtin/packages/skopeo/package.py +++ b/repos/spack_repo/builtin/packages/skopeo/package.py @@ -33,7 +33,7 @@ class Skopeo(MakefilePackage): depends_on("lvm2") def edit(self, spec, prefix): - grep = which("grep") + grep = which("grep", required=True) files = grep( "-lR", "/etc/containers/", diff --git a/repos/spack_repo/builtin/packages/slate/package.py b/repos/spack_repo/builtin/packages/slate/package.py index 7e0c9f3a87c..dc7c1720ee4 100644 --- a/repos/spack_repo/builtin/packages/slate/package.py +++ b/repos/spack_repo/builtin/packages/slate/package.py @@ -186,7 +186,7 @@ def mpi_launcher(self): except KeyError: print("Slurm not found, ignoring.") commands = ["srun", "mpirun", "mpiexec"] - return which(*commands, path=searchpath) or which(*commands) + return which(*commands, path=searchpath) or which(*commands, required=True) def test_example(self): """build and run slate example""" @@ -206,7 +206,7 @@ def test_example(self): prefixes = ";".join([self.spec[x].prefix for x in deps.split()]) cmake("-DCMAKE_PREFIX_PATH=" + prefixes, "..") - make = which("make") + make = which("make", required=True) make() launcher = self.mpi_launcher() assert launcher is not None, "Cannot run tests due to absence of MPI launcher" diff --git a/repos/spack_repo/builtin/packages/slepc/package.py b/repos/spack_repo/builtin/packages/slepc/package.py index bea43b08466..9797e208ad9 100644 --- a/repos/spack_repo/builtin/packages/slepc/package.py +++ b/repos/spack_repo/builtin/packages/slepc/package.py @@ -215,10 +215,10 @@ def test_hello(self): join_path(test_dir, f"{test_exe}.c"), ] - cc = which(os.environ["CC"]) + cc = which(os.environ["CC"], required=True) with working_dir(test_dir): cc(*options) - hello = which(test_exe) + hello = which(test_exe, required=True) out = hello(output=str.split, error=str.split) assert "Hello world" in out diff --git a/repos/spack_repo/builtin/packages/snphylo/package.py b/repos/spack_repo/builtin/packages/snphylo/package.py index 6124f35891a..86517f8bf4a 100644 --- a/repos/spack_repo/builtin/packages/snphylo/package.py +++ b/repos/spack_repo/builtin/packages/snphylo/package.py @@ -32,7 +32,7 @@ def install(self, spec, prefix): with open(install_answer_input, "w") as f: f.writelines(install_answer) with open(install_answer_input, "r") as f: - bash = which("bash") + bash = which("bash", required=True) bash("./setup.sh", input=f) install_tree(".", prefix) diff --git a/repos/spack_repo/builtin/packages/sos/package.py b/repos/spack_repo/builtin/packages/sos/package.py index 74f5d197f7f..dd54119f612 100644 --- a/repos/spack_repo/builtin/packages/sos/package.py +++ b/repos/spack_repo/builtin/packages/sos/package.py @@ -100,7 +100,7 @@ def autoreconf(self, spec, prefix): if spec.satisfies("@1.5.3:"): branch_name = "v" + branch_name try: - git = which("git") + git = which("git", required=True) git( "clone", "--depth", diff --git a/repos/spack_repo/builtin/packages/spm/package.py b/repos/spack_repo/builtin/packages/spm/package.py index bb695976b3b..c3b0ed6e274 100644 --- a/repos/spack_repo/builtin/packages/spm/package.py +++ b/repos/spack_repo/builtin/packages/spm/package.py @@ -27,10 +27,10 @@ class Spm(Package): depends_on("matlab", type="run") def install(self, spec, prefix): - unzip = which("unzip") + unzip = which("unzip", required=True) unzip("spm12.ctf") - bash = which("bash") + bash = which("bash", required=True) bash("./run_spm12.sh") install_tree("spm12", prefix) diff --git a/repos/spack_repo/builtin/packages/sqlite/package.py b/repos/spack_repo/builtin/packages/sqlite/package.py index 5a8abad4691..1639384da13 100644 --- a/repos/spack_repo/builtin/packages/sqlite/package.py +++ b/repos/spack_repo/builtin/packages/sqlite/package.py @@ -236,7 +236,7 @@ def test_example(self): db_filename = test_data_dir.join("packages.db") # Ensure the database only contains one table - sqlite3 = which(self.prefix.bin.sqlite3) + sqlite3 = which(self.prefix.bin.sqlite3, required=True) out = sqlite3(db_filename, ".tables", output=str.split, error=str.split) assert "packages" in out diff --git a/repos/spack_repo/builtin/packages/srilm/package.py b/repos/spack_repo/builtin/packages/srilm/package.py index b4556106f89..b90559ef142 100644 --- a/repos/spack_repo/builtin/packages/srilm/package.py +++ b/repos/spack_repo/builtin/packages/srilm/package.py @@ -46,8 +46,8 @@ def edit(self, spec, prefix): makefile.filter(r"# SRILM\s*=.*", "SRILM = {0}".format(self.build_directory)) makefile_common = FileFilter("common/Makefile.common.variables") - makefile_common.filter(r"GAWK\s*=.*", "GAWK = {0}".format(which("gawk"))) - makefile_common.filter(r"PERL\s*=.*", "PERL = {0}".format(which("perl"))) + makefile_common.filter(r"GAWK\s*=.*", "GAWK = {0}".format(which("gawk", required=True))) + makefile_common.filter(r"PERL\s*=.*", "PERL = {0}".format(which("perl", required=True))) makefile_common.filter( r"PIC_FLAG\s*=.*", "PIC_FLAG = {0}".format(self.compiler.cc_pic_flag) ) diff --git a/repos/spack_repo/builtin/packages/sst_core/package.py b/repos/spack_repo/builtin/packages/sst_core/package.py index c6a5c9ce439..4a9d24a07c9 100644 --- a/repos/spack_repo/builtin/packages/sst_core/package.py +++ b/repos/spack_repo/builtin/packages/sst_core/package.py @@ -111,7 +111,7 @@ class SstCore(AutotoolsPackage): # that cannot be easily circumvented with `touch`. @when("@develop,master,14.0.0") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/sst_elements/package.py b/repos/spack_repo/builtin/packages/sst_elements/package.py index 2aca2a69ee8..adf44ef6659 100644 --- a/repos/spack_repo/builtin/packages/sst_elements/package.py +++ b/repos/spack_repo/builtin/packages/sst_elements/package.py @@ -118,7 +118,7 @@ class SstElements(AutotoolsPackage): @when("@develop,master") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/sst_macro/package.py b/repos/spack_repo/builtin/packages/sst_macro/package.py index 0db06c1eec4..443a07cd414 100644 --- a/repos/spack_repo/builtin/packages/sst_macro/package.py +++ b/repos/spack_repo/builtin/packages/sst_macro/package.py @@ -87,7 +87,7 @@ class SstMacro(AutotoolsPackage): @when("@develop,master") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/stata/package.py b/repos/spack_repo/builtin/packages/stata/package.py index 5a2a7452ef0..2e41952c0a2 100644 --- a/repos/spack_repo/builtin/packages/stata/package.py +++ b/repos/spack_repo/builtin/packages/stata/package.py @@ -82,8 +82,8 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: # $ stinit def install(self, spec, prefix): - bash = which("bash") - tar = which("tar") + bash = which("bash", required=True) + tar = which("tar", required=True) res_dir = "unix/linux64/" diff --git a/repos/spack_repo/builtin/packages/strumpack/package.py b/repos/spack_repo/builtin/packages/strumpack/package.py index 49ce66365d0..aaf525901dd 100644 --- a/repos/spack_repo/builtin/packages/strumpack/package.py +++ b/repos/spack_repo/builtin/packages/strumpack/package.py @@ -228,11 +228,11 @@ def _test_example(self, test_prog, test_cmd, pre_args=[]): cmake = self.spec["cmake"].command cmake(*opts) - make = which("make") + make = which("make", required=True) make(test_prog) with set_env(OMP_NUM_THREADS="1"): - exe = which(test_cmd) + exe = which(test_cmd, required=True) test_args = pre_args + [join_path("..", self.test_data_dir, "pde900.mtx")] exe(*test_args) diff --git a/repos/spack_repo/builtin/packages/sundials/package.py b/repos/spack_repo/builtin/packages/sundials/package.py index 8831cf0385b..22816d086ef 100644 --- a/repos/spack_repo/builtin/packages/sundials/package.py +++ b/repos/spack_repo/builtin/packages/sundials/package.py @@ -739,9 +739,9 @@ def run_example(self, exe_path, opts, cmake_bool): cmake = self.spec["cmake"].command cmake("-DCMAKE_PREFIX_PATH=" + prefixes, ".") - make = which("make") + make = which("make", required=True) make() - exe = which(basename) + exe = which(basename, required=True) exe(*opts) make("clean") diff --git a/repos/spack_repo/builtin/packages/superlu/package.py b/repos/spack_repo/builtin/packages/superlu/package.py index c51e0b966dc..4441789868d 100644 --- a/repos/spack_repo/builtin/packages/superlu/package.py +++ b/repos/spack_repo/builtin/packages/superlu/package.py @@ -61,10 +61,10 @@ def test_example(self): args.append("HEADER=" + self.prefix.include) args.append(test_exe) - make = which("make") + make = which("make", required=True) make(*args) - superlu = which(test_exe) + superlu = which(test_exe, required=True) superlu() def cmake_args(self): diff --git a/repos/spack_repo/builtin/packages/superlu_dist/package.py b/repos/spack_repo/builtin/packages/superlu_dist/package.py index 018275e3f4d..22194de2b02 100644 --- a/repos/spack_repo/builtin/packages/superlu_dist/package.py +++ b/repos/spack_repo/builtin/packages/superlu_dist/package.py @@ -200,5 +200,5 @@ def test_pddrive(self): # Smoke test input parameters: -r 2 -c 2 g20.rua test_args = ["-n", "4", superludriver, "-r", "2", "-c", "2", "g20.rua"] # Find the correct mpirun command - mpiexe_f = which("srun", "mpirun", "mpiexec") + mpiexe_f = which("srun", "mpirun", "mpiexec", required=True) mpiexe_f(*test_args) diff --git a/repos/spack_repo/builtin/packages/supermagic/package.py b/repos/spack_repo/builtin/packages/supermagic/package.py index 3f76286bd3d..5a7bb2d990d 100644 --- a/repos/spack_repo/builtin/packages/supermagic/package.py +++ b/repos/spack_repo/builtin/packages/supermagic/package.py @@ -27,7 +27,7 @@ class Supermagic(AutotoolsPackage): @when("@master") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/swig/package.py b/repos/spack_repo/builtin/packages/swig/package.py index ff32999eb4a..bc8bb1f4ba6 100644 --- a/repos/spack_repo/builtin/packages/swig/package.py +++ b/repos/spack_repo/builtin/packages/swig/package.py @@ -158,4 +158,4 @@ def create_symlink(self): @when(Swig.AUTOCONF_VERSIONS) def autoreconf(self, pkg, spec, prefix): - which("sh")("./autogen.sh") + which("sh", required=True)("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/sz/package.py b/repos/spack_repo/builtin/packages/sz/package.py index 8be4b0e401b..c0dec15c0ef 100644 --- a/repos/spack_repo/builtin/packages/sz/package.py +++ b/repos/spack_repo/builtin/packages/sz/package.py @@ -106,7 +106,7 @@ def test_2d_float(self): """Run simple 2D compression/decompression""" test_data_dir = self.test_suite.current_test_data_dir - exe = which(self.prefix.bin.sz) + exe = which(self.prefix.bin.sz, required=True) if exe is None: raise SkipTest(f"sz is not installed for version {self.version}") @@ -132,7 +132,7 @@ def test_3d_float(self): """Run simple 3D compression/decompression""" test_data_dir = self.test_suite.current_test_data_dir - exe = which(self.prefix.bin.sz) + exe = which(self.prefix.bin.sz, required=True) if exe is None: raise SkipTest(f"sz is not installed for version {self.version}") diff --git a/repos/spack_repo/builtin/packages/sz3/package.py b/repos/spack_repo/builtin/packages/sz3/package.py index ce05488b478..7a6509ac3a2 100644 --- a/repos/spack_repo/builtin/packages/sz3/package.py +++ b/repos/spack_repo/builtin/packages/sz3/package.py @@ -52,7 +52,7 @@ def test_sz3_smoke_test(self): """Run sz3 smoke test""" if self.spec.satisfies("@:3.1.6"): raise SkipTest("Package must be installed as version 3.1.7 or later") - exe = which(self.prefix.bin.sz3_smoke_test) + exe = which(self.prefix.bin.sz3_smoke_test, required=True) exe() def test_mdz_smoke_test(self): @@ -61,5 +61,5 @@ def test_mdz_smoke_test(self): raise SkipTest("Package must be installed as version 3.1.7 or later") if "+mdz" not in self.spec: raise SkipTest("Package must be installed with '+mdz'") - exe = which(self.prefix.bin.mdz_smoke_test) + exe = which(self.prefix.bin.mdz_smoke_test, required=True) exe() diff --git a/repos/spack_repo/builtin/packages/tasmanian/package.py b/repos/spack_repo/builtin/packages/tasmanian/package.py index 0e57ee349d8..9e8ceb9789c 100644 --- a/repos/spack_repo/builtin/packages/tasmanian/package.py +++ b/repos/spack_repo/builtin/packages/tasmanian/package.py @@ -148,10 +148,10 @@ def test_make_test(self): if "+mpi" in self.spec: options.append("-DMPI_HOME=" + self.spec["mpi"].prefix) - cmake = which(self.spec["cmake"].prefix.bin.cmake) + cmake = which(self.spec["cmake"].prefix.bin.cmake, required=True) cmake(*options) - make = which("make") + make = which("make", required=True) make() make("test") diff --git a/repos/spack_repo/builtin/packages/tau/package.py b/repos/spack_repo/builtin/packages/tau/package.py index d8ae9830e2c..11de17666f4 100644 --- a/repos/spack_repo/builtin/packages/tau/package.py +++ b/repos/spack_repo/builtin/packages/tau/package.py @@ -594,13 +594,13 @@ def setup_build_tests(self): cache_extra_test_sources(self, self.python_test) def _run_python_test(self, test_name, purpose, work_dir): - tau_python = which(self.prefix.bin.tau_python) + tau_python = which(self.prefix.bin.tau_python, required=True) tau_py_inter = "-tau-python-interpreter=" + self.spec["python"].prefix.bin.python - pprof = which(self.prefix.bin.pprof) + pprof = which(self.prefix.bin.pprof, required=True) with test_part(self, f"{test_name}", purpose, work_dir): if "+mpi" in self.spec: flag = "mpi" - mpirun = which(self.spec["mpi"].prefix.bin.mpirun) + mpirun = which(self.spec["mpi"].prefix.bin.mpirun, required=True) mpirun( "-np", "4", @@ -616,13 +616,13 @@ def _run_python_test(self, test_name, purpose, work_dir): pprof() def _run_default_test(self, test_name, purpose, work_dir): - tau_exec = which(self.prefix.bin.tau_exec) - pprof = which(self.prefix.bin.pprof) + tau_exec = which(self.prefix.bin.tau_exec, required=True) + pprof = which(self.prefix.bin.pprof, required=True) with test_part(self, f"{test_name}", purpose, work_dir): make("all") if "+mpi" in self.spec: flags = ["-T", "mpi"] - mpirun = which(self.spec["mpi"].prefix.bin.mpirun) + mpirun = which(self.spec["mpi"].prefix.bin.mpirun, required=True) mpirun("-np", "4", self.prefix.bin.tau_exec, *flags, "./matmult") else: flags = ["-T", "serial"] @@ -630,13 +630,13 @@ def _run_default_test(self, test_name, purpose, work_dir): pprof() def _run_ompt_test(self, test_name, purpose, work_dir): - tau_exec = which(self.prefix.bin.tau_exec) - pprof = which(self.prefix.bin.pprof) + tau_exec = which(self.prefix.bin.tau_exec, required=True) + pprof = which(self.prefix.bin.pprof, required=True) with test_part(self, f"{test_name}", purpose, work_dir): make("all") if "+mpi" in self.spec: flags = ["-T", "mpi", "-ompt"] - mpirun = which(self.spec["mpi"].prefix.bin.mpirun) + mpirun = which(self.spec["mpi"].prefix.bin.mpirun, required=True) mpirun("-np", "4", self.prefix.bin.tau_exec, *flags, "./mandel") else: flags = ["-T", "serial", "-ompt"] @@ -644,13 +644,13 @@ def _run_ompt_test(self, test_name, purpose, work_dir): pprof() def _run_rocm_test(self, test_name, purpose, work_dir): - tau_exec = which(self.prefix.bin.tau_exec) - pprof = which(self.prefix.bin.pprof) + tau_exec = which(self.prefix.bin.tau_exec, required=True) + pprof = which(self.prefix.bin.pprof, required=True) with test_part(self, f"{test_name}", purpose, work_dir): make("all") if "+mpi" in self.spec: flags = ["-T", "mpi", "-rocm"] - mpirun = which(self.spec["mpi"].prefix.bin.mpirun) + mpirun = which(self.spec["mpi"].prefix.bin.mpirun, required=True) mpirun("-np", "4", self.prefix.bin.tau_exec, *flags, "./gpu-stream-hip") else: flags = ["-T", "serial", "-rocm"] diff --git a/repos/spack_repo/builtin/packages/teckit/package.py b/repos/spack_repo/builtin/packages/teckit/package.py index 14842ca9ad1..8588fc73618 100644 --- a/repos/spack_repo/builtin/packages/teckit/package.py +++ b/repos/spack_repo/builtin/packages/teckit/package.py @@ -45,5 +45,5 @@ def configure_args(self): return args def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("./autogen.sh") diff --git a/repos/spack_repo/builtin/packages/tempo/package.py b/repos/spack_repo/builtin/packages/tempo/package.py index 18375190c08..a195b223844 100644 --- a/repos/spack_repo/builtin/packages/tempo/package.py +++ b/repos/spack_repo/builtin/packages/tempo/package.py @@ -48,7 +48,7 @@ def post_install_packages(self): # Copy some files over needed by TEMPO, again only for the master version if "master" in str(self.version): cd(self.stage.source_path) - cp = which("cp") + cp = which("cp", required=True) cp("obsys.dat", join_path(self.prefix, "obsys.dat")) cp("tempo.hlp", join_path(self.prefix, "tempo.hlp")) diff --git a/repos/spack_repo/builtin/packages/tests_sos/package.py b/repos/spack_repo/builtin/packages/tests_sos/package.py index c52b1e5455b..0450d4fdee0 100644 --- a/repos/spack_repo/builtin/packages/tests_sos/package.py +++ b/repos/spack_repo/builtin/packages/tests_sos/package.py @@ -31,7 +31,7 @@ class TestsSos(AutotoolsPackage): depends_on("sos", type=("build", "run")) def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./autogen.sh") def setup_build_environment(self, env: EnvironmentModifications) -> None: diff --git a/repos/spack_repo/builtin/packages/texlive/package.py b/repos/spack_repo/builtin/packages/texlive/package.py index bd4daa3a6b1..05cc81c2542 100644 --- a/repos/spack_repo/builtin/packages/texlive/package.py +++ b/repos/spack_repo/builtin/packages/texlive/package.py @@ -183,7 +183,7 @@ def setup_texlive(self): mtxrun_lua = join_path( self.prefix, "texmf-dist", "scripts", "context", "lua", "mtxrun.lua" ) - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", mtxrun_lua) mtxrun = Executable(mtxrun_lua) mtxrun("--generate") diff --git a/repos/spack_repo/builtin/packages/tmux/package.py b/repos/spack_repo/builtin/packages/tmux/package.py index e3bba935671..49b80469868 100644 --- a/repos/spack_repo/builtin/packages/tmux/package.py +++ b/repos/spack_repo/builtin/packages/tmux/package.py @@ -78,7 +78,7 @@ class Tmux(AutotoolsPackage): @run_before("autoreconf") def autogen(self): if self.spec.satisfies("@master"): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/totalview/package.py b/repos/spack_repo/builtin/packages/totalview/package.py index e734fe65854..50a3189ccf3 100644 --- a/repos/spack_repo/builtin/packages/totalview/package.py +++ b/repos/spack_repo/builtin/packages/totalview/package.py @@ -180,7 +180,7 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: def install(self, spec, prefix): # Assemble install line - install_cmd = which("./Install") + install_cmd = which("./Install", required=True) arg_list = ["-agree", "-nosymlink", "-directory", "{0}".format(prefix)] # Platform specification. @@ -196,7 +196,7 @@ def install(self, spec, prefix): install_cmd.exe.extend(arg_list) # Run install script for totalview (which automatically installs memoryscape) - install_cmd = which("./Install") + install_cmd = which("./Install", required=True) arg_list.extend(["-install", "totalview"]) install_cmd.exe.extend(arg_list) install_cmd() diff --git a/repos/spack_repo/builtin/packages/tpm2_tss/package.py b/repos/spack_repo/builtin/packages/tpm2_tss/package.py index 5fb71a489dd..9620eeb4d63 100644 --- a/repos/spack_repo/builtin/packages/tpm2_tss/package.py +++ b/repos/spack_repo/builtin/packages/tpm2_tss/package.py @@ -42,5 +42,5 @@ def setup_build_environment(self, env: EnvironmentModifications) -> None: env.prepend_path("ACLOCAL_PATH", self.spec["autoconf-archive"].prefix.share.aclocal) def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("./bootstrap") diff --git a/repos/spack_repo/builtin/packages/trident/package.py b/repos/spack_repo/builtin/packages/trident/package.py index b2f3f20f74f..c786903299e 100644 --- a/repos/spack_repo/builtin/packages/trident/package.py +++ b/repos/spack_repo/builtin/packages/trident/package.py @@ -27,7 +27,7 @@ class Trident(Package): def install(self, spec, prefix): mkdirp(prefix.bin) - go = which("go") + go = which("go", required=True) go("build", "-o", prefix.bin) with working_dir("cli"): go("build", "-o", prefix.bin.tridentctl) diff --git a/repos/spack_repo/builtin/packages/turbine/package.py b/repos/spack_repo/builtin/packages/turbine/package.py index 554fcb4a9bc..c601d7b86ec 100644 --- a/repos/spack_repo/builtin/packages/turbine/package.py +++ b/repos/spack_repo/builtin/packages/turbine/package.py @@ -79,11 +79,7 @@ def configure_args(self): if "+r" in self.spec: r_location = "{0}/rlib/R".format(self.spec["r"].prefix) if not os.path.exists(r_location): - rscript = which("Rscript") - if rscript is not None: - r_location = rscript("-e", "cat(R.home())", output=str) - else: - msg = "Could not locate Rscript on your PATH!" - raise RuntimeError(msg) + rscript = which("Rscript", required=True) + r_location = rscript("-e", "cat(R.home())", output=str) args.append("--with-r={0}".format(r_location)) return args diff --git a/repos/spack_repo/builtin/packages/turbomole/package.py b/repos/spack_repo/builtin/packages/turbomole/package.py index a8040a69ff6..3592c90e5a6 100644 --- a/repos/spack_repo/builtin/packages/turbomole/package.py +++ b/repos/spack_repo/builtin/packages/turbomole/package.py @@ -61,7 +61,7 @@ def install(self, spec, prefix): tm_arch = self.get_tm_arch() - tar = which("tar") + tar = which("tar", required=True) dst = join_path(prefix, "TURBOMOLE") tar("-x", "-z", "-f", "thermocalc.tar.gz") diff --git a/repos/spack_repo/builtin/packages/uftrace/package.py b/repos/spack_repo/builtin/packages/uftrace/package.py index da0fb6451c9..b45b275b281 100644 --- a/repos/spack_repo/builtin/packages/uftrace/package.py +++ b/repos/spack_repo/builtin/packages/uftrace/package.py @@ -57,7 +57,7 @@ def installcheck(self): def test_uftrace(self): """Perform stand-alone/smoke tests using the installed package.""" - uftrace = which(self.prefix.bin.uftrace) + uftrace = which(self.prefix.bin.uftrace, required=True) options = (["-A", ".", "-R", ".", "-P", "main", uftrace, "-V"],) expected = [ r"dwarf", diff --git a/repos/spack_repo/builtin/packages/umoci/package.py b/repos/spack_repo/builtin/packages/umoci/package.py index 3d39cd043b7..4573b720420 100644 --- a/repos/spack_repo/builtin/packages/umoci/package.py +++ b/repos/spack_repo/builtin/packages/umoci/package.py @@ -34,7 +34,7 @@ def build(self, spec, prefix): mkdirp(join_path(self.stage.source_path, "src", provider, project)) - ln = which("ln") + ln = which("ln", required=True) ln("-s", self.stage.source_path, join_path("src", provider, project, repo)) make("GOPATH={0}".format(self.stage.source_path)) diff --git a/repos/spack_repo/builtin/packages/universal_ctags/package.py b/repos/spack_repo/builtin/packages/universal_ctags/package.py index e652d87a35e..45ff2aa33bb 100644 --- a/repos/spack_repo/builtin/packages/universal_ctags/package.py +++ b/repos/spack_repo/builtin/packages/universal_ctags/package.py @@ -42,4 +42,4 @@ class UniversalCtags(AutotoolsPackage): depends_on("pkgconfig", type="build") def autoreconf(self, spec, prefix): - which("bash")("autogen.sh") + which("bash", required=True)("autogen.sh") diff --git a/repos/spack_repo/builtin/packages/upcxx/package.py b/repos/spack_repo/builtin/packages/upcxx/package.py index 0ff266f690c..0b8d781236c 100644 --- a/repos/spack_repo/builtin/packages/upcxx/package.py +++ b/repos/spack_repo/builtin/packages/upcxx/package.py @@ -266,7 +266,7 @@ def check_install(self): def test_upcxx_install(self): """checking UPC++ compile+link for all installed backends""" test_install = join_path(self.prefix.bin, "test-upcxx-install.sh") - test_upcxx_install = which(test_install) + test_upcxx_install = which(test_install, required=True) out = test_upcxx_install(output=str.split, error=str.split) assert "SUCCESS" in out diff --git a/repos/spack_repo/builtin/packages/userspace_rcu/package.py b/repos/spack_repo/builtin/packages/userspace_rcu/package.py index 59b8c54a4fc..a28613e8faf 100644 --- a/repos/spack_repo/builtin/packages/userspace_rcu/package.py +++ b/repos/spack_repo/builtin/packages/userspace_rcu/package.py @@ -43,5 +43,5 @@ class UserspaceRcu(AutotoolsPackage): ) def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap") diff --git a/repos/spack_repo/builtin/packages/vapor/package.py b/repos/spack_repo/builtin/packages/vapor/package.py index 50953d74de4..7ee94f1b6e5 100644 --- a/repos/spack_repo/builtin/packages/vapor/package.py +++ b/repos/spack_repo/builtin/packages/vapor/package.py @@ -97,7 +97,7 @@ def cmake_args(self): # packaged with the source code - need to extract and move @run_before("cmake") def extract_gte(self): - unzip = which("unzip") + unzip = which("unzip", required=True) with working_dir("buildutils"): unzip("GTE.zip") diff --git a/repos/spack_repo/builtin/packages/vc/package.py b/repos/spack_repo/builtin/packages/vc/package.py index b2148673029..3679d887260 100644 --- a/repos/spack_repo/builtin/packages/vc/package.py +++ b/repos/spack_repo/builtin/packages/vc/package.py @@ -39,7 +39,7 @@ def fetch_additional_sources(self): to set those up only as needed. """ if self.run_tests and self.spec.satisfies("@1.4.0:"): - git = which("git") + git = which("git", required=True) with working_dir(join_path(self.stage.source_path, "tests/testdata")): git("clone", "--filter=tree:0", "https://github.com/VcDevel/vc-testdata", ".") # NOTE to maintainers: when adding new versions, diff --git a/repos/spack_repo/builtin/packages/veclibfort/package.py b/repos/spack_repo/builtin/packages/veclibfort/package.py index af09085d5fb..d669f7a3f91 100644 --- a/repos/spack_repo/builtin/packages/veclibfort/package.py +++ b/repos/spack_repo/builtin/packages/veclibfort/package.py @@ -59,7 +59,7 @@ def install(self, spec, prefix): make(*make_args) # test - fc = which("fc") + fc = which("fc", required=True) flags = ["-o", "tester", "-O", "tester.f90"] flags.extend(self.libs.ld_flags.split()) fc(*flags) diff --git a/repos/spack_repo/builtin/packages/vep/package.py b/repos/spack_repo/builtin/packages/vep/package.py index 5b35b374fcb..996ab637e3c 100644 --- a/repos/spack_repo/builtin/packages/vep/package.py +++ b/repos/spack_repo/builtin/packages/vep/package.py @@ -123,7 +123,7 @@ def install(self, spec, prefix): # If we don't do this a bunch of perl libs will be missing # Run the customer VEP installer/downloader, which downloads # copies a bunch of additional perl modules - installer = which(self.vep_installer_path) + installer = which(self.vep_installer_path, required=True) installer(*self.installer_args()) # Manually install auxilary scripts if requested diff --git a/repos/spack_repo/builtin/packages/vep_cache/package.py b/repos/spack_repo/builtin/packages/vep_cache/package.py index e43f6e916e7..3d4129cc6cd 100644 --- a/repos/spack_repo/builtin/packages/vep_cache/package.py +++ b/repos/spack_repo/builtin/packages/vep_cache/package.py @@ -143,7 +143,7 @@ def installer_args(self): def install_with_installer(self): vep = self.spec["vep"].package - installer = which(vep.vep_installer_path) + installer = which(vep.vep_installer_path, required=True) installer(*self.installer_args()) def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/verible/package.py b/repos/spack_repo/builtin/packages/verible/package.py index c43e5fa5ede..c74f6107739 100644 --- a/repos/spack_repo/builtin/packages/verible/package.py +++ b/repos/spack_repo/builtin/packages/verible/package.py @@ -152,6 +152,6 @@ def install(self, spec, prefix): def install(self, spec, prefix): """Install method for versions 0.0.3841 and newer.""" mkdirp(prefix.bin) - bash = which("bash") + bash = which("bash", required=True) bazel("build", "-c", "opt", ":install-binaries") bash(".github/bin/simple-install.sh", prefix.bin) diff --git a/repos/spack_repo/builtin/packages/verrou/package.py b/repos/spack_repo/builtin/packages/verrou/package.py index 3a37f724774..98fee30f6ee 100644 --- a/repos/spack_repo/builtin/packages/verrou/package.py +++ b/repos/spack_repo/builtin/packages/verrou/package.py @@ -90,9 +90,9 @@ def patch(self): # Once this is done, we can patch valgrind if self.spec.satisfies("@:2.0"): - which("patch")("-p0", "--input=verrou/valgrind.diff") + which("patch", required=True)("-p0", "--input=verrou/valgrind.diff") else: - which("patch")("-p1", "--input=verrou/valgrind.diff") + which("patch", required=True)("-p1", "--input=verrou/valgrind.diff") # Autogenerated perl path may be too long, need to fix this here # because these files are used during the build. @@ -101,7 +101,7 @@ def patch(self): def autoreconf(self, spec, prefix): # Needed because we patched valgrind - which("bash")("autogen.sh") + which("bash", required=True)("autogen.sh") def configure_args(self): spec = self.spec diff --git a/repos/spack_repo/builtin/packages/visit_cgns/package.py b/repos/spack_repo/builtin/packages/visit_cgns/package.py index b91386c0fe7..32a1e345925 100644 --- a/repos/spack_repo/builtin/packages/visit_cgns/package.py +++ b/repos/spack_repo/builtin/packages/visit_cgns/package.py @@ -75,7 +75,7 @@ def run_xml2cmake(self): # Regenerate the public cmake files if os.path.exists("CMakeLists.txt"): os.unlink("CMakeLists.txt") - which("xml2cmake")(*args) + which("xml2cmake", required=True)(*args) # spack extension activate : alter VISIT_PLUGIN_DIR ; # xml2cmake should have set it to visit prefix but it can # happen the directory is an alias. diff --git a/repos/spack_repo/builtin/packages/visit_ffp/package.py b/repos/spack_repo/builtin/packages/visit_ffp/package.py index e947ade0832..6665cc7e1d9 100644 --- a/repos/spack_repo/builtin/packages/visit_ffp/package.py +++ b/repos/spack_repo/builtin/packages/visit_ffp/package.py @@ -68,7 +68,7 @@ def run_xml2cmake(self): # Regenerate the public cmake files if os.path.exists("CMakeLists.txt"): os.unlink("CMakeLists.txt") - which("xml2cmake")(*args) + which("xml2cmake", required=True)(*args) # spack extension activate : alter VISIT_PLUGIN_DIR ; # xml2cmake should have set it to visit prefix but it can # happen the directory is an alias. diff --git a/repos/spack_repo/builtin/packages/visit_mfem/package.py b/repos/spack_repo/builtin/packages/visit_mfem/package.py index 5d79ac0eaeb..383e286b31e 100644 --- a/repos/spack_repo/builtin/packages/visit_mfem/package.py +++ b/repos/spack_repo/builtin/packages/visit_mfem/package.py @@ -73,7 +73,7 @@ def run_xml2cmake(self): # Regenerate the public cmake files if os.path.exists("CMakeLists.txt"): os.unlink("CMakeLists.txt") - which("xml2cmake")(*args) + which("xml2cmake", required=True)(*args) # spack extension activate : alter VISIT_PLUGIN_DIR ; # xml2cmake should have set it to visit prefix but it can # happen the directory is an alias. diff --git a/repos/spack_repo/builtin/packages/visit_silo/package.py b/repos/spack_repo/builtin/packages/visit_silo/package.py index f44a93de837..9ae889b07f5 100644 --- a/repos/spack_repo/builtin/packages/visit_silo/package.py +++ b/repos/spack_repo/builtin/packages/visit_silo/package.py @@ -78,7 +78,7 @@ def run_xml2cmake(self): # Regenerate the public cmake files if os.path.exists("CMakeLists.txt"): os.unlink("CMakeLists.txt") - which("xml2cmake")(*args) + which("xml2cmake", required=True)(*args) # spack extension activate : alter VISIT_PLUGIN_DIR ; # xml2cmake should have set it to visit prefix but it can # happen the directory is an alias. diff --git a/repos/spack_repo/builtin/packages/visit_unv/package.py b/repos/spack_repo/builtin/packages/visit_unv/package.py index 3372c627237..a1eb4b7fce1 100644 --- a/repos/spack_repo/builtin/packages/visit_unv/package.py +++ b/repos/spack_repo/builtin/packages/visit_unv/package.py @@ -70,7 +70,7 @@ def run_xml2cmake(self): # Regenerate the public cmake files if os.path.exists("CMakeLists.txt"): os.unlink("CMakeLists.txt") - which("xml2cmake")(*args) + which("xml2cmake", required=True)(*args) # spack extension activate : alter VISIT_PLUGIN_DIR ; # xml2cmake should have set it to visit prefix but it can # happen the directory is an alias. diff --git a/repos/spack_repo/builtin/packages/vizglow/package.py b/repos/spack_repo/builtin/packages/vizglow/package.py index a42ed7b210a..177ec6bb1c1 100644 --- a/repos/spack_repo/builtin/packages/vizglow/package.py +++ b/repos/spack_repo/builtin/packages/vizglow/package.py @@ -82,7 +82,7 @@ def install(self, spec, prefix): installer = glob.glob("VizGlow*Install")[0] - chmod = which("chmod") + chmod = which("chmod", required=True) chmod("+x", installer) installer = Executable(installer) diff --git a/repos/spack_repo/builtin/packages/vmd/package.py b/repos/spack_repo/builtin/packages/vmd/package.py index d44fb729837..81ae929f48b 100644 --- a/repos/spack_repo/builtin/packages/vmd/package.py +++ b/repos/spack_repo/builtin/packages/vmd/package.py @@ -54,7 +54,7 @@ def ensure_rpaths(self): # make sure the executable finds and uses the Spack-provided # libraries, otherwise the executable may or may not run depending # on what is installed on the host - patchelf = which("patchelf") + patchelf = which("patchelf", required=True) rpath = ":".join( self.spec[dep].libs.directories[0] for dep in ["libx11", "libxi", "libxinerama", "gl"] ) diff --git a/repos/spack_repo/builtin/packages/warpx/package.py b/repos/spack_repo/builtin/packages/warpx/package.py index 86004837a98..7e577d5e28a 100644 --- a/repos/spack_repo/builtin/packages/warpx/package.py +++ b/repos/spack_repo/builtin/packages/warpx/package.py @@ -337,7 +337,7 @@ def run_warpx(self, dim): dim_arg = f"{dim}d" if dim.isdigit() else dim exe = find(self.prefix.bin, f"warpx.{dim_arg}.*", recursive=False)[0] cli_args = self._get_input_options(dim, True) - warpx = which(exe) + warpx = which(exe, required=True) warpx(*cli_args) def test_warpx_1d(self): diff --git a/repos/spack_repo/builtin/packages/watch/package.py b/repos/spack_repo/builtin/packages/watch/package.py index cb2779a50f0..3783a9352e5 100644 --- a/repos/spack_repo/builtin/packages/watch/package.py +++ b/repos/spack_repo/builtin/packages/watch/package.py @@ -34,7 +34,7 @@ class Watch(AutotoolsPackage): # https://github.com/Homebrew/homebrew-core/blob/master/Formula/watch.rb def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/whizard/package.py b/repos/spack_repo/builtin/packages/whizard/package.py index 37af79abbec..2e5a91a4d7b 100644 --- a/repos/spack_repo/builtin/packages/whizard/package.py +++ b/repos/spack_repo/builtin/packages/whizard/package.py @@ -158,7 +158,7 @@ def prepare_whizard(self): # As described in the manual (SVN Repository version) # https://whizard.hepforge.org/manual/manual003.html#sec%3Aprerequisites if not os.path.exists("configure.ac"): - shell = which("sh") + shell = which("sh", required=True) shell("build_master.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/wps/package.py b/repos/spack_repo/builtin/packages/wps/package.py index e5c0ab1dc11..9e8c69546e5 100644 --- a/repos/spack_repo/builtin/packages/wps/package.py +++ b/repos/spack_repo/builtin/packages/wps/package.py @@ -112,7 +112,7 @@ def configure(self, spec, prefix): Executable("./configure")(input=fp) def build(self, spec, prefix): - csh = which("csh") + csh = which("csh", required=True) csh("./compile") def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/wrf/package.py b/repos/spack_repo/builtin/packages/wrf/package.py index 7b1b344b086..1d102625d88 100644 --- a/repos/spack_repo/builtin/packages/wrf/package.py +++ b/repos/spack_repo/builtin/packages/wrf/package.py @@ -485,7 +485,7 @@ def configure(self, spec, prefix): def patch_for_libmvec(self): if self.spec.satisfies("@3.9.1.1 %aocc"): fp = self.package_dir + "/patches/3.9/aocc_lmvec.patch" - which("patch")("-s", "-p1", "-i", "{0}".format(fp), "-d", ".") + which("patch", required=True)("-s", "-p1", "-i", "{0}".format(fp), "-d", ".") def run_compile_script(self): csh_bin = self.spec["tcsh"].prefix.bin.csh diff --git a/repos/spack_repo/builtin/packages/wsmancli/package.py b/repos/spack_repo/builtin/packages/wsmancli/package.py index ef3e2a58ef5..f599d4e3621 100644 --- a/repos/spack_repo/builtin/packages/wsmancli/package.py +++ b/repos/spack_repo/builtin/packages/wsmancli/package.py @@ -28,5 +28,5 @@ class Wsmancli(AutotoolsPackage): depends_on("openwsman") def autoreconf(self, spec, prefix): - bash = which("bash") + bash = which("bash", required=True) bash("./bootstrap") diff --git a/repos/spack_repo/builtin/packages/xabclib/package.py b/repos/spack_repo/builtin/packages/xabclib/package.py index d257654360d..82d232614ae 100644 --- a/repos/spack_repo/builtin/packages/xabclib/package.py +++ b/repos/spack_repo/builtin/packages/xabclib/package.py @@ -38,7 +38,7 @@ def edit(self, spec, prefix): m.filter("$(LD)", "$(LD) -mlcmain=main", string=True) def build(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("./make.all") def install(self, spec, prefix): diff --git a/repos/spack_repo/builtin/packages/xdelta/package.py b/repos/spack_repo/builtin/packages/xdelta/package.py index 3e12da1fa6f..a7c6ac259ac 100644 --- a/repos/spack_repo/builtin/packages/xdelta/package.py +++ b/repos/spack_repo/builtin/packages/xdelta/package.py @@ -32,7 +32,7 @@ class Xdelta(AutotoolsPackage): def autoreconf(self, spec, prefix): with working_dir(self.build_directory): - bash = which("bash") + bash = which("bash", required=True) bash( "-c", "aclocal && autoreconf --install && libtoolize && autoconf && " diff --git a/repos/spack_repo/builtin/packages/xmlf90/package.py b/repos/spack_repo/builtin/packages/xmlf90/package.py index 8aceb774c49..0a42905ae26 100644 --- a/repos/spack_repo/builtin/packages/xmlf90/package.py +++ b/repos/spack_repo/builtin/packages/xmlf90/package.py @@ -38,7 +38,7 @@ class Xmlf90(AutotoolsPackage): @when("@1.5.2") def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/yaksa/package.py b/repos/spack_repo/builtin/packages/yaksa/package.py index 59f16eda8a1..e7a8de26f5b 100644 --- a/repos/spack_repo/builtin/packages/yaksa/package.py +++ b/repos/spack_repo/builtin/packages/yaksa/package.py @@ -51,7 +51,7 @@ class Yaksa(AutotoolsPackage, CudaPackage, ROCmPackage): ) def autoreconf(self, spec, prefix): - sh = which("sh") + sh = which("sh", required=True) sh("autogen.sh") def configure_args(self): diff --git a/repos/spack_repo/builtin/packages/ycsb/package.py b/repos/spack_repo/builtin/packages/ycsb/package.py index 748c65dbf9e..1996e753b1f 100644 --- a/repos/spack_repo/builtin/packages/ycsb/package.py +++ b/repos/spack_repo/builtin/packages/ycsb/package.py @@ -40,7 +40,7 @@ class Ycsb(MavenPackage): # depends_on("mongodb-async-driver", type="build") def build(self, spec, prefix): - mvn = which("mvn") + mvn = which("mvn", required=True) # jar_name = ( # "target/mongodb-async-driver-" + spec["mongodb-async-driver"].version.string + ".jar" # ) @@ -63,5 +63,5 @@ def install(self, spec, prefix): distribution = "distribution/target/ycsb-*.tar.gz" with working_dir(self.build_directory): dist_file = glob(distribution)[0] - tar = which("tar") + tar = which("tar", required=True) tar("xf", dist_file, "-C", prefix, "--strip-components=1") diff --git a/repos/spack_repo/builtin/packages/zoltan/package.py b/repos/spack_repo/builtin/packages/zoltan/package.py index 177ee9316fb..05fd4eeda55 100644 --- a/repos/spack_repo/builtin/packages/zoltan/package.py +++ b/repos/spack_repo/builtin/packages/zoltan/package.py @@ -82,7 +82,7 @@ def parallel(self): return not self.spec.satisfies("@:3.6+fortran") def autoreconf(self, spec, prefix): - autoreconf = which("autoreconf") + autoreconf = which("autoreconf", required=True) with working_dir(self.configure_directory): autoreconf("-ivf") diff --git a/repos/spack_repo/builtin/packages/zookeeper_benchmark/package.py b/repos/spack_repo/builtin/packages/zookeeper_benchmark/package.py index 18c5addb805..1e427ddea3e 100644 --- a/repos/spack_repo/builtin/packages/zookeeper_benchmark/package.py +++ b/repos/spack_repo/builtin/packages/zookeeper_benchmark/package.py @@ -23,5 +23,5 @@ class ZookeeperBenchmark(MavenPackage): def build(self, spec, prefix): zookeeper_version = self.spec["zookeeper"].version.string - mvn = which("mvn") + mvn = which("mvn", required=True) mvn("-DZooKeeperVersion=" + zookeeper_version, "package") diff --git a/tests/repos/spack_repo/builtin_mock/packages/cmake_client/package.py b/tests/repos/spack_repo/builtin_mock/packages/cmake_client/package.py index dddf55dea42..5b0103e98d8 100644 --- a/tests/repos/spack_repo/builtin_mock/packages/cmake_client/package.py +++ b/tests/repos/spack_repo/builtin_mock/packages/cmake_client/package.py @@ -110,7 +110,7 @@ def install(self, spec, prefix): check(cmake is not None, "No cmake was in environment!") # check that which('cmake') returns the right one. - cmake = which("cmake") + cmake = which("cmake", required=True) print(cmake) print(cmake.exe) check( From a998731a7e94ef408049329d08a3481d5197736a Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 16 Feb 2026 08:51:09 +0100 Subject: [PATCH 2/2] gptune: do not run which in global scope Signed-off-by: Harmen Stoppels --- .../builtin/packages/gptune/package.py | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/repos/spack_repo/builtin/packages/gptune/package.py b/repos/spack_repo/builtin/packages/gptune/package.py index 2fad7bc64a5..a2879997879 100644 --- a/repos/spack_repo/builtin/packages/gptune/package.py +++ b/repos/spack_repo/builtin/packages/gptune/package.py @@ -231,13 +231,6 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: gptune_path = join_path(self.prefix, self.spec["python"].package.platlib, "GPTune") env.prepend_path("PYTHONPATH", gptune_path) - cmd = { - "bash": which("bash", required=True), - "cp": which("cp", required=True), - "git": which("git", required=True), - "rm": which("rm", required=True), - } - def test_hypre(self): """set up and run hypre example""" spec = self.spec @@ -248,13 +241,17 @@ def test_hypre(self): if not self.spec["hypre"].satisfies("@2.19.0"): raise SkipTest("Package test only works for hypre@2.19.0") + rm = which("rm", required=True) + cp = which("cp", required=True) + git = which("git", required=True) + bash = which("bash", required=True) test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) # copy hypre executables to the correct place wd = join_path(test_dir, "Hypre") with working_dir(wd): - self.cmd["rm"]("-rf", "hypre") - self.cmd["git"]( + rm("-rf", "hypre") + git( "clone", "--depth", "1", @@ -265,12 +262,12 @@ def test_hypre(self): hypre_test_dir = join_path(wd, "hypre", "src", "test") mkdirp(hypre_test_dir) - self.cmd["cp"]("-r", self.spec["hypre"].prefix.bin.ij, hypre_test_dir) + cp("-r", self.spec["hypre"].prefix.bin.ij, hypre_test_dir) # now run the test example with working_dir(join_path(test_dir, "Hypre")): terminate_bash_failures(".") - self.cmd["bash"]("run_examples.sh") + bash("run_examples.sh") def test_superlu(self): """set up and run superlu tests""" @@ -281,18 +278,22 @@ def test_superlu(self): if self.spec["superlu-dist"].version < Version("7.1"): raise SkipTest("Package must be installed with superlu-dist@:7.1") + rm = which("rm", required=True) + cp = which("cp", required=True) + git = which("git", required=True) + bash = which("bash", required=True) test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) # copy only works for-dist executables to the correct place wd = join_path(test_dir, "SuperLU_DIST") with working_dir(wd): - self.cmd["rm"]("-rf", "superlu_dist") + rm("-rf", "superlu_dist") version = self.spec["superlu-dist"].version.string tag = f"v{version}" if version.replace(".", "").isdigit() else version # TODO: Replace this IF/when superlu-dist renames its "master" # branch's version from "develop" to "master". tag = "master" if tag == "develop" else tag - self.cmd["git"]( + git( "clone", "--depth", "1", @@ -304,7 +305,7 @@ def test_superlu(self): superludriver = self.spec["superlu-dist"].prefix.lib.EXAMPLE.pddrive_spawn example_dir = join_path(wd, "superlu_dist", "build", "EXAMPLE") mkdirp(example_dir) - self.cmd["cp"]("-r", superludriver, example_dir) + cp("-r", superludriver, example_dir) apps = ["SuperLU_DIST", "SuperLU_DIST_RCI"] for app in apps: @@ -313,21 +314,23 @@ def test_superlu(self): raise SkipTest("Package must be installed with +superlu+mpispawn") with working_dir(join_path(test_dir, app)): terminate_bash_failures(".") - self.cmd["bash"]("run_examples.sh") + bash("run_examples.sh") def test_demo(self): """Run the demo test""" if self.spec.satisfies("~mpispawn"): raise SkipTest("Package must be installed with +mpispawn") + bash = which("bash", required=True) test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) with working_dir(join_path(test_dir, "GPTune-Demo")): terminate_bash_failures(".") - self.cmd["bash"]("run_examples.sh") + bash("run_examples.sh") def test_scalapack(self): """Run scalapack tests""" + bash = which("bash", required=True) test_dir = join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir) apps = ["Scalapack-PDGEQRF", "Scalapack-PDGEQRF_RCI"] @@ -337,4 +340,4 @@ def test_scalapack(self): raise SkipTest("Package must be installed with +superlu+mpispawn") with working_dir(join_path(test_dir, app)): terminate_bash_failures(".") - self.cmd["bash"]("run_examples.sh") + bash("run_examples.sh")