Skip to content

Commit d9984f1

Browse files
committed
add extensions always in Lua modules with Lmod version guard
1 parent 077c685 commit d9984f1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

easybuild/tools/module_generator.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ def is_loaded(self, mod_names):
334334

335335
return res
336336

337+
def check_version(self, minimal_version):
338+
"""
339+
Check the minimal version of the moduletool in the module file
340+
"""
341+
return self.MODTOOL_VERSION_CHECK % minimal_version
342+
337343
def det_installdir(self, modfile):
338344
"""
339345
Determine installation directory used by given module file
@@ -650,6 +656,8 @@ class ModuleGeneratorTcl(ModuleGenerator):
650656
LOAD_TEMPLATE_DEPENDS_ON = "depends-on %(mod_name)s"
651657
IS_LOADED_TEMPLATE = 'is-loaded %s'
652658

659+
MODTOOL_VERSION_CHECK = ''
660+
653661
def check_group(self, group, error_msg=None):
654662
"""
655663
Generate a check of the software group and the current user, and refuse to load the module if the user don't
@@ -997,6 +1005,8 @@ class ModuleGeneratorLua(ModuleGenerator):
9971005
LOAD_TEMPLATE_DEPENDS_ON = 'depends_on("%(mod_name)s")'
9981006
IS_LOADED_TEMPLATE = 'isloaded("%s")'
9991007

1008+
VERSION_CHECK = 'convertToCanonical(LmodVersion()) > convertToCanonical("%s")'
1009+
10001010
PATH_JOIN_TEMPLATE = 'pathJoin(root, "%s")'
10011011
UPDATE_PATH_TEMPLATE = '%s_path("%s", %s)'
10021012

@@ -1124,9 +1134,10 @@ def get_description(self, conflict=True):
11241134
whatis_lines.append("whatis(%s%s%s)" % (self.START_STR, self.check_str(line), self.END_STR))
11251135

11261136
provide_list = self._generate_provides_list()
1127-
if self.modules_tool.supports_extensions and provide_list:
1128-
provide_list_str = ', '.join(['"%s"' % x for x in provide_list])
1129-
lines.extend(['', 'extensions(%s)' % provide_list_str])
1137+
1138+
if provide_list:
1139+
provide_list_mod = 'extensions(%s)' % ', '.join(['"%s"' % x for x in provide_list])
1140+
self.conditional_statement(self.check_version("8.2.0"), provide_list_mod)
11301141

11311142
txt += '\n'.join([''] + lines + ['']) % {
11321143
'name': self.app.name,

0 commit comments

Comments
 (0)