From d2c1430c91c574dc0dfd84f3652c8d9af8c77568 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 22 Aug 2018 02:25:20 +0200 Subject: Introduce Kconfig.unique_defined_syms and Kconfig.unique_choices These are the same as Kconfig.defined_syms and Kconfig.choices, except duplicates are removed. Kconfig order is still preserved. This is almost always what you want when iterating through symbols and choices, as it potentially saves work, avoids generating duplicates when writing output, and still preserves Kconfig order for readability. The old attributes will be kept for backwards compatibility (maybe there's some rare cases where they could be useful too). They're created internally anyway. --- examples/allnoconfig_walk.py | 2 +- examples/defconfig_oldconfig.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/allnoconfig_walk.py b/examples/allnoconfig_walk.py index 8e22cd9..b94a169 100644 --- a/examples/allnoconfig_walk.py +++ b/examples/allnoconfig_walk.py @@ -40,7 +40,7 @@ def do_allnoconfig(node): kconf = Kconfig(sys.argv[1]) # Do an initial pass to set 'option allnoconfig_y' symbols to y -for sym in kconf.defined_syms: +for sym in kconf.unique_defined_syms: if sym.is_allnoconfig_y: sym.set_value(2) diff --git a/examples/defconfig_oldconfig.py b/examples/defconfig_oldconfig.py index 84aa134..3735ee1 100644 --- a/examples/defconfig_oldconfig.py +++ b/examples/defconfig_oldconfig.py @@ -29,7 +29,7 @@ kconf.write_config(".config") # Mirrors the second oldconfig kconf.load_config(".config") kconf.syms["ETHERNET"].set_value(2) -for s in kconf.defined_syms: +for s in kconf.unique_defined_syms: if s.user_value is None and 0 in s.assignable: s.set_value(0) -- cgit v1.2.3