diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-22 02:25:20 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-22 20:05:11 +0200 |
| commit | d2c1430c91c574dc0dfd84f3652c8d9af8c77568 (patch) | |
| tree | 11c0d1a6a9ef28d538bcd963e80ee47395db6c5f /allmodconfig.py | |
| parent | a3252f620fad970bbe8b7470401a04ee4225193e (diff) | |
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.
Diffstat (limited to 'allmodconfig.py')
| -rwxr-xr-x | allmodconfig.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/allmodconfig.py b/allmodconfig.py index a7804b3..92a00e1 100755 --- a/allmodconfig.py +++ b/allmodconfig.py @@ -25,9 +25,7 @@ def main(): BOOL = kconfiglib.BOOL TRISTATE = kconfiglib.TRISTATE - # 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: if sym.orig_type == BOOL: # 'bool' choice symbols get their default value, as determined by # e.g. 'default's on the choice @@ -37,7 +35,7 @@ def main(): elif sym.orig_type == TRISTATE: sym.set_value(1) - for choice in kconf.choices: + for choice in kconf.unique_choices: choice.set_value(2 if choice.orig_type == BOOL else 1) kconf.write_config(kconfiglib.standard_config_filename()) |
