spack load/environments: allow customization of prefix inspections (#18260)
`spack load` and `spack env activate` now use the prefix inspections defined in `modules.yaml`. This allows users to customize/override environment variable modifications if desired. If no `prefix_inspections` configuration is present, Spack uses the values in the default configuration.
This commit is contained in:
parent
5f636fc317
commit
d65f078f66
@ -5,6 +5,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import spack.config
|
||||||
import spack.util.prefix as prefix
|
import spack.util.prefix as prefix
|
||||||
import spack.util.environment as environment
|
import spack.util.environment as environment
|
||||||
import spack.build_environment as build_env
|
import spack.build_environment as build_env
|
||||||
@ -25,6 +26,10 @@ def prefix_inspections(platform):
|
|||||||
A dictionary mapping subdirectory names to lists of environment
|
A dictionary mapping subdirectory names to lists of environment
|
||||||
variables to modify with that directory if it exists.
|
variables to modify with that directory if it exists.
|
||||||
"""
|
"""
|
||||||
|
inspections = spack.config.get('modules:prefix_inspections', None)
|
||||||
|
if inspections is not None:
|
||||||
|
return inspections
|
||||||
|
|
||||||
inspections = {
|
inspections = {
|
||||||
'bin': ['PATH'],
|
'bin': ['PATH'],
|
||||||
'lib': ['LD_LIBRARY_PATH', 'LIBRARY_PATH'],
|
'lib': ['LD_LIBRARY_PATH', 'LIBRARY_PATH'],
|
||||||
|
Loading…
Reference in New Issue
Block a user