summaryrefslogtreecommitdiff
path: root/examples/allnoconfig_simpler.py
blob: 81e701c4eafae4c98d78dce86a30c89e430055e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# This is a simpler version of allnoconfig.py, corresponding to how the C
# implementation does it. Verified by the test suite to produce identical
# output to 'make allnoconfig' for all ARCHes.
#
# Usage:
#
#   $ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/examples/allnoconfig_simpler.py

from kconfiglib import Kconfig, BOOL, TRISTATE
import sys

conf = Kconfig(sys.argv[1])

# Avoid warnings printed by Kconfiglib when assigning a value to a symbol that
# has no prompt. Such assignments never have an effect.
conf.disable_warnings()

for sym in conf.defined_syms:
    if sym.type in (BOOL, TRISTATE):
        sym.set_value(2 if sym.is_allnoconfig_y else 0)

conf.write_config(".config")