diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-08 08:02:19 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-08 08:03:09 +0100 |
| commit | 38339c48ec888fed1a9838dff070a79ec00a37c7 (patch) | |
| tree | 3b2e5042574688c2b0d9ec32477a5d4898a21da5 /examples | |
| parent | 88fc64fbebd2d8344cb8af486e4dc732ed2542df (diff) | |
Add a simpler allnoconfig example.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/allnoconfig_simpler.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/allnoconfig_simpler.py b/examples/allnoconfig_simpler.py new file mode 100644 index 0000000..b80e79a --- /dev/null +++ b/examples/allnoconfig_simpler.py @@ -0,0 +1,23 @@ +# This is a simpler version of allnoconfig.py, corresponding to how the C +# implementation does it. Setting a user value that's not in the assignable +# range of the symbol (between get_lower_bound() and get_upper_bound(), or, +# equivalently, not in get_assignable_values()) is OK; the value will simply +# get truncated downwards or upwards as determined by the visibility and +# selects. + +# Note: This version will be very slow since Kconfiglib invalidates all +# dependent symbols for each set_value() call. This does not happen for +# load_config(), which instead invalidates all symbols once after the +# configuration has been loaded. This is OK for load_config() since nearly all +# symbols will tend to be affected anyway. + +import kconfiglib +import sys + +conf = kconfiglib.Config(sys.argv[1]) + +for sym in conf: + if sym.get_type() in (kconfiglib.BOOL, kconfiglib.TRISTATE): + sym.set_value("n") + +conf.write_config(".config") |
