@@ -364,11 +364,12 @@ 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 ):
367+ def check_version (self , minimal_version_maj , minimal_version_min , minimal_version_patch = '0' ):
368368 """
369369 Check the minimal version of the modules tool in the module file
370370 :param minimal_version_maj: the major version to check
371371 :param minimal_version_min: the minor version to check
372+ :param minimal_version_patch: the patch version to check
372373 """
373374 raise NotImplementedError
374375
@@ -534,9 +535,14 @@ def _generate_extensions_list(self):
534535 """
535536 exts_list = self .app .cfg ['exts_list' ]
536537 # the format is extension_name/extension_version
537- exts_ver_list = sorted (['%s/%s' % (ext [0 ], ext [1 ]) for ext in exts_list ], key = str .lower )
538+ exts_ver_list = []
539+ for ext in exts_list :
540+ if isinstance (ext , tuple ):
541+ exts_ver_list .append ('%s/%s' % (ext [0 ], ext [1 ]))
542+ elif isinstance (ext , string_type ):
543+ exts_ver_list .append (ext )
538544
539- return exts_ver_list
545+ return sorted ( exts_ver_list , key = str . lower )
540546
541547 def _generate_help_text (self ):
542548 """
@@ -1035,16 +1041,18 @@ def __init__(self, *args, **kwargs):
10351041 if self .modules_tool .version and LooseVersion (self .modules_tool .version ) >= LooseVersion ('7.7.38' ):
10361042 self .DOT_MODULERC = '.modulerc.lua'
10371043
1038- def check_version (self , minimal_version_maj , minimal_version_min ):
1044+ def check_version (self , minimal_version_maj , minimal_version_min , minimal_version_patch = '0' ):
10391045 """
10401046 Check the minimal version of the moduletool in the module file
10411047 :param minimal_version_maj: the major version to check
10421048 :param minimal_version_min: the minor version to check
1049+ :param minimal_version_patch: the patch version to check
10431050 """
1044- lmod_version_check_expr = 'convertToCanonical(LmodVersion()) > convertToCanonical("%(ver_maj )s.%(ver_min )s")'
1051+ lmod_version_check_expr = 'convertToCanonical(LmodVersion()) >= convertToCanonical("%(maj )s.%(min)s.%(patch )s")'
10451052 return lmod_version_check_expr % {
1046- 'ver_maj' : minimal_version_maj ,
1047- 'ver_min' : minimal_version_min ,
1053+ 'maj' : minimal_version_maj ,
1054+ 'min' : minimal_version_min ,
1055+ 'patch' : minimal_version_patch ,
10481056 }
10491057
10501058 def check_group (self , group , error_msg = None ):
@@ -1163,10 +1171,11 @@ def get_description(self, conflict=True):
11631171 extensions_list = self ._generate_extensions_list ()
11641172
11651173 if extensions_list :
1166- extensions_stmt = 'extensions(%s)' % ', ' .join (['"%s"' % x for x in extensions_list ])
1167- # put this behind a Lmod version check as 'extensions' is only supported since Lmod 8.2.0,
1168- # see https://lmod.readthedocs.io/en/latest/330_extensions.html#module-extensions
1169- lines .extend (['' , self .conditional_statement (self .check_version ("8" , "2" ), extensions_stmt )])
1174+ extensions_stmt = 'extensions("%s")' % ',' .join (['%s' % x for x in extensions_list ])
1175+ # put this behind a Lmod version check as 'extensions' is only (well) supported since Lmod 8.2.8,
1176+ # see https://lmod.readthedocs.io/en/latest/330_extensions.html#module-extensions and
1177+ # https://github.com/TACC/Lmod/issues/428
1178+ lines .extend (['' , self .conditional_statement (self .check_version ("8" , "2" , "8" ), extensions_stmt )])
11701179
11711180 txt += '\n ' .join (['' ] + lines + ['' ]) % {
11721181 'name' : self .app .name ,
0 commit comments