Skip to content

Commit b4488e0

Browse files
committed
Fix writing spider cache for LMod >= 8.7.12
1 parent 9ba76dd commit b4488e0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

easybuild/tools/modules.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,6 @@ class Lmod(ModulesTool):
13451345
DEPR_VERSION = '7.0.0'
13461346
REQ_VERSION_DEPENDS_ON = '7.6.1'
13471347
VERSION_REGEXP = r"^Modules\s+based\s+on\s+Lua:\s+Version\s+(?P<version>\d\S*)\s"
1348-
USER_CACHE_DIR = os.path.join(os.path.expanduser('~'), '.lmod.d', '.cache')
13491348

13501349
SHOW_HIDDEN_OPTION = '--show-hidden'
13511350

@@ -1361,7 +1360,14 @@ def __init__(self, *args, **kwargs):
13611360
setvar('LMOD_EXTENDED_DEFAULT', 'no', verbose=False)
13621361

13631362
super(Lmod, self).__init__(*args, **kwargs)
1364-
self.supports_depends_on = StrictVersion(self.version) >= StrictVersion(self.REQ_VERSION_DEPENDS_ON)
1363+
version = StrictVersion(self.version)
1364+
1365+
self.supports_depends_on = version >= self.REQ_VERSION_DEPENDS_ON
1366+
# See https://lmod.readthedocs.io/en/latest/125_personal_spider_cache.html
1367+
if version >= '8.7.12':
1368+
self.USER_CACHE_DIR = os.path.join(os.path.expanduser('~'), '.cache', 'lmod')
1369+
else:
1370+
self.USER_CACHE_DIR = os.path.join(os.path.expanduser('~'), '.lmod.d', '.cache')
13651371

13661372
def check_module_function(self, *args, **kwargs):
13671373
"""Check whether selected module tool matches 'module' function definition."""

0 commit comments

Comments
 (0)