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
This commit is contained in:
parent
707b773aa2
commit
0558fd640e
@ -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}'
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user