diff options
author | Milo Casagrande <milo@ubuntu.com> | 2012-07-20 15:15:12 +0200 |
---|---|---|
committer | Milo Casagrande <milo@ubuntu.com> | 2012-07-20 15:15:12 +0200 |
commit | 4052fe52e90b92b85a4f2602aed8654b350ad3b5 (patch) | |
tree | 7ddb77cf8614dd7da70bee93597c3a91d935e99f /linaro-hwpack-install | |
parent | 327a2fca1ce1fe28576f423d0e97cee58c109f88 (diff) |
Fixed problem with bash script.
Diffstat (limited to 'linaro-hwpack-install')
-rwxr-xr-x | linaro-hwpack-install | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/linaro-hwpack-install b/linaro-hwpack-install index 5d1daf4..d3544e4 100755 --- a/linaro-hwpack-install +++ b/linaro-hwpack-install @@ -144,16 +144,30 @@ with open('${HWPACK_DIR}/metadata') as configv3: key = key_match.group(2) root[key] = {} elif list_item: # - value + # If the list has extra indentation then root == {} + # If the list doesn't have extra indentation, root = {key: {}} + # We need to create a list in that empty dictionary. Work out + # where it is, assign it to insert_point. + insert_point = None if root == {}: - root[''] = [] # Store lists in dict with '' as key - root[''].append(list_item.group(2)) + insert_point = root + keys = root.keys() + if len(keys) == 1: + insert_point = root[keys[0]] + + if insert_point == {}: + insert_point[''] = [] + + insert_point[''].append(list_item.group(2)) keys = '$1'.split(' ') for key in keys: if isinstance(config, list): key = int(key) config = config[key] - if isinstance(config, dict) and isinstance(config[''], list): + if(isinstance(config, dict) and + '' in config and + isinstance(config[''], list)): config = config[''] print config " |