Skip to content

Commit

Permalink
Fix writing spider cache for LMod >= 8.7.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Dec 14, 2023
1 parent 9ba76dd commit b4488e0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions easybuild/tools/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,6 @@ class Lmod(ModulesTool):
DEPR_VERSION = '7.0.0'
REQ_VERSION_DEPENDS_ON = '7.6.1'
VERSION_REGEXP = r"^Modules\s+based\s+on\s+Lua:\s+Version\s+(?P<version>\d\S*)\s"
USER_CACHE_DIR = os.path.join(os.path.expanduser('~'), '.lmod.d', '.cache')

SHOW_HIDDEN_OPTION = '--show-hidden'

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

super(Lmod, self).__init__(*args, **kwargs)
self.supports_depends_on = StrictVersion(self.version) >= StrictVersion(self.REQ_VERSION_DEPENDS_ON)
version = StrictVersion(self.version)

self.supports_depends_on = version >= self.REQ_VERSION_DEPENDS_ON
# See https://lmod.readthedocs.io/en/latest/125_personal_spider_cache.html
if version >= '8.7.12':
self.USER_CACHE_DIR = os.path.join(os.path.expanduser('~'), '.cache', 'lmod')
else:
self.USER_CACHE_DIR = os.path.join(os.path.expanduser('~'), '.lmod.d', '.cache')

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

0 comments on commit b4488e0

Please sign in to comment.