@@ -64,13 +64,11 @@ def check_value(value, context):
6464class EasyStack (object ):
6565 """One class instance per easystack. General options + list of all SoftwareSpecs instances"""
6666
67- def __init__ (self , easyconfigs = None ):
67+ def __init__ (self ):
6868 self .easybuild_version = None
6969 self .robot = False
7070 self .software_list = []
71- self .easyconfigs = []
72- if easyconfigs is not None :
73- self .easyconfigs .extend (easyconfigs )
71+ self .easyconfigs = [] # A list of easyconfig names. May or may not include .eb extension
7472
7573 def compose_ec_filenames (self ):
7674 """Returns a list of all easyconfig names"""
@@ -163,8 +161,23 @@ def parse_by_easyconfigs(filepath, easyconfigs, easybuild_version=None, robot=Fa
163161 """
164162 Parse easystack file with 'easyconfigs' as top-level key.
165163 """
166- easystack = EasyStack (easyconfigs = easyconfigs )
167164
165+ easystack = EasyStack ()
166+
167+ for easyconfig in easyconfigs :
168+ if isinstance (easyconfig , str ):
169+ easystack .easyconfigs .append (easyconfig )
170+ elif isinstance (easyconfig , dict ):
171+ if len (easyconfig ) == 1 :
172+ # Get single key from dictionary 'easyconfig'
173+ easyconf_name = list (easyconfig .keys ())[0 ]
174+ easystack .easyconfigs .append (easyconf_name )
175+ else :
176+ dict_keys = ', ' .join (easyconfig .keys ())
177+ msg = "Failed to parse easystack file: expected a dictionary with one key (the EasyConfig name). "
178+ msg += "Instead found keys: %s" % dict_keys
179+ raise EasyBuildError (msg )
180+
168181 return easystack
169182
170183 @staticmethod
0 commit comments