diff options
author | Kelly (KT) Thompson <KineticTheory@users.noreply.github.com> | 2017-09-16 14:26:29 -0600 |
---|---|---|
committer | becker33 <becker33@llnl.gov> | 2017-09-16 13:26:29 -0700 |
commit | 0558fd640eadc979f8f44e0ffaf8b212dbd1b9e0 (patch) | |
tree | ba824f67fbc646c24cae07ec85b7022ffc439b46 | |
parent | 707b773aa2a711cc21f86230249b8f43adea6518 (diff) | |
download | spack-0558fd640eadc979f8f44e0ffaf8b212dbd1b9e0.tar.gz spack-0558fd640eadc979f8f44e0ffaf8b212dbd1b9e0.tar.bz2 spack-0558fd640eadc979f8f44e0ffaf8b212dbd1b9e0.tar.xz spack-0558fd640eadc979f8f44e0ffaf8b212dbd1b9e0.zip |
Improve external package location detection algorithm. (#5145)
Also inspect `PATH` to help locate an external package and provide a test for
getting path from module's PATH.
Fixes #5141
-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 |