4747from easybuild .tools .utilities import trace_msg
4848
4949
50- def construct_exts_filter_cmds (exts_filter , ext ):
51- """
52- Resolve the exts_filter tuple by replacing the template values using the extension
53- :param exts_filter: Tuple of (command, input) using template values (ext_name, ext_version, src)
50+ def get_modulenames (ext , use_name_for_false ):
51+ """Return a list of modulenames for the extension
5452 :param ext: Instance of Extension or dictionary like with 'name' and optionally 'options', 'version', 'source' keys
55- :return: (cmd, input) as a tuple of strings for each modulename. Might be empty if no filtering is intented
53+ :param use_name_for_false: Whether to return a list with the name or an empty list when the modulename is False
5654 """
57-
58- if isinstance (exts_filter , str ) or len (exts_filter ) != 2 :
59- raise EasyBuildError ('exts_filter should be a list or tuple of ("command","input")' )
60-
61- cmd , cmdinput = exts_filter
62-
6355 if not isinstance (ext , dict ):
64- ext = {'name' : ext .name , 'version' : ext . version , 'src' : ext . src , ' options' : ext .options }
56+ ext = {'name' : ext .name , 'options' : ext .options }
6557
6658 try :
6759 modulenames = ext ['options' ]['modulename' ]
@@ -73,11 +65,31 @@ def construct_exts_filter_cmds(exts_filter, ext):
7365 raise EasyBuildError (f"Empty modulename list for { ext ['name' ]} is not supported."
7466 "Use `False` to skip checking the module!" )
7567 elif modulenames is False :
76- return [] # Skip any checks
68+ return [ext [ 'name' ]] if use_name_for_false else []
7769 elif not isinstance (modulenames , str ):
7870 raise EasyBuildError (f"Wrong type of modulename for { ext ['name' ]} : { type (modulenames )} : { modulenames } " )
7971 else :
8072 modulenames = [modulenames ]
73+ return modulenames
74+
75+
76+ def construct_exts_filter_cmds (exts_filter , ext ):
77+ """
78+ Resolve the exts_filter tuple by replacing the template values using the extension
79+ :param exts_filter: Tuple of (command, input) using template values (ext_name, ext_version, src)
80+ :param ext: Instance of Extension or dictionary like with 'name' and optionally 'options', 'version', 'source' keys
81+ :return: (cmd, input) as a tuple of strings for each modulename. Might be empty if no filtering is intented
82+ """
83+
84+ if isinstance (exts_filter , str ) or len (exts_filter ) != 2 :
85+ raise EasyBuildError ('exts_filter should be a list or tuple of ("command","input")' )
86+
87+ cmd , cmdinput = exts_filter
88+
89+ if not isinstance (ext , dict ):
90+ ext = {'name' : ext .name , 'version' : ext .version , 'src' : ext .src , 'options' : ext .options }
91+
92+ modulenames = get_modulenames (ext , use_name_for_false = False )
8193
8294 result = []
8395 for modulename in modulenames :
0 commit comments