Molecule:

- allow to split spec file variables into multiple lines (paths_to_remove for example)


git-svn-id: http://svn.sabayonlinux.org/projects/molecule/trunk@3096 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
lxnay
2009-03-01 19:43:27 +00:00
parent 8adae5a70e
commit 9645cbdc25
+22 -6
View File
@@ -217,17 +217,33 @@ class SpecParser:
def parse(self):
mydict = {}
data = self.__generic_parser(self.filepath)
# compact lines properly
old_key = None
for line in data:
try:
key, value = line.split(":",1)
except (ValueError, IndexError,):
continue
key = key.strip()
if ":" in line:
try:
key, value = line.split(":",1)
except ValueError:
continue
key = key.strip()
old_key = key
elif isinstance(old_key,basestring):
key = old_key
value = line.strip()
if not value: continue
check_dict = self.parser_data_path.get(key)
if not isinstance(check_dict,dict): continue
value = check_dict['ve'](value)
if not check_dict['cb'](value): continue
mydict[key] = value
if key in mydict:
if isinstance(value,basestring):
mydict[key] += " %s" % (value,)
elif isinstance(value,list):
mydict[key] += value
else:
continue
else:
mydict[key] = value
self.validate_parse(mydict)
return mydict.copy()