| Age | Commit message (Collapse) | Author |
|
The invalidation is necessary now that no global invalidation is done
before loading a .config.
|
|
Shaves a few % in line_profiler with no loss in readability.
Menus and comments are rare relatively speaking (~10% of all items
written out for alldefconfig), so optimize for the symbol case.
|
|
Bit less redundant.
|
|
Not needed anymore.
Just write the .config lines out directly. Saves creating the temporary
list. No detectable performance difference, positive or negative.
|
|
|
|
Avoiding global invalidation is much faster. There was just a lot of
redundant invalidation for promptless symbols going on when the comment
was first written.
|
|
Clean up some formatting a bit too.
|
|
Can use the magic .type attribute to check for modules being disabled.
Also remove note about infinite recursion. Pretty sure anything that
would cause infinite recursion here would be a proper circular
dependency (like MODULES depending on m).
|
|
Warnings for assignments to promptless symbols should be enabled
directly after Kconfig parsing. Braino from inverting the meaning of the
flag earlier.
The flag got properly reset after loading a .config.
|
|
Versions of properties without parent dependencies propagated aren't
saved anymore (though it'd be easy to add back if needed).
|
|
|
|
Add test coverage for that Choice.__repr__() path too.
|
|
|
|
Hit way too seldomly for it to make a performance difference, but a bit
neater. We know n, m, and y already exist since they're precreated.
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
- 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.
|
|
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.
|
|
Could never return 0 as a valid assignable value previously.
|
|
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 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.
|
|
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.
|
|
Dug into the C implementation to check exactly what's going on in those
weird corner cases. Improves compatibility slightly for defaults with
invalid values (though those are pretty clearly a bug and generate a
warning anyway).
|
|
|
|
|
|
_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...
|
|
Do not change the mode if y is assigned to a choice symbol inside a
choice in m mode, for example. Require Choice.set_value() to be called
instead.
This makes choices way less magical and more menuconfig-like. It would
also be confusing to be able to assign y to a choice symbol when y is
not in sym.assignable.
Set the mode manually in load_config() (y assigned to a choice symbol =>
y mode, and ditto for m). Change the warning for inconsistent values to
one that's probably less confusing, though the old one was closer to the
warning printed by the C implementation.
Need to fix a bunch of tests too...
|
|
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.
|
|
Make it public.
Piggyback some unrelated comment stuff due to git fails.
|
|
Also make the format in the code a bit more consistent.
|
|
Add some more details to the intro and various docstrings.
|
|
|
|
|
|
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.
|
|
|
|
Handy and intuitive. Avoids having to go to .item all the time when
experimenting, and provides Kconfig output for menus and comments.
>>> print c.top_node
menu "Linux/$ARCH $KERNELVERSION Kernel Configuration"
>>> print c.top_node.list
config SRCARCH
string
option env="SRCARCH"
default "x86"
>>> print c.top_node.list.next
config 64BIT
bool
prompt "64-bit kernel" if ARCH = "x86"
default ARCH != "i386"
help
Say yes to build a 64-bit kernel - formerly known as x86_64
Say no to build a 32-bit kernel - formerly known as i386
Piggyback escaping when printing the prompt of symbols and choices. They
can contain " and \ as well.
|
|
|
|
|
|
To be consistent with the renamed class.
Piggyback docstring fixes.
|