summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatish Balay <balay@mcs.anl.gov>2018-10-22 20:10:49 -0500
committerPeter Scheibel <scheibel1@llnl.gov>2018-10-22 18:10:49 -0700
commit79e25032e8395fd67ddef0c679844ccecf245f7c (patch)
tree023cb4be7e6be5617f12f046f3bd7743f3d67710
parent31bed8f8f2ddfb77a8fba98c965aff8dd4442505 (diff)
downloadspack-79e25032e8395fd67ddef0c679844ccecf245f7c.tar.gz
spack-79e25032e8395fd67ddef0c679844ccecf245f7c.tar.bz2
spack-79e25032e8395fd67ddef0c679844ccecf245f7c.tar.xz
spack-79e25032e8395fd67ddef0c679844ccecf245f7c.zip
Bug fix: Module PATH check (#9574)
#9100 added a warning message when a path extracted from a module file did not appear to be a valid filesystem path. This check was applied to a variable which could be a list of paths, which would erroneously trigger the warning. This commit updates the check to run at the actual point where the path has been extracted.
-rw-r--r--lib/spack/spack/util/module_cmd.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/spack/spack/util/module_cmd.py b/lib/spack/spack/util/module_cmd.py
index 69a48306af..d195e0db9c 100644
--- a/lib/spack/spack/util/module_cmd.py
+++ b/lib/spack/spack/util/module_cmd.py
@@ -144,11 +144,6 @@ def get_path_arg_from_module_line(line):
path_arg = words_and_symbols[-2]
else:
path_arg = line.split()[2]
-
- if not os.path.exists(path_arg):
- tty.warn("Extracted path from module does not exist:"
- "\n\tExtracted path: " + path_arg +
- "\n\tFull line: " + line)
return path_arg
@@ -162,7 +157,11 @@ def get_path_from_module(mod):
# Read the module
text = modulecmd('show', mod, output=str, error=str).split('\n')
- return get_path_from_module_contents(text, mod)
+ p = get_path_from_module_contents(text, mod)
+ if p and not os.path.exists(p):
+ tty.warn("Extracted path from module does not exist:"
+ "\n\tExtracted path: " + p)
+ return p
def get_path_from_module_contents(text, module_name):