diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/module_parsing.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/util/module_cmd.py | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/spack/spack/test/module_parsing.py b/lib/spack/spack/test/module_parsing.py index 63eafcca26..7483b66ebb 100644 --- a/lib/spack/spack/test/module_parsing.py +++ b/lib/spack/spack/test/module_parsing.py @@ -53,7 +53,8 @@ def test_get_path_from_module(save_env): lines = ['prepend-path LD_LIBRARY_PATH /path/to/lib', 'setenv MOD_DIR /path/to', 'setenv LDFLAGS -Wl,-rpath/path/to/lib', - 'setenv LDFLAGS -L/path/to/lib'] + 'setenv LDFLAGS -L/path/to/lib', + 'prepend-path PATH /path/to/bin'] for line in lines: module_func = '() { eval `echo ' + line + ' bash filler`\n}' diff --git a/lib/spack/spack/util/module_cmd.py b/lib/spack/spack/util/module_cmd.py index c2448aa278..a726023d95 100644 --- a/lib/spack/spack/util/module_cmd.py +++ b/lib/spack/spack/util/module_cmd.py @@ -187,6 +187,12 @@ def get_path_from_module(mod): if L >= 0: return line[L + 2:line.find('/lib')] + # If it sets the PATH, use it + for line in text: + if line.find('PATH') >= 0: + path = get_argument_from_module_line(line) + return path[:path.find('/bin')] + # Unable to find module path return None |