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. --- allyesconfig.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'allyesconfig.py') diff --git a/allyesconfig.py b/allyesconfig.py index 5fe8b46..d9b799e 100755 --- a/allyesconfig.py +++ b/allyesconfig.py @@ -44,10 +44,7 @@ def main(): # # Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex # symbols still take a string, because they preserve formatting). - # - # The set() speeds things up for projects that use multiple definition - # locations a lot - for sym in set(kconf.defined_syms): + for sym in kconf.unique_defined_syms: # Set choice symbols to 'm'. This value will be ignored for choices in # 'y' mode (the "normal" mode), which will instead just get their # default selection, but will set all symbols in m-mode choices to 'm', @@ -55,7 +52,7 @@ def main(): sym.set_value(1 if sym.choice else 2) # Set all choices to the highest possible mode - for choice in kconf.choices: + for choice in kconf.unique_choices: choice.set_value(2) kconf.write_config(kconfiglib.standard_config_filename()) -- cgit v1.2.3