From 828c5ad27a1bd7324e201fd927352f7d73c9dfe2 Mon Sep 17 00:00:00 2001 From: Aliaksandr Barouski Date: Thu, 7 Jul 2016 15:47:09 -0700 Subject: [PATCH] Fixed multiple common-refs processing --- build-aux/qmi-codegen/Container.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build-aux/qmi-codegen/Container.py b/build-aux/qmi-codegen/Container.py index d79722b..46e4ddf 100644 --- a/build-aux/qmi-codegen/Container.py +++ b/build-aux/qmi-codegen/Container.py @@ -58,6 +58,7 @@ class Container: if dictionary is not None: self.fields = [] + new_dict = [] # First, look for references to common types for field_dictionary in dictionary: if 'common-ref' in field_dictionary: @@ -69,12 +70,13 @@ class Container: copy = dict(common) if 'prerequisites' in field_dictionary: copy['prerequisites'] = field_dictionary['prerequisites'] - dictionary.remove(field_dictionary) - dictionary.append(copy) + new_dict.append(copy) break else: raise RuntimeError('Common type \'%s\' not found' % field_dictionary['name']) - + else: + new_dict.append(field_dictionary) + dictionary = new_dict # We need to sort the fields, so that the ones with prerequisites are # include after the prerequisites themselves. Note: we don't currently # support complex setups yet. -- 2.8.0.rc3.226.g39d4020