aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGravatar Jerzy Grzegorek <jerzy.m.grzegorek@gmail.com>2019-08-01 10:02:36 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2019-08-01 22:48:59 +0200
commit83a34f77051db6980aea277a8ab8e467f68f495a (patch)
tree703fc8e91219ea801f4e5c7dac12814621d88eb5 /utils
parentc62a2829209671f4f7a209a07eca6608ebd0dfa7 (diff)
downloadbuildroot-83a34f77051db6980aea277a8ab8e467f68f495a.tar.gz
buildroot-83a34f77051db6980aea277a8ab8e467f68f495a.tar.bz2
utils/checkpackagelib: CommentsMenusPackagesOrder: append elements to arrays if needed
In the future, the nesting level of menus, comments and conditions may increase. The fixed array length used now is not appropriate. Therefore, append elements to the arrays if needed. Also change order of variables. Signed-off-by: Jerzy Grzegorek <jerzy.m.grzegorek@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/checkpackagelib/lib_config.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/utils/checkpackagelib/lib_config.py b/utils/checkpackagelib/lib_config.py
index b42760396e..6cbdc209c8 100644
--- a/utils/checkpackagelib/lib_config.py
+++ b/utils/checkpackagelib/lib_config.py
@@ -61,9 +61,9 @@ class AttributesOrder(_CheckFunction):
class CommentsMenusPackagesOrder(_CheckFunction):
- print_package_warning = [True, True, True, True, True, True]
- menu_of_packages = ["", "", "", "", "", ""]
- package = ["", "", "", "", "", ""]
+ menu_of_packages = []
+ package = []
+ print_package_warning = []
def before(self):
self.state = ""
@@ -92,9 +92,15 @@ class CommentsMenusPackagesOrder(_CheckFunction):
self.state += "-menu"
level = self.get_level()
- self.package[level] = ""
- self.print_package_warning[level] = True
- self.menu_of_packages[level] = text[:-1]
+
+ try:
+ self.menu_of_packages[level] = text[:-1]
+ self.package[level] = ""
+ self.print_package_warning[level] = True
+ except IndexError:
+ self.menu_of_packages.append(text[:-1])
+ self.package.append("")
+ self.print_package_warning.append(True)
elif text.startswith("endif") or text.startswith("endmenu"):
if self.state.endswith("comment"):