Documentation: spack load/environments prefix inspections (#19961)

As of #18260, `spack load` and `spack env activate` now use
`prefix_inspections` from the modules configuration to decide
how to modify environment variables.

This updates the modules configuration documentation to describe
how to update environment variables with the `prefix_inspections`
section. This also updates the `spack load` and environments
documentation to refer to the new `prefix_inspections` documentation.
This commit is contained in:
Peter Scheibel 2020-11-17 15:24:00 -08:00 committed by GitHub
parent d65f078f66
commit c9ad2affcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 4 deletions

View File

@ -635,8 +635,10 @@ your path:
~/spack/opt/linux-debian7-x86_64/gcc@4.4.7/mpich@3.0.4/bin/mpicc ~/spack/opt/linux-debian7-x86_64/gcc@4.4.7/mpich@3.0.4/bin/mpicc
These commands will add appropriate directories to your ``PATH``, These commands will add appropriate directories to your ``PATH``,
``MANPATH``, ``CPATH``, and ``LD_LIBRARY_PATH``. When you no longer ``MANPATH``, ``CPATH``, and ``LD_LIBRARY_PATH`` according to the
want to use a package, you can type unload or unuse similarly: :ref:`prefix inspections <customize-env-modifications>` defined in your
modules configuration. When you no longer want to use a package, you
can type unload or unuse similarly:
.. code-block:: console .. code-block:: console

View File

@ -815,8 +815,10 @@ environment for Spack commands. The arguments ``-v,--with-view`` and
behavior is to activate with the environment view if there is one. behavior is to activate with the environment view if there is one.
The environment variables affected by the ``spack env activate`` The environment variables affected by the ``spack env activate``
command and the paths that are used to update them are in the command and the paths that are used to update them are determined by
following table. the :ref:`prefix inspections <customize-env-modifications>` defined in
your modules configuration; the defaults are summarized in the following
table.
=================== ========= =================== =========
Variable Paths Variable Paths

View File

@ -394,6 +394,32 @@ that are already in the LMod hierarchy.
For hierarchies that are deeper than three layers ``lmod spider`` may have some issues. For hierarchies that are deeper than three layers ``lmod spider`` may have some issues.
See `this discussion on the LMod project <https://github.com/TACC/Lmod/issues/114>`_. See `this discussion on the LMod project <https://github.com/TACC/Lmod/issues/114>`_.
.. _customize-env-modifications:
"""""""""""""""""""""""""""""""""""
Customize environment modifications
"""""""""""""""""""""""""""""""""""
You can control which prefixes in a Spack package are added to environment
variables with the ``prefix_inspections`` section; this section maps relative
prefixes to the list of environment variables which should be updated with
those prefixes.
.. code-block:: yaml
modules:
prefix_inspections:
bin:
- PATH
lib:
- LIBRARY_PATH
'':
- CMAKE_PREFIX_PATH
In this case, for a Spack package ``foo`` installed to ``/spack/prefix/foo``,
the generated module file for ``foo`` would update ``PATH`` to contain
``/spack/prefix/foo/bin``.
"""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""
Filter out environment modifications Filter out environment modifications
"""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""