@@ -364,6 +364,14 @@ def comment(self, msg):
364364 """Return given string formatted as a comment."""
365365 raise NotImplementedError
366366
367+ def check_version (self , minimal_version_maj , minimal_version_min ):
368+ """
369+ Check the minimal version of the moduletool in the module file
370+ :param minimal_version_maj: the major version to check
371+ :param minimal_version_min: the minor version to check
372+ """
373+ raise NotImplementedError
374+
367375 def conditional_statement (self , conditions , body , negative = False , else_body = None , indent = True ,
368376 cond_or = False , cond_tmpl = None ):
369377 """
@@ -519,11 +527,12 @@ def _generate_extension_list(self):
519527
520528 return extensions
521529
522- def _generate_provides_list (self ):
530+ def _generate_extensions_list (self ):
523531 """
524532 Generate a list of all extensions in name/version format
525533 """
526534 exts_list = self .app .cfg ['exts_list' ]
535+ # the format is extension_name/extension_version
527536 exts_ver_list = sorted (['%s/%s' % (ext [0 ], ext [1 ]) for ext in exts_list ], key = str .lower )
528537
529538 return exts_ver_list
@@ -993,8 +1002,6 @@ class ModuleGeneratorLua(ModuleGenerator):
9931002 LOAD_TEMPLATE_DEPENDS_ON = 'depends_on("%(mod_name)s")'
9941003 IS_LOADED_TEMPLATE = 'isloaded("%s")'
9951004
996- VERSION_CHECK = 'convertToCanonical(LmodVersion()) > convertToCanonical("%(ver_maj)s.%(ver_min)s")'
997-
9981005 PATH_JOIN_TEMPLATE = 'pathJoin(root, "%s")'
9991006 UPDATE_PATH_TEMPLATE = '%s_path("%s", %s)'
10001007
@@ -1012,8 +1019,11 @@ def __init__(self, *args, **kwargs):
10121019 def check_version (self , minimal_version_maj , minimal_version_min ):
10131020 """
10141021 Check the minimal version of the moduletool in the module file
1022+ :param minimal_version_maj: the major version to check
1023+ :param minimal_version_min: the minor version to check
10151024 """
1016- return self .VERSION_CHECK % {
1025+ LMOD_VERSION_CHECK_EXPR = 'convertToCanonical(LmodVersion()) > convertToCanonical("%(ver_maj)s.%(ver_min)s")'
1026+ return LMOD_VERSION_CHECK_EXPR % {
10171027 'ver_maj' : minimal_version_maj ,
10181028 'ver_min' : minimal_version_min ,
10191029 }
@@ -1130,10 +1140,12 @@ def get_description(self, conflict=True):
11301140 for line in self ._generate_whatis_lines ():
11311141 whatis_lines .append ("whatis(%s%s%s)" % (self .START_STR , self .check_str (line ), self .END_STR ))
11321142
1133- provide_list = self ._generate_provides_list ()
1143+ provide_list = self ._generate_extensions_list ()
11341144
11351145 if provide_list :
11361146 provide_list_mod = 'extensions(%s)' % ', ' .join (['"%s"' % x for x in provide_list ])
1147+ # put this behind a Lmod version check as extension are only supported since Lmod 8.2.0
1148+ # Ref: https://lmod.readthedocs.io/en/latest/330_extensions.html#module-extensions
11371149 lines .extend (['' , self .conditional_statement (self .check_version ("8" , "2" ), provide_list_mod )])
11381150
11391151 txt += '\n ' .join (['' ] + lines + ['' ]) % {
0 commit comments