Skip to content

Commit 95087af

Browse files
committed
Fix inconsistent module path usage that leads to repeated reloading in HMNS.
1 parent d037ed6 commit 95087af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

easybuild/tools/modules.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def set_mod_paths(self, mod_paths=None):
342342
# make sure we don't have the same path twice, using nub
343343
if mod_paths is None:
344344
# no paths specified, so grab list of (existing) module paths from $MODULEPATH
345-
self.mod_paths = [p for p in nub(curr_module_paths()) if os.path.exists(p)]
345+
self.mod_paths = nub(curr_module_paths())
346346
else:
347347
for mod_path in nub(mod_paths):
348348
self.prepend_module_path(mod_path, set_mod_paths=False)
@@ -1475,8 +1475,8 @@ def curr_module_paths():
14751475
"""
14761476
Return a list of current module paths.
14771477
"""
1478-
# avoid empty entries, which don't make any sense
1479-
return [p for p in os.environ.get('MODULEPATH', '').split(':') if p]
1478+
# avoid empty or nonexistent paths, which don't make any sense
1479+
return [p for p in os.environ.get('MODULEPATH', '').split(':') if p and os.path.exists(p)]
14801480

14811481

14821482
def mk_module_path(paths):

0 commit comments

Comments
 (0)