| Age | Commit message (Collapse) | Author |
|
Leftovers
|
|
No need to use a dictionary.
|
|
Preferred method, should 'option modules' be properly supported later.
|
|
Clean up some formatting a bit too.
|
|
Pointless as an optimization here. Should restrict obfuscating
micro-optimization to the library code too even where it helps.
|
|
Confirms that all the examples that aren't tested in the test suite at
least run. Easy to miss brokenness there. Output can be inspected
manually (it'll vary depending on the kernel version).
Fix defconfig_oldconfig.py, which hadn't been properly updated for the
new API.
|
|
|
|
Turns out to be kinda awkward to implement print_tree.py iteratively,
because the indent.
|
|
conf -> kconf, for consistency, plus various nits.
|
|
Can be implemented in a simpler/better way with Choice.assignable.
Also rename 'conf' to 'kconf' in allnoconfig.py for consistency.
|
|
|
|
Don't need to handle them at all now that .assignable doesn't claim that
choice symbols in y-mode choices can be set to n. 20/20 hindsight.
|
|
Argument must be "X86" to get that output. "x86" just returns some
constant symbols.
|
|
Demonstrates expression fetching and walking. Basically a much better
version of get_ref_locations() from Kconfiglib 1, now that the user API
is flexible enough to implement it.
Should be it for new examples before release.
|
|
|
|
Handy for running menuconfig.py
|
|
|
|
Also avoid printing (None) as the name for unnamed (normal) choices.
|
|
Still needs documentation and some cleanup.
Interface deliberately kept super simple/clunky to focus on the
concepts. Not something you'd actually want to use.
Sample session:
$ python Kconfiglib/examples/menuconfig.py Kconfiglib/examples/Kmenuconfig
======== Example Kconfig configuration ========
[*] Enable loadable module support (MODULES)
Bool and tristate symbols
[*] Bool symbol (BOOL)
[ ] Dependent bool symbol (BOOL_DEP)
< > Dependent tristate symbol (TRI_DEP)
[ ] First prompt (TWO_MENU_NODES)
< > Tristate symbol (TRI)
[ ] Second prompt (TWO_MENU_NODES)
*** These are selected by TRI_DEP ***
< > Tristate selected by TRI_DEP (SELECTED_BY_TRI_DEP)
< > Tristate implied by TRI_DEP (IMPLIED_BY_TRI_DEP)
String, int, and hex symbols
(foo) String symbol (STRING)
(747) Int symbol (INT)
(0xABC) Hex symbol (HEX)
Various choices
-*- Bool choice (BOOL_CHOICE)
--> Bool choice sym 1 (BOOL_CHOICE_SYM_1)
Bool choice sym 2 (BOOL_CHOICE_SYM_2)
{M} Tristate choice (TRI_CHOICE)
< > Tristate choice sym 1 (TRI_CHOICE_SYM_1)
< > Tristate choice sym 2 (TRI_CHOICE_SYM_2)
[ ] Optional bool choice (OPT_BOOL_CHOICE)
Enter a symbol/choice name, "load_config", or "write_config" (or press CTRL+D to exit): BOOL
Value for BOOL (available: n, y): n
======== Example Kconfig configuration ========
[*] Enable loadable module support (MODULES)
Bool and tristate symbols
[ ] Bool symbol (BOOL)
< > Tristate symbol (TRI)
[ ] Second prompt (TWO_MENU_NODES)
*** These are selected by TRI_DEP ***
< > Tristate selected by TRI_DEP (SELECTED_BY_TRI_DEP)
< > Tristate implied by TRI_DEP (IMPLIED_BY_TRI_DEP)
String, int, and hex symbols
(foo) String symbol (STRING)
(747) Int symbol (INT)
(0xABC) Hex symbol (HEX)
Various choices
-*- Bool choice (BOOL_CHOICE)
--> Bool choice sym 1 (BOOL_CHOICE_SYM_1)
Bool choice sym 2 (BOOL_CHOICE_SYM_2)
{M} Tristate choice (TRI_CHOICE)
< > Tristate choice sym 1 (TRI_CHOICE_SYM_1)
< > Tristate choice sym 2 (TRI_CHOICE_SYM_2)
[ ] Optional bool choice (OPT_BOOL_CHOICE)
Enter a symbol/choice name, "load_config", or "write_config" (or press CTRL+D to exit): MODULES
Value for MODULES (available: n, y): n
======== Example Kconfig configuration ========
[ ] Enable loadable module support (MODULES)
Bool and tristate symbols
[ ] Bool symbol (BOOL)
[ ] Tristate symbol (TRI)
[ ] Second prompt (TWO_MENU_NODES)
*** These are selected by TRI_DEP ***
[ ] Tristate selected by TRI_DEP (SELECTED_BY_TRI_DEP)
[ ] Tristate implied by TRI_DEP (IMPLIED_BY_TRI_DEP)
String, int, and hex symbols
(foo) String symbol (STRING)
(747) Int symbol (INT)
(0xABC) Hex symbol (HEX)
Various choices
-*- Bool choice (BOOL_CHOICE)
--> Bool choice sym 1 (BOOL_CHOICE_SYM_1)
Bool choice sym 2 (BOOL_CHOICE_SYM_2)
-*- Tristate choice (TRI_CHOICE)
--> Tristate choice sym 1 (TRI_CHOICE_SYM_1)
Tristate choice sym 2 (TRI_CHOICE_SYM_2)
[ ] Optional bool choice (OPT_BOOL_CHOICE)
Enter a symbol/choice name, "load_config", or "write_config" (or press CTRL+D to exit): ^D
Unsetting modules demonstrates one reason why it makes sense to have
.type be magic and change from TRISTATE to BOOL without modules
(<> = tristate, [] = bool). The C implementation uses the same trick.
(The original type is still available in .orig_type though.)
Piggyback printing of tristates as n, m, y in the warning for invalid
values in set_value().
|
|
_cached_vis is always calculated as a side effect of calculating any
other cached value, and so doubles as a flag for whether an item (symbol
or choice) has any cached values.
If _cached_vis is None for some item, it also indirectly means that no
other item can have any cached values that (actually) depend on the
item, because _cached_vis would have gotten calculated as a side effect
of calculating any such cached value. Therefore, it's safe to stop
recursive invalidation at an item that has _cached_vis None.
Huge speedup for the allyes/noconfig*.py scripts. allnoconfig_simpler.py
went from 2.671 seconds to 1.067 seconds.
The dependency selftests need to be updated too now that
_get_dependent() is gone. The kernel defconfig tests pass even if all
global invalidation is disabled at least (except for the few defconfigs
that don't set MODULES=y), and that's a huge invalidation test. Seems
pretty speedy too, even though there's some redundant work, so maybe
things could be simplified a bit...
|
|
Choice symbols get the choice itself propagated to the conditions of
their properties. This works since the Symbol/Choice value interfaces
are compatible now.
Simplifies value calculations and makes .assignable work automagically
for choice symbols in choices in any mode. One drawback is that a '&&
<choice>' now shows up on conditions when printing choice symbols, which
is not valid Kconfig. That should be easy to work around if needed at
least.
|
|
user_str_value isn't justified any more with the other API improvements.
user_value now stores 0, 1, 2 for bool/tristate symbols, and a string
for other symbol types. Much simpler and more intuitive.
Also avoid printing quotes around tristate values in __repr__(). This
was inconsistent too as it was only done for the value and user value.
Should be getting close to final API.
|
|
Easier to work with, allowing e.g. direct comparisons with < and >. Make
set_value() take 0, 1, 2 for bool and tristate symbols, and fix other
APIs to match.
Also:
- Add introductions to various concepts in the module docstring.
Document some more attributes. Still TODOs.
- Rename the Config class to Kconfig.
- Escape " and \ in the name of constant symbols when printing them.
Also make the (un)escaping 100% consistent with how the C tools do
it (\ before non-magic character should be unescaped too).
- Clean up the escaping/unescaping code and provide two public
escape()/unescape() functions.
- Export the original MODULES-independent type in orig_type. It's
needed for printing symbols in the reparsable __str__() Kconfig
format with just public APIs.
- Lots of other minor reorganizing and nits all over.
|
|
Probably just some usability tweaks left. Having to do STR_TO_TRI[] for
comparisons against 'assignable' values is kinda ugly and confusing.
|
|
|
|
WIP
|
|
print -> print().
Skip 'from __future__ import print_function' by only having a single
argument (to avoid interpretation as tuples in Python 2). Keeps the
examples simple.
|
|
From https://github.com/ulfalizer/Kconfiglib/issues/15. Getting the
output to match up exactly requires emulating each step, due to Kconfig
subtleties related to which symbols have been assigned values by the
user. The output might differ with other approaches, but this is not a
bug.
|
|
Settings the user value to 'y' does not guarantee that the (actual)
value will become 'y', as the symbol's visibility still acts as an upper
bound on the value.
|
|
This is required for the 'make allnoconfig' tests.
|
|
|
|
Disable warnings in allnoconfig_simpler.py instead.
|
|
|
|
|
|
Also update some comments to reflect optimizations.
|
|
|
|
|
|
|