summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-11-06Get rid of Choice.default_selectionUlf Magnusson
Was only used by allyesconfig.py. Easy to add back if needed at any point.
2017-11-06Polish some Symbol and Choice docsUlf Magnusson
2017-11-06Polish the module documentationUlf Magnusson
Doing a (hopefully) final pass through the docs before release.
2017-11-06Refer to kconfiglib.py for iterative tree walkingUlf Magnusson
Turns out to be kinda awkward to implement print_tree.py iteratively, because the indent.
2017-11-06Rename _RELATION_TO_STR to _REL_TO_STRUlf Magnusson
Consistent with e.g. _TOKEN_TO_REL.
2017-11-06Use 'sym' instead of 'item' in choice-related loopUlf Magnusson
Only symbols appear in choice.syms. Clearer.
2017-11-06Remove redundant n/m/y._cached_str_val assignmentsUlf Magnusson
Will be automatically calculated and cached as needed. Less magic code.
2017-11-06Remove redundant 'is not None' testUlf Magnusson
Always a MenuNode or None. Can be tested simpler.
2017-11-06Rename variable from 'add_fn' to 'append'Ulf Magnusson
2017-11-06Call it 'kconf' in iscriptconfig tooUlf Magnusson
Consistency
2017-11-06Clean up examples a bitUlf Magnusson
conf -> kconf, for consistency, plus various nits.
2017-11-06Simplify allyesconfig.pyUlf Magnusson
Can be implemented in a simpler/better way with Choice.assignable. Also rename 'conf' to 'kconf' in allnoconfig.py for consistency.
2017-11-05Add invalidation warning to Choice.selectionUlf Magnusson
Now in all paths that cache values.
2017-11-05Simplify redundant 'is (not) None' testsUlf Magnusson
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.
2017-11-05Simplify redundant 'is (not) None' tests in examplesUlf Magnusson
2017-11-05Simplify allnoconfig.py choice handlingUlf Magnusson
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.
2017-11-05Fix find_symbol.py typoUlf Magnusson
Argument must be "X86" to get that output. "x86" just returns some constant symbols.
2017-11-05Add example that finds references to a symbolUlf Magnusson
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.
2017-11-05Get rid of some more tristate quotesUlf Magnusson
2017-11-04Add symbolic ../kconfiglib.py link to examples/Ulf Magnusson
Handy for running menuconfig.py
2017-11-04Fix some menuconfig.py typosUlf Magnusson
2017-11-04Add documentation for menuconfig exampleUlf Magnusson
Also avoid printing (None) as the name for unnamed (normal) choices.
2017-11-04Optimize tri_value() a bitUlf Magnusson
- 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.
2017-11-04Fix test suite Python 3 syntax errorUlf Magnusson
"List comprehensions no longer support the...", https://docs.python.org/3.0/whatsnew/3.0.html
2017-11-04Add menuconfig example/proof of conceptUlf Magnusson
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().
2017-11-04Don't put 0 in .assignable for y-mode choice symsUlf Magnusson
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.
2017-11-04Return False from set_value() for invalid valuesUlf Magnusson
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.
2017-11-03Fix error in commentUlf Magnusson
s/absolute/relative/
2017-11-03Remove outdated commentUlf Magnusson
Used to set a bunch of other options too on MODULES in the test, but it's cleaner to do it separately.
2017-11-03Remove outdated TODO commentUlf Magnusson
Tests for .assignable have been added.
2017-11-03Test .assignable with no modulesUlf Magnusson
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.
2017-11-03Add comment to choice .assignable test tooUlf Magnusson
2017-11-03Test Choice.assignable, fix for optional choicesUlf Magnusson
Could never return 0 as a valid assignable value previously.
2017-11-03Add .assignable selftests for choice symbolsUlf Magnusson
2017-11-03Fix copy-paste comment errorUlf Magnusson
2017-11-03Test .assignable for imply, find C menuconfig bugUlf Magnusson
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
2017-11-03Add initial selftests for .assignableUlf Magnusson
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.
2017-11-03Test suite nitsUlf Magnusson
2017-11-02Clean up choice semantics testsUlf Magnusson
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.
2017-11-02Get rid of some old API compatibility hacksUlf Magnusson
Scaffolding to make the test suite work with the new API. No longer needed. get_choices() will be gone soon too.
2017-11-02Clean up .kconfig testsUlf Magnusson
Kinda silly to test if they're separate since a long time, but can do that easily too with some reorganization.
2017-11-02Clean up relation testUlf Magnusson
Think those variables got used in other places before... Fetch the choices by name. Also dedotdotdot all messages for consistency.
2017-11-02Get rid of separate is_optional testUlf Magnusson
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.
2017-11-02Update choice tests, get rid of some old testsUlf Magnusson
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.
2017-11-02Fix relation tests, remove some outdated testsUlf Magnusson
Menus are plain menu nodes now, and those are exercised elsewhere.
2017-11-02Always save user values if they're validUlf Magnusson
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.
2017-11-02Don't set promptless symbols when loading .configUlf Magnusson
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.
2017-11-02Specify $(Kconfig) without $(srctree)Ulf Magnusson
Kconfiglib already respects $srctree internally.
2017-11-02Update makefile patchUlf Magnusson
Looks like I already accidentally committed a partial update though... Now prints ARCH again.
2017-11-02Do not invalidate everything when loading .configsUlf Magnusson
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.