summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-08-29menuconfig: Always show implicit submenus with visible nodesUlf Magnusson
Currently, the symbol BAR below (which ends up indented in an implicit submenu) is shown only if DEP is non-n (or if show-all mode is enabled): config FOO bool "foo" if DEP default y config BAR bool "bar" if FOO This is bad, because it hides visible symbols from the interface. The assumption was that an implicit submenu (which is only created if the parent has a prompt) would never have visible items when the root item is invisible, but prompt-specific conditions and select/imply can break that assumption. Fix it by always showing implicit submenus with visible nodes, along with the parent node. If the parent node is invisible, show it in red, like in show-all mode (which happens automatically). That's probably better than having mysteriously indented nodes when the parent is invisible.
2018-08-29Improve the running-without-Makefile-patch documentationUlf Magnusson
- Include an updated list of environment variables, with sample values - Give a method for listing all referenced environment variables, via Kconfig.env_vars - Remove the note that says that Kconfiglib will warn if an unset environment variable is referenced. It's not true anymore with the preprocessor, which silently expands unset variables to the empty string. Not setting essential environment variables causes obvious errors at least.
2018-08-29menuconfig: Quote style consistency nitUlf Magnusson
2018-08-29menuconfig: Simplify default value info codeUlf Magnusson
Just checking whether the default value expression is a single symbol correctly handles the string/int/hex cases too, because that case will always hit for those. D'oh.
2018-08-29menuconfig: Add a _center_vertically() helperUlf Magnusson
Used in two spots.
2018-08-29menuconfig: Remove global() hack for stdscrUlf Magnusson
The global should be called _stdscr, and then the names don't clash. Leftover.
2018-08-29menuconfig: Mention that include paths are shownUlf Magnusson
Add info to module docstring.
2018-08-29_check_undef_syms() nitUlf Magnusson
Factor out the call to the iterator.
2018-08-29menuconfig: Add a more 'make menuconfig'-like color schemeUlf Magnusson
Add an alternative, less yellow, more 'make menuconfig'-like color scheme, contributed by Mitja Horvat (pinkfluid). The new theme is selected by setting the MENUCONFIG_THEME environment variable to 'aquatic'. Make it so that custom themes can override just the styles they want to change from the default theme. Perhaps some non-hardcoded theming mechanism could be added later, but keep it simple for now. Piggyback some related changes: - Make the selected item bold in the default theme, like the aquatic theme does. - Allow the style for the edit box in the jump-to dialog to be configured separately from the style for edit boxes in pop-up dialogs. That makes it possible to avoid some color clashes. - Remove a redundant style setting for the jump-to edit box. The window itself is already created with the correct style.
2018-08-26Make 10.3.0 releasev10.3.0Ulf Magnusson
New features: - Commit 20de53b ("Add a Kconfig.kconfig_filenames attribute") and commit 932d0f7 ("Add a Kconfig.env_vars attribute that lists env. variables") make lists of all Kconfig files and referenced environment variables available. This could be used e.g. to implement alternative incremental build schemes. Note that the sync_deps() mechanism already indirectly catches any relevant changes to files and environment variables though (anything that changes the configuration output). - Commit 17d7c1e ("menuconfig: Show all symbols at each menu location for multi.def. choices") makes it so that if a named choice is defined in multiple locations, each of which adds options, you can select any of the options regardless of via menu entry you enter the choice. Previously, you could only select the options defined at that menu entry's location. Named choices with symbols in more than one location are completely broken in the C tools, so there's no reference for the behavior there. This seems less confusing at least. Suggested by Mitja Horvat (pinkfluid). Fixes: - Commit 0b46af4 ("menuconfig: Don't return when selecting a choice symbol with children") improves menuconfig behavior in an extremely obscure case. - Commit 1c2c4ae ("oldconfig: Fix help display command for choices") makes '?' print the help for choices in oldconfig. The command was accidentally set to '??' there. - Commit ddfd5df ("Improve menu structure for promptless choices") fixes a menuconfig display issue for promptless choices (which can appear "legitimately" if a named choice is defined in multiple locations to add extra options). Cleanup: - Commit 2320b7a ("oldconfig: Use Kconfig.node_iter() and clean up") - Some manual tree walking in other places has also been rewritten to use Kconfig.node_iter().
2018-08-26Improve menu structure for promptless choicesUlf Magnusson
Promptless choices can appear "legitimately" if you define a named choice in multiple locations to add on some symbols (which is broken in the C tools though). Prior to this fix, the promptless choice would get flattened, with the choice symbols appearing in the same menu as the (invisible) choice. This looks confusing. Skip flattening promptless choices to fix it.
2018-08-26oldconfig: Use Kconfig.node_iter() and clean upUlf Magnusson
Some general cleanup: - Handle the iteration with the new Kconfig.node_iter() helper. This makes some function so short that they become pointless. Have just main() + oldconfig(node) + small helper functions. - Use _name_and_loc_str(sc) for choices too, so that all locations get reported for named choices defined in multiple locations - Rewrite the intro to be less wordy and remove the sample session (leftover from when oldconfig.py was in examples/, and not that exciting) - Print "Updated configuration written to..." instead of "Configuration saved to..." - Various other nits
2018-08-25Add a Kconfig.env_vars attribute that lists env. variablesUlf Magnusson
Kconfig.env_vars is a set() with the names of all environment variables referenced in the configuration. Can be used e.g. for custom incremental build implementations, though sync_deps() already indirectly catches any relevant changes to environment variables.
2018-08-25Add a Kconfig.kconfig_filenames attributeUlf Magnusson
Kconfig.kconfig_filenames is an ordered list of all Kconfig files included in the configuration, relative to $srctree. Can be used e.g. for custom incremental build implementations, though sync_deps() already indirectly catches any relevant changes to files. Piggyback some ' -> " quote style consistency cleanups.
2018-08-25Simplify _check_undefined_syms() with node_iter()Ulf Magnusson
Wasn't available when the original version was written. Also rename _check_undefined_syms() to _check_undef_syms(). That shortening is used elsewhere.
2018-08-25Clean up expr_str() a bitUlf Magnusson
- Test in the order AND, OR, NOT, like in other places. This matches the frequency too. - Use 'not isinstance(expr, tuple)', which is a bit faster than isinstance(expr, (Symbol, Choice)).
2018-08-25oldconfig: Fix help display command for choicesUlf Magnusson
'?' should display the help, like for symbols, not '??'. Oversight when the command was changed.
2018-08-25menuconfig: Don't return when selecting a choice symbol with childrenUlf Magnusson
If a symbol depends on a choice symbol that immediately precedes it, it's put into an implicit submenu and not considered a choice symbol. Don't immediately return to the parent menu when selecting such a symbol. It makes the children hard to spot. This is used (or was... not sure if it still is) in a single Kconfig file in the kernel. It's completely undocumented.
2018-08-25menuconfig: Show all symbols at each menu location for multi.def. choicesUlf Magnusson
For named choices defined in multiple locations, show the symbols from all locations, regardless of via which menu node the choice is entered. Named choices with symbols in more than one location are broken in the C tools, so there's no reference for the behavior here. This behavior probably makes more sense than just showing the choice symbols at the current location at least, which was the old behavior in Kconfiglib's menuconfig. Suggested by Mitja Horvat (pinkfluid).
2018-08-24Make 10.2.1 releasev10.2.1Ulf Magnusson
Fixes broken-looking menuconfig include path information for items in the top-level Kconfig file, via commit 64600b3 ("menuconfig: Hide the include path for top-level items").
2018-08-24menuconfig: Hide the include path for top-level itemsUlf Magnusson
Came out as "Included via " for items in the top-level Kconfig file, which looks broken.
2018-08-24Make 10.2.0 releasev10.2.0Ulf Magnusson
Adds commit 13884e9 ("Show include paths in menuconfig symbol information"), which adds a MenuNode.include_path attribute to Kconfiglib. MenuNode.include_path holds the Kconfig include path of the menu node, which shows how its Kconfig file got 'source'd, starting from the top-level Kconfig file. MenuNode.include_path is used to show include paths in the menuconfig symbol information. It will also be used in genrest.py in Zephyr, which generates an RST Kconfig reference.
2018-08-24Show include paths in menuconfig symbol informationUlf Magnusson
Add a MenuNode.include_path attribute that holds a tuple of (filename, linenr) tuples, giving the locations of the 'source' statements via which the node's Kconfig file was included, starting from the top-level Kconfig file. Use MenuNode.include_path to give the include path for symbols and other items in the help display in the menuconfig interface. This is useful for figuring out how Kconfig files are organized, and when reorganizing things.
2018-08-23Make 10.1.1 releasev10.1.1Ulf Magnusson
Includes two small bug fixes: - Commit 9b77511 ("Fix file descriptor leak for the top-level Kconfig file") - Commit d158fed ("Fix recursive 'source' error reporting")
2018-08-23Exclude User-mode Linux from testingUlf Magnusson
This "architecture" has an unorthodox Kconfig setup that would require a different testing setup.
2018-08-23Fix recursive 'source' error reportingUlf Magnusson
The recursive 'source' detection was still fine, but the error reporting had broken due a missed variable renaming. The test suite didn't catch it, because a different type of KconfigError was raised instead, due to a separate error in the test suite (need to include tests/Krecursive{1,2}, since paths are relative to $srctree). Fix the variable name and tighten up the tests to check that the KconfigError message is the one we except. Tighten up the dependency loop detection tests in the same way too.
2018-08-23Fix file descriptor leak for the top-level Kconfig fileUlf Magnusson
Needs to be close()d. The other Kconfig files are close()d in _leave_file(). Could drop the reference somehow too, but an explicit close() is best for PyPy, which doesn't do reference counting.
2018-08-23Make 10.1.0 releasev10.1.0Ulf Magnusson
New features: - Commit 7dae988 ("Add a generic node iterator") adds a Kconfig.node_iter() helper generator for iterating through all menu nodes in the menu tree, in definition order. Optionally, symbols defined in multiple locations are only generated once. This generator is now used internally by write_config() as well. Suggested by Mitja Horvat (pinkfluid). - Commit d2c1430 ("Introduce Kconfig.unique_defined_syms and Kconfig.unique_choices") adds versions of Kconfig.defined_syms/choices that only include symbols and choices defined in multiple locations once, while still preserving definition order. This is almost always what you want when iterating through (just) symbols and choices. It removes set() hackery (where it's easy to accidentally mess up the order) and the like. Fixes: - Commit 4ebc2aa ("Flag extra tokens after 'if'/'depends on'/'visible if' expressions") tightens up syntax checking so that extra trailing tokens after 'if', 'depends on', and 'visible if' expressions raise a syntax error, instead of being silently ignored. Oversight.
2018-08-23Flag extra tokens after 'if'/'depends on'/'visible if' expressionsUlf Magnusson
Extra trailing tokens after 'if <expr>', 'depends on <expr>', and 'visible if <expr>' now trigger syntax errors instead of being ignored. Oversight. This indirectly makes Kconfig.eval_expr() detect extra trailing tokens as well.
2018-08-22Add a generic node iteratorUlf Magnusson
Suggested by Mitja Horvat (pinkfluid) in https://github.com/ulfalizer/Kconfiglib/pull/50. Kconfig.node_iter() iterates through all menu nodes in the menu tree in Kconfig order. This saves scripts the trouble of implementing their own tree walking code. Have node_iter() take a 'unique_syms' flag that can be enabled to only include symbols defined in multiple locations once. This is often what you want when generating output (and is used by write_config()). Order is still preserved. Piggyback a fix to a syntax error test comment. Parsing has been tightened up now.
2018-08-22Introduce Kconfig.unique_defined_syms and Kconfig.unique_choicesUlf Magnusson
These are the same as Kconfig.defined_syms and Kconfig.choices, except duplicates are removed. Kconfig order is still preserved. This is almost always what you want when iterating through symbols and choices, as it potentially saves work, avoids generating duplicates when writing output, and still preserves Kconfig order for readability. The old attributes will be kept for backwards compatibility (maybe there's some rare cases where they could be useful too). They're created internally anyway.
2018-08-21Merge Symbol._checked and Symbol._writtenUlf Magnusson
These are never used at the same time, and Symbol._visited is a good name for both. Gets rid of an internal attribute.
2018-08-21Handle multiple definition locations in a nicer wayUlf Magnusson
Instead of precalculating a set() to get unique symbols, precalculate a list with any duplicates from multiple definition locations removed, and preserve the order of the symbols within it. This makes it possible to get rid of the Symbol._written shenanigans in functions that only need to iterate through unique symbols in sorted order, which is all of them except write_config() (because it needs to walk the entire menu tree).
2018-08-21Make auto.conf symbol order match .config symbol orderUlf Magnusson
Not likely that you'd need to inspect it, since it's more of an implementation detail of incremental builds, but it doesn't hurt.
2018-08-21Fix header/minimal configuration ordering testUlf Magnusson
Should test write_autoconf(), not write_config().
2018-08-21Make 10.0.1 releasev10.0.1Ulf Magnusson
Adds commit 7f3844f ("Make symbol order match between headers and .config files"), which fixes a bug introduced by commit 71872a8 ("Massively speed up U-Boot parsing"). The ordering of symbols in header files now matches the order in .config files again, which was always the intent. It makes things more readable, and is nice for version control too.
2018-08-21Make header symbol order match .config symbol order againUlf Magnusson
I accidentally broke this when I added the _defined_syms_set optimization. No semantic difference, but having the order match is more readable.
2018-08-21Refactor write_config() a bitUlf Magnusson
Since the 'top_node' menu node itself is skipped, we can start from there and move the tree walk to the beginning of the loop. For an empty configuration (top_node.list set to None) the tree walk immediately discovers that there are no more nodes and returns.
2018-08-18Grammar nitUlf Magnusson
2018-08-18Document that MenuNode.filename is relative to $srctreeUlf Magnusson
..or to the current directory of $srctree isn't set.
2018-08-18List new Kconfig.__init__() $srctree behavior among changes in READMEUlf Magnusson
2018-08-18Make 10.0.0 releasev10.0.0Ulf Magnusson
Adds commit 8a3999b ("Fix $srctree logic for the top-level Kconfig file"), which fixes an old braino: The top-level Kconfig file passed to Kconfig.__init__() wasn't looked up relative to $srctree, breaking out-of-tree operation for scripts unless ugly manual $srctree hacks were added. All Kconfig files are now consistently looked up relative to $srctree. This is a backwards-incompatible change (though with a simple fix), so the major version is bumped. A note is printed on errors that might be due to the changed behavior.
2018-08-18Look up the top-level Kconfig file relative to $srctreeUlf Magnusson
Due to an old design braino, the top-level Kconfig filename passed to Kconfig.__init__() wasn't looked up relative to $srctree, breaking out-of-tree usage for e.g. menuconfig. Fixing it required ugliness like srctree = os.environ.get("srctree", "") kconfiglib.Kconfig(os.path.join(srctree, "Kconfig")) Change the behavior of Kconfig.__init__() to look up the top-level Kconfig file relative to $srctree. This means that all Kconfig files (both the top-level file and any source'd files) now use $srctree, which makes the vast majority of scripts just work when running out-of-tree. Also remove the note re. loading a subset of Kconfig files. Saying that the top-level file and all source'd Kconfig files are looked up relative to $srctree should make the behavior clear enough. Print a note about the new behavior whenever the top-level Kconfig file can't be opened, as this change could be breaking for some scripts. This is a slight backwards-compatiblity break, so the major version will be bumped.
2018-08-18Make 9.4.2 releasev9.4.2Ulf Magnusson
This just reverts commit 8a3999f ("Fix $srctree logic for the top-level Kconfig file"), so that it can go in a major release instead. I realized it has enough breakage potential for existing scripts to warrant a major version bump.
2018-08-18Revert "Fix $srctree logic for the top-level Kconfig file"Ulf Magnusson
This reverts commit 8a3999bc708e8468ff79665e3cbdfccd603160e1. I realized that this should go in a major release at least, because it has the potential to break scripts that rely on the old behavior of ignoring $srctree for the filename passed to Kconfig.__init__(). A dummy release will bump the version to 9.4.2. Any future release with the change will be 10.0.0.
2018-08-17rsource documentation nitsUlf Magnusson
Fix some grammar nits, and add a motivation at the end (wanting to create self-contained Kconfig trees that can appear anywhere relative to the top-level Kconfig file).
2018-08-17Make 9.4.1 releasev9.4.1Ulf Magnusson
- Commit 8a3999b ("Fix $srctree logic for the top-level Kconfig file") fixes a major braino where the top-level Kconfig file passed to Kconfig.__init__() wasn't looked up relative to $srctree, breaking out-of-tree operation for e.g. menuconfig. All Kconfig files are now consistently looked up relative to $srctree. - Misc. internal code cleanup
2018-08-17Fix $srctree logic for the top-level Kconfig fileUlf Magnusson
Due to a major design braino, the top-level Kconfig file passed to Kconfig.__init__() wasn't looked up relative to $srctree, breaking out-of-tree usage for e.g. menuconfig. With this change, Kconfig files are consistently looked up relative to $srctree, which makes a lot more sense. Also remove note re. loading a subset of Kconfig files. Saying that the top-level file and all source'd Kconfig files are looked up relative to $srctree should make the behavior clear enough.
2018-08-14Use += instead of extend()Ulf Magnusson
+= also does an in-place modification for lists, and it's a bit faster. Also get rid of an 'if node.defaults' tests. Both symbols and choices can have defaults, and it's not worthwhile as an optimization either.
2018-08-12Simplify menuconfig-without-prompt warningUlf Magnusson
node.item is already available as 'sym'.