summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-11-01Emulate 'range' internals closerUlf Magnusson
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).
2017-11-01Clean up printing code a bitUlf Magnusson
2017-11-01Documentation nitsUlf Magnusson
2017-11-01Switch to a much faster invalidation algorithmUlf Magnusson
_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...
2017-10-31Require manual mode setting for choicesUlf Magnusson
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...
2017-10-31Handle choices more like the C implementationUlf Magnusson
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.
2017-10-30Rename _TYPENAME to TYPE_TO_STRUlf Magnusson
Make it public. Piggyback some unrelated comment stuff due to git fails.
2017-10-30Add missing docstringsUlf Magnusson
Also make the format in the code a bit more consistent.
2017-10-30Documentation fixesUlf Magnusson
Add some more details to the intro and various docstrings.
2017-10-30Docstring and comment fixesUlf Magnusson
2017-10-30Explain how to get the integer value for int/hexUlf Magnusson
2017-10-30Merge user_str/tri_value into user_valueUlf Magnusson
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.
2017-10-30Comment nitUlf Magnusson
2017-10-30Get some basic MenuNode.__str__() test coverageUlf Magnusson
2017-10-30Have printing a menu node print the itemUlf Magnusson
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.
2017-10-30Move __str__() after __repr__()Ulf Magnusson
2017-10-30Doc nitsUlf Magnusson
2017-10-30Rename Symbol/Choice/MenuNode.config to kconfigUlf Magnusson
To be consistent with the renamed class. Piggyback docstring fixes.
2017-10-30Fix outdated set_value() documentationUlf Magnusson
Not worthwhile to confuse the API by allowing strings for bool/tristate. Things works out nicely anyway with the other updated APIs.
2017-10-30Consistently use 0/1/2 for tristate valuesUlf Magnusson
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.
2017-10-28Add uncommitted test filesUlf Magnusson
2017-10-28Test suite work, cleanup, const sym invalidation fixUlf Magnusson
2017-10-28Nearly finalize APIUlf Magnusson
Probably just some usability tweaks left. Having to do STR_TO_TRI[] for comparisons against 'assignable' values is kinda ugly and confusing.
2017-10-27Mention kconfiglib-2-backup branchUlf Magnusson
2017-10-27BackupUlf Magnusson
2017-10-27BackupUlf Magnusson
2017-10-25BackupUlf Magnusson
2017-10-25BackupUlf Magnusson
2017-10-24Kconfiglib 2 backupUlf Magnusson
WIP
2017-10-22Notify about upcoming releaseUlf Magnusson
2017-10-02Clean up _expand_sym_refs() a bitUlf Magnusson
Get the symbol name without the '$' straight from the regex.
2017-10-02Explain common 'source' gotcha in warningUlf Magnusson
$FOO in 'source "$FOO"' refers to a Kconfig symbol rather than an environment variable. Seems there might be some tools derived from the kernel Kconfig implementation that work differently here.
2017-10-02Test suite style nitsUlf Magnusson
2017-10-02Remove empty Comment.__init__()Ulf Magnusson
Didn't even notice that it had become empty...
2017-10-02Rename _dep to _direct_dependentsUlf Magnusson
Clearer.
2017-10-02_type_and_val() nitUlf Magnusson
2017-10-02Mention that pypy speeds up the test suiteUlf Magnusson
2017-10-02line_profile a bit moreUlf Magnusson
Add some micro-optimizations that speed up allyesconfig.py by 10-20% with CPython. Clean up some minor stuff too.
2017-10-02Make 1.0.6 releasev1.0.6Ulf Magnusson
Fixes an imply-related issue: 1774239 (Make 'imply' consider direct dependencies). Imply support should be solid now.
2017-10-02Make 'imply' consider direct dependenciesUlf Magnusson
Bad oversight. Weak reverse dependencies (from imply) are not considered if the direct dependencies of a symbol are not met (the 'if'/'depends on' dependencies from the symbol and its parents, taking location into account if the symbol is defined in multiple places). Caused a wrong value for the symbol FS_FAT in the U-Boot Kconfigs, where 'imply' is more heavily used compared to the kernel. Add a new variable _direct_deps that corresponds to dir_dep from the C implementation. Before 'imply', dir_dep was only used for a 'select'-related warning in the C implementation. Add a bunch of tests to cover 'imply' semantics. Should be solid now.
2017-10-01Mention ranges too in commentUlf Magnusson
Also be a bit more consistent in how property variables are ordered.
2017-10-01Make 1.0.5 releasev1.0.5Ulf Magnusson
The only fix is 2a2fcbd (Propagate dependencies to range conditions), which fixes an obscure issue with dependencies on 'range x y' properties. Also includes some internal cleanup and optimization.
2017-10-01Propagate dependencies to range conditionsUlf Magnusson
Just like for other properties, conditions on ranges get local 'depends on' and parent dependencies propagated to them. Oversight. Did not trigger any deviations for the kernel defconfigs. Pretty specific circumstances were required for breakage, like a symbol depending on the particular value of a symbol with a 'range' and parent deps 'n', or a symbol with ranges being defined in multiple locations with different parent deps. (There is one symbol that both has ranges and is defined in multiple locations: BCH_CONST_M. The second definition adds a default rather than a range though.)
2017-10-01Micro-optimize _tokenize() some moreUlf Magnusson
Slightly modifying _STRING_LEX allows the (common) symbol reference case to be detected earlier and removes some assignments. Also modify some comments and air things out a bit.
2017-09-30Get rid of _referenced_symsUlf Magnusson
Calculate as needed instead, using _get_expr_syms(). Simplifies the parsing code. Also rename _get_expr_syms*() to _expr_syms*() and make it append to a list. Handy for the new way it's being used.
2017-09-30Get rid of _selected_syms and _implied_symsUlf Magnusson
Calculate as needed instead. Old cruft.
2017-09-30Get rid of _all_referenced_symsUlf Magnusson
Calculate it as needed instead. It's not used internally. Also move get_referenced_symbols() to the Item base class, as the logic is identical for symbols/choices/menus/comments. Finally a non-silly use for it.
2017-09-30Clean up dependency handlingUlf Magnusson
- Menu/Comment._dep_expr and Symbol/Choice._menu_dep are really the same thing internally in the C implementation (the dependency for the "menu node", which is also used to implicitly create menus), and it simplifies the code to treat them like that here too. - Reuse the calculated _menu_dep (which has parent and 'depends on' dependencies) when propagating dependencies to properties. - Get rid of the temporary lists. It's now easy to use plain 'for' loops to add the properties. - Catch attempts to use select/imply from menus and choices early and error out. - Add comments clarifying which variables are only used when displaying items.
2017-09-29Move _is_header_line to a better spotUlf Magnusson
There's already a "misc." section. Also fix typo in docstring.
2017-09-29Make 1.0.4 releasev1.0.4Ulf Magnusson
Fixes: - After 250b370 (Refactor load_config() and fix minor issues), print_undef_assign=True also considers "# CONFIG_NOT_DEFINED is not set", which acts like an "n" assignment in practice. - 7cbfa47 (Fix undef. assign warning in set_user_value()) Also contains some internal cleanup and optimization.