| Age | Commit message (Collapse) | Author |
|
Was only used by allyesconfig.py. Easy to add back if needed at any
point.
|
|
|
|
Doing a (hopefully) final pass through the docs before release.
|
|
Turns out to be kinda awkward to implement print_tree.py iteratively,
because the indent.
|
|
Consistent with e.g. _TOKEN_TO_REL.
|
|
Only symbols appear in choice.syms. Clearer.
|
|
Will be automatically calculated and cached as needed. Less magic code.
|
|
Always a MenuNode or None. Can be tested simpler.
|
|
|
|
Consistency
|
|
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.
|
|
Now in all paths that cache values.
|
|
Menu node pointers and .choice in particular is always either an object
or None. Prompts are always either a (text, cond) tuple or None. Some
other things could (though unlikely) be empty strings, and some things
use symbolic constants that might be 0, so keep the None tests there.
Cleaner, especially for menu nodes.
Also remove redundant 'node2.dep is None' test. Expressions are never
None.
Also fix node.prompt == "" comparison in _flatten(). Should be
node.prompt[0] == "". Not sure why the C implementation checks for an
existing but empty prompt to begin with. It's just cosmetic menu stuff
at least.
|
|
|
|
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.
|
|
- Detect a 0 weak reverse dependency earlier. Being implied is
rare, and the direct deps don't need to be calculated for symbols
that aren't.
Bit cleaner too, and closer to the rev. dep code.
Shaves a few % off the time spent in tri_value() while writing a
.config.
- Look at the symbol's visibility to determine the choice mode instead
of going to the choice itself. Works since the mode acts as an upper
bound on the visibility of choice symbols. No detectable performance
difference, but a bit cleaner anyway.
Piggyback some nits.
|
|
"List comprehensions no longer support the...",
https://docs.python.org/3.0/whatsnew/3.0.html
|
|
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().
|
|
Just return (2,). More intuitive, and makes y-mode choices just work in
the menuconfig example.
Turns out to be simple to implement with choice symbol visibility
depending on the Choice.
|
|
Usability improvement discovered while putting together menuconfig
example. Would have to duplicate validity checking otherwise.
Also reject negative values for HEX symbols, just to be compatible with
the C implementation.
Keep TRI_TO_STR and STR_TO_TRI public. They're pretty handy even if
they're trivial.
|
|
s/absolute/relative/
|
|
Used to set a bunch of other options too on MODULES in the test, but
it's cleaner to do it separately.
|
|
Tests for .assignable have been added.
|
|
Just add a column for the expected values for the no-modules case to the
existing tests.
Also automatically detect choice symbols in choices with y mode and
disable the value setting test, instead of having to pass a flag.
|
|
|
|
Could never return 0 as a valid assignable value previously.
|
|
|
|
|
|
A tristate implied to y can't be set to m. Other than that, imply
doesn't affect assignable values.
Fix some copy-paste type errors too.
In the C menuconfig, a tristate with m visibility implied to y gets
stuck if you change it with space. Look into that later. Test case:
config MODULES
def_bool y
option modules
config Y_IMPLIER
def_tristate y
imply Y_IMP_M_VIS_TRI
config Y_IMP_M_VIS_TRI
tristate "y-imp m-vis tri" if m
|
|
Comprehensive selftests are important here, because the
allno/yesconfig.py scripts only check the upper and lower bound, and
allnoconfig disables modules.
Found a bug for non-selected m-visible tristates, where n didn't show up
in sym.assignable. Everything matches menuconfig after fixing that.
Still need to test symbols in choices with different modes, imply, and
.assignable for choices.
|
|
|
|
Can finally get rid of get_choices() and get_items() now.
Piggyback some more Kwtf tests, and remove some outdated comments.
There's already plenty of select/imply testing.
|
|
Scaffolding to make the test suite work with the new API. No longer
needed. get_choices() will be gone soon too.
|
|
Kinda silly to test if they're separate since a long time, but can do
that easily too with some reorganization.
|
|
Think those variables got used in other places before...
Fetch the choices by name.
Also dedotdotdot all messages for consistency.
|
|
The choice semantics tests already verify the behavior of optional
choices. Just print an optional choice instead to get some coverage for
querying it.
Do minor cleanup elsewhere.
|
|
Need to manually set the mode of the choice now.
Dependencies get a huge workout just from lack of global invalidation,
so the manual dependency tests might be redundant. Would be tricky to
reuse the old tests as is too, so they would need to be restructured at
least.
|
|
Menus are plain menu nodes now, and those are exercised elsewhere.
|
|
Can just skip the invalidation for promptless symbols. Makes things less
magic and more intuitive while still being fast. Means no docs need to
be rewritten too.
Now the warning gets printed for unset_value() as well.
|
|
Return braino. Harmless but inconsistent (since the user value wasn't
set for promptless symbols when manually calling set_value()). Also
caused a lot of redundant invalidation.
Cuts test_defconfig() down to 2m32s from 3m00s with CPython, so skipping
global invalidation definitely pays off now.
Downside is you lose information on what value the .config had for the
symbol. Not sure if anyone would ever need that information (and it
should be simple to add if needed). It would usually match the actual
value of the symbol.
|
|
Kconfiglib already respects $srctree internally.
|
|
Looks like I already accidentally committed a partial update though...
Now prints ARCH again.
|
|
In replace mode, only unset symbols that didn't get set.
Get rid of _set_value_no_invalidate() and just do a normal set_value()
with invalidation. It's speedy with the new invalidation algorithm, and
simpler.
Not a big performance boost (but a small one), but means that
invalidation must be even more rock solid for the test suite to pass (no
global invalidations to hide behind), which is nice.
Also make y assignments to choice symbol update just the choice user
value. Gives nicer behavior when the choice mode is changed.
|