setup-env: allow users to skip module function setup (#24236)

* setup-env: allow users to skip module function setup

* Add documentation on SPACK_SKIP_MODULES
This commit is contained in:
Adam J. Stewart 2021-06-11 14:19:24 -05:00 committed by GitHub
parent 4a8785d371
commit 11f370e7be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -70,7 +70,13 @@ Sourcing these files will put the ``spack`` command in your ``PATH``, set
up your ``MODULEPATH`` to use Spack's packages, and add other useful up your ``MODULEPATH`` to use Spack's packages, and add other useful
shell integration for :ref:`certain commands <packaging-shell-support>`, shell integration for :ref:`certain commands <packaging-shell-support>`,
:ref:`environments <environments>`, and :ref:`modules <modules>`. For :ref:`environments <environments>`, and :ref:`modules <modules>`. For
``bash``, it also sets up tab completion. ``bash`` and ``zsh``, it also sets up tab completion.
In order to know which directory to add to your ``MODULEPATH``, these scripts
query the ``spack`` command. On shared filesystems, this can be a bit slow,
especially if you log in frequently. If you don't use modules, or want to set
``MODULEPATH`` manually instead, you can set the ``SPACK_SKIP_MODULES``
environment variable to skip this step and speed up sourcing the file.
If you do not want to use Spack's shell support, you can always just run If you do not want to use Spack's shell support, you can always just run
the ``spack`` command directly from ``spack/bin/spack``. the ``spack`` command directly from ``spack/bin/spack``.

View File

@ -703,7 +703,7 @@ set -xg _sp_shell "fish"
# Check whether we need environment-variables (module) <= `use` is not available # Check whether we need environment-variables (module) <= `use` is not available
# #
set -l need_module "no" set -l need_module "no"
if not functions -q use; and not functions -q module if test -z "$SPACK_SKIP_MODULES"; and not functions -q use; and not functions -q module
set need_module "yes" set need_module "yes"
end end

View File

@ -307,7 +307,7 @@ _spack_fn_exists() {
} }
need_module="no" need_module="no"
if ! _spack_fn_exists use && ! _spack_fn_exists module; then if [ -z "${SPACK_SKIP_MODULES+x}" ] && ! _spack_fn_exists use && ! _spack_fn_exists module; then
need_module="yes" need_module="yes"
fi; fi;