remove a few redundant calls to setup_run_environment (#42718)

Any package `X` used as `depends_on("x", type="build")` will have
`X.setup_run_environment(env)` called, because it has to be able to
"run" in the build environment.

So there is no point in calling `setup_run_environment` from
`setup_dependent_build_environment`.

Also it's redundant to call `setup_run_environment` in
`setup_dependent_run_environment`, cause (a) the latter is called _for
every parent edge_ instead of once per node, and (b) it's only called
after `setup_run_environment` is called anyways. Better to call
`setup_run_environment` once and only once.
This commit is contained in:
Harmen Stoppels 2024-02-19 11:43:45 +01:00 committed by GitHub
parent 267defd9d3
commit 668879141f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 0 additions and 37 deletions

View file

@ -77,7 +77,6 @@ def setup_run_environment(self, env):
env.set("MPIF90", spack_fc)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
env.set("MPICH_CC", spack_cc)
env.set("MPICH_CXX", spack_cxx)
env.set("MPICH_F77", spack_f77)

View file

@ -33,8 +33,6 @@ def setup_run_environment(self, env):
env.set("MPIF90", spack_fc)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
env.set("MPICH_CC", spack_cc)
env.set("MPICH_CXX", spack_cxx)
env.set("MPICH_F77", spack_f77)

View file

@ -381,12 +381,6 @@ def setup_run_environment(self, env):
if "target=ppc64le: platform=linux" in self.spec:
env.set("cuDNN_ROOT", os.path.join(self.prefix, "targets", "ppc64le-linux"))
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def setup_dependent_run_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def install(self, spec, prefix):
install_tree(".", prefix)

View file

@ -47,9 +47,6 @@ def setup_run_environment(self, env):
env.prepend_path("LIBRARY_PATH", self.prefix.linux.lib64)
env.prepend_path("LD_LIBRARY_PATH", self.prefix.linux.lib64)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def edit(self, spec, prefix):
# Move contents to dmd/
mkdir = which("mkdir")

View file

@ -41,9 +41,6 @@ def setup_dependent_package(self, module, dependent_spec):
self.spec.mpif77 = self.prefix.bin.mpifrt
self.spec.mpifc = self.prefix.bin.mpifrt
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def setup_run_environment(self, env):
# Because MPI are both compilers and runtimes, we set up the compilers
# as part of run environment

View file

@ -88,11 +88,9 @@ def url_for_version(self, version):
def setup_build_environment(self, env):
env.set("GENIE", self.stage.source_path)
return super().setup_build_environment(env)
def setup_run_environment(self, env):
env.set("GENIE", self.prefix)
return super().setup_run_environment(env)
def install(self, spec, prefix):
configure = Executable("./configure")

View file

@ -455,8 +455,6 @@ def setup_run_environment(self, env):
env.set("MPIF90", join_path(self.prefix.bin, "mpif90"))
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
env.set("MPICH_CC", spack_cc)
env.set("MPICH_CXX", spack_cxx)
env.set("MPICH_F77", spack_f77)

View file

@ -90,7 +90,6 @@ def setup_run_environment(self, env):
env.set("MPIF90", join_path(self.prefix.bin, "mpifc"))
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
# Use the Spack compiler wrappers under MPI
env.set("MPITRAMPOLINE_CC", spack_cc)
env.set("MPITRAMPOLINE_CXX", spack_cxx)

View file

@ -35,8 +35,6 @@ def libs(self):
return find_libraries(libraries, root=self.prefix, shared=True, recursive=True)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
# use the Spack compiler wrappers under MPI
env.set("MPICC_CC", spack_cc)
env.set("MPICXX_CXX", spack_cxx)

View file

@ -300,7 +300,6 @@ def libs(self):
class BaseBuilder(metaclass=spack.builder.PhaseCallbacksMeta):
def setup_dependent_build_environment(self, env, dependent_spec):
self.pkg.setup_run_environment(env)
# Some packages, e.g. ncview, refuse to build if the compiler path returned by nc-config
# differs from the path to the compiler that the package should be built with. Therefore,
# we have to shadow nc-config from self.prefix.bin, which references the real compiler,

View file

@ -824,8 +824,6 @@ def setup_run_environment(self, env):
env.set("MPIF90", join_path(self.prefix.bin, "mpif90"))
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
# Use the spack compiler wrappers under MPI
env.set("OMPI_CC", spack_cc)
env.set("OMPI_CXX", spack_cxx)

View file

@ -116,14 +116,8 @@ def setup_run_environment(self, env):
# * https://rasterio.readthedocs.io/en/latest/faq.html
env.set("PROJ_LIB", self.prefix.share.proj)
def setup_dependent_run_environment(self, env, dependent_spec):
self.setup_run_environment(env)
class BaseBuilder(metaclass=spack.builder.PhaseCallbacksMeta):
def setup_dependent_build_environment(self, env, dependent_spec):
self.pkg.setup_run_environment(env)
def setup_build_environment(self, env):
env.set("PROJ_LIB", join_path(self.pkg.stage.source_path, "nad"))

View file

@ -158,9 +158,6 @@ def setup_run_environment(self, env):
# enable the Python interface in a non-standard directory:
env.prepend_path("PYTHONPATH", self.prefix.python)
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
def setup_dependent_package(self, module, dependent_spec):
# Simplify the location of the preprocessor by dependent packages:
self.spec.pp_ser = join_path(self.prefix.python.pp_ser, "pp_ser.py")

View file

@ -184,9 +184,6 @@ def setup_build_environment(self, env):
def setup_run_environment(self, env):
env.prepend_path("PATH", join_path(self.prefix.bin, self.tex_arch()))
def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env)
@when("@live")
def autoreconf(self, spec, prefix):
touch("configure")