summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-07-18Make 9.1.0 releasev9.1.0Ulf Magnusson
Adds e08b695 ("Add def_int, def_hex, and def_string keywords"), getting rid of some Kconfig inconsistency.
2018-07-18Add def_int, def_hex, and def_string keywordsUlf Magnusson
Analogous to def_bool and def_tristate, setting the type and adding a default at the same time. This is a Kconfiglib extension. These keywords can be useful in projects that make use of symbols defined in multiple locations, and remove some Kconfig inconsistency.
2018-07-18setup.py: Specify encoding when reading README.rstUlf Magnusson
https://github.com/clearlinux-pkgs/python-kconfiglib adds a patch for this. It avoids issues on systems that use the C locale, which implies ASCII encoding and raises UnicodeDecodeError when reading README.rst. Piggyback adding 'menuconfig' as another keyword.
2018-07-17Factor out isinstance(str) check in set_value()Ulf Magnusson
All types besides bool and tristate require the argument to be a string.
2018-07-17Simplify defconfig_filename() returnsUlf Magnusson
2018-07-17Remove outdated commentUlf Magnusson
'filename' no longer exists, and full_filename is explained in the _enter_file() doc-comment.
2018-07-16Refactor _T_*SOURCE implementation a bitUlf Magnusson
Get rid of the 'relpath(..., srctree) -> join(srctree, ...)', which undid a previous operation. _enter_file() only has a single caller and is more of a helper function, so it's okay if the interface is a bit weird.
2018-07-16Fix outdated _T_*SOURCE commentUlf Magnusson
source statements now always look relative to $srctree.
2018-07-15Formatting nitUlf Magnusson
2018-07-15Fix typo in READMEUlf Magnusson
2018-07-15Make 9.0.0 releasev9.0.0Ulf Magnusson
This release revamps the globbing design to make 'source' globbing, requiring at least at least one matching file. A new o(r)source statement can be used when it's okay for a pattern to not match any files. Relevant commit, with motivations: 7a428aa ("Switch to more sensible globbing statements (w/ backwards compatibility)"). Backwards compatibility is maintained by having g(r)source be an alias for o(r)source. A small API change was introduced too: Kconfig.srctree is now set to the empty string instead of None when $srctree is unset. This gives nice behavior for e.g. os.path.join().
2018-07-15Switch to more sensible globbing statements (w/ backwards compatibility)Ulf Magnusson
Instead of having 'source' and 'gsource', have 'source' always glob, but require the pattern to match at least one file, throwing KconfigError otherwise. Have separate 'osource' and 'orsource' statements (the o is for "optional") for cases where it's okay for the pattern to not match any files. This is analogous to 'include' and '-include' in Make. The biggest flaw with 'gsource' was that there was no way to do a globbing match while requiring something to match, possibly leading to subtle failures. Preserve backwards compatibility by having "gsource" and "grsource" be aliases for "osource" and "orsource", respectively. Also include some related changes: - Kconfig.srctree is now set to the empty string if $srctree is unset, rather than to None. This gives nice behavior with os.path.join() and os.path.relpath(), which treat the empty string as the current directory (without adding './', for os.path.join()). - When $srctree is set, Kconfig files in the current directory will no longer override Kconfig files in $srctree when the relative paths match. This was likely a bug all along in the C tools, and probably only makes sense for .config files. I've seen it cause breakage in Zephyr. - Clarify the behavior of $srctree in the Kconfig.__init__() docstring. - Make MenuNode.filename be relative to $srctree for the Kconfig file passed to Kconfig.__init__(). This makes it consistent. The major version will be bumped later due to the small Kconfig.srctree API change.
2018-07-15Reorder _filestack fieldsUlf Magnusson
Bit easier to read.
2018-07-15Detect recursive 'source' earlierUlf Magnusson
Off-by-one error, though still functional. The recursive source is now detected immediately as the file is source'd the second time. Also remove an outdated comment re. KconfigError.
2018-07-13Make 8.1.1 releasev8.1.1Ulf Magnusson
This release adds commit ac692af ("Fix absolute $srctree prefixes showing up on gsource'd files"), which fixes a bug that could cause $srctree to be included in some paths for e.g. generated documentation.
2018-07-13Fix absolute $srctree prefixes showing up on gsource'd filesUlf Magnusson
When using gsource with $srctree set to an absolute path, the $srctree prefix would show up in MenuNode.filename, trickling its way into e.g. generated documentation. This was due to a broken test: os.path.isabs() was checked after joining the pattern with $srctree, making it mistake an absolute $srctree for an absolute path in the Kconfig file. Fix the test.
2018-07-11Make 8.1.0 releasev8.1.0Ulf Magnusson
This release improves performance for projects that make heavy use of multiple definition locations for symbols, via commit 747e455 ("Massively speed up U-Boot parsing"). Two new warnings are included as well: - 652d991 ("Warn if int/hex/string symbols are evaluated logically") - 21b5351 ("Warn if int/hex 'default' is outside active 'range'")
2018-07-11Massively speed up U-Boot parsingUlf Magnusson
U-Boot has a ton of definition locations for some symbols, causing a lot of redundant work when iterating over Kconfig.defined_syms in _build_dep(). Iterate over set(Kconfig.defined_syms) instead, wherever possible. This speeds up the U-Boot parsing time from 4 seconds to 0.6 seconds on my machine. Also update the bundled tools to iterate over set(Kconfig.defined_syms). The performance loss is negligible even for projects that don't use multiple definition locations. Update the documentation to clarify that symbols/choices defined in multiple locations appear multiple times in Kconfig.defined_syms/choices as well.
2018-07-11Comment formatting nitUlf Magnusson
2018-07-10Add hint re. "macro expanded to blank string"Ulf Magnusson
More environment variables are referenced now.
2018-07-10Remove trailing whitespaceUlf Magnusson
2018-07-10Warn if int/hex 'default' is outside active 'range'Ulf Magnusson
Only out-of-range user values generated warnings before. The C tools warn for neither of them.
2018-07-10Warn if int/hex/string symbols are evaluated logicallyUlf Magnusson
They always evaluate to n. Would be nice if there was a trivial way to give the location(s). Just say "somewhere" for now.
2018-07-10Make 8.0.0 releasev8.0.0Ulf Magnusson
New features: - 2433deb ("Add Kconfig preprocessor") implements a new Kconfig preprocessor, documented in https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-macro-language.txt. It is required to parse the linux-next Kconfigs now, and will appear in Linux 4.18. 'option env=...' symbols and the $FOO syntax for expanding environment variables will be supported for backwards compatibility for a while. Consider switching to $(FOO) though, which is the new syntax (and removing 'option env=...' symbols). Changed behavior: - c19fc11 ("Drop some compatibility and tighten up lexing") makes Kconfiglib flag invalid characters in Kconfig files as a syntax error in all context. They were previously ignored in some places for compatibility with old sloppy versions of the C tools. The C tools fixed it with commit c2264564 ("kconfig: warn of unhandled characters in Kconfig commands") in July 2015. Older kernels might require fixing up the Kconfig files a bit now. New warnings: - 4200e25 ("Generalize select-with-unsatisfied-deps warning") makes the select-with-unsatisfied-dependencies warning trigger when a symbol with m-valued direct dependencies is y-selected.
2018-07-10Remove reference to "speedy" test suite option in READMEUlf Magnusson
Has been removed (and is now always on).
2018-07-10Add Kconfig preprocessorUlf Magnusson
Implement the Kconfig preprocessor described in https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-macro-language.txt (which is now in linux-next and will appear in Linux 4.18). A new Kconfig.variables property holds all the preprocessor variables so that they can be inspected programmatically. Preprocessor variables are represented by a new Variable class. With the preprocessor, environment variables are referenced with $(FOO) instead of $FOO. For backwards compatibility, $FOO is accepted as well for now (and leaves "$FOO" as-is if FOO doesn't exist). The $FOO syntax might be dropped at some point in the future (together with a major version increase). It should be supported for a few months at least. Some internals were cleaned up too, mostly related to parsing. Some outdated documentation was fixed as well.
2018-07-10Generalize select-with-unsatisfied-deps warningUlf Magnusson
y-selecting a symbol with direct dependencies m should be flagged as well. Mirrors a change to the C tools.
2018-07-02Refactor tokenization a bitUlf Magnusson
Have _tokenize() take the string to tokenize and return a list of tokens, and handle all the token list management outside. Simplifies the internal logic a bit. Likely faster too.
2018-07-02Simplify some dict.get() calls by passing defaultsUlf Magnusson
2018-07-02Simplify some _warn() callsUlf Magnusson
2018-07-02Tighten up named choice parsingUlf Magnusson
Things like 'choice NAMED_CHOICE oops extra tokens' and 'choice &&' are now detected as syntax errors. Bit faster too, though it doesn't matter here.
2018-07-02Number tokens from 1 to simplify some checksUlf Magnusson
This makes all tokens except empty strings truthy, getting rid of some 'is (not) None' checks.
2018-07-01Drop some compatibility and tighten up lexingUlf Magnusson
Old versions of the C tools used to ignore unhandled characters in some contexts due to sloppy lexing, which Kconfiglib emulated for compatibility (things like "---help---" used to depend on it). This was improved in the C tools by commit c2264564 ("kconfig: warn of unhandled characters in Kconfig commands"), committed in July 2015. Remove the compatibility hack and tighten up the lexing in Kconfiglib as well. It will make implementing the new preprocessor stuff smoother. The major version will be bumped.
2018-06-24menuconfig: Style nitUlf Magnusson
2018-06-24menuconfig: Remove redundant _update_menu() callUlf Magnusson
The _update_menu() call at the end of _change_node() is redundant, because _set_val() already calls _update_menu() if the value changes
2018-06-22genconfig: Remove unused sys importUlf Magnusson
2018-06-22oldconfig: Put standard library imports firstUlf Magnusson
More common style.
2018-06-22menuconfig: Fix some pylint code nitsUlf Magnusson
Wrong indentation, unused imports.
2018-06-22menuconfig: Simplify [N]/[M]/[Y] implementationUlf Magnusson
All three act on the currently selected node, so the code that fetches it can be moved into the helper function.
2018-06-22menuconfig: Simplify is_num() a bitUlf Magnusson
2018-06-22Simplify the find_symbol and list_undefined examplesUlf Magnusson
Much of the functionality is available in Kconfiglib itself now. Use the new APIs to implement the examples in a much simpler way.
2018-06-22Make 7.0.0 releasev7.0.0Ulf Magnusson
New features: - db92bb7 ("Add dependency loop detection") adds long-overdue dependency loop detection. Previously, dependency loops would trigger hard-to-debug Python RecursionError exceptions during evaluation. They now generate a KconfigError instead, with a helpful message that shows the items in the loop. Backwards-incompatible changes (major version bumped to 7): - eb6c21a ("Turn MenuNode/Symbol/Choice.referenced() into a @property") fixes some inconsistency in the recently-added referenced-symbols APIs. Oversight. Other changes: - f6eb4f4 ("Add Symbol/Choice.referenced() convenience methods") makes it easier to get all the symbols/choices referenced by a symbol or choice. Previously, you'd have to loop through all the menu nodes (definition locations) yourself, which might not be obvious. - ca89ca0 ("Rename KconfigSyntaxError to KconfigError") changes to a better exception name, as KconfigSyntaxError was raised for some things that aren't syntax errors. The old name is kept as an alias for now for backwards compatibility.
2018-06-22Turn MenuNode/Symbol/Choice.referenced() into a @propertyUlf Magnusson
Having it as a function is inconsistent, since all other read-only fields use properties. Oversight. Major version will be bumped to 7, though the function version wasn't in for long.
2018-06-22Add Symbol/Choice.referenced() convenience methodsUlf Magnusson
Returns the union of the MenuNode.referenced() sets for all the menu nodes of the symbol/choice.
2018-06-20Simplify MenuNode.referenced() a bitUlf Magnusson
Can get the initial set from expr_items(self.dep), since it's always included and always returns a new set().
2018-06-20Rename KconfigSyntaxError to KconfigErrorUlf Magnusson
This exception is generated for semantic errors and e.g. when dependency loops are detected as well, so the name is bad. Keep the old name as an alias for now for backwards compatibility.
2018-06-19Add dependency loop detectionUlf Magnusson
Pretty long overdue. Until now, dependency loops have raised a hard-to-debug Python RecursionError during evaluation. A Kconfiglib exception is raised now instead, with a message that lists all the items in the loop. See the comment at the start of _check_dep_loop_sym() for an overview of the algorithm. At a high level, it's loop detection in a directed graph by keeping track of unvisited/visited nodes during depth-first search. (A third "visited, known to not be in a dependency loop" state is used as well.) Choices complicate things, as they're inherently loopy: The choice depends on the choice symbols and vice versa, and the choice symbols in a sense all depend on each other. Add the choice-to-choice-symbol dependencies separately after dependency loop detection, so that there's just the choice-symbol-to-choice dependencies to deal with. It simplifies things, as it makes it possible to tell dependencies from 'prompt' and 'default' conditions on the choice from choice symbol dependencies. Do some flag shenanigans to prevent the choice from being "re-entered" while looping through the choice symbols. Maybe this could be cleaned up a bit somehow... Example exception message: Dependency loop =============== A (defined at tests/Kdeploop10:1), with definition... config A bool depends on B ...depends on B (defined at tests/Kdeploop10:5), with definition... config B bool depends on C = 7 ...depends on C (defined at tests/Kdeploop10:9), with definition... config C int range D 8 ...depends on D (defined at tests/Kdeploop10:13), with definition... config D int default 3 if E default 8 ...depends on E (defined at tests/Kdeploop10:18), with definition... config E bool (select-related dependencies: F && G) ...depends on G (defined at tests/Kdeploop10:25), with definition... config G bool depends on H ...depends on the choice symbol H (defined at tests/Kdeploop10:32), with definition... config H bool prompt "H" if I && <choice> depends on I && <choice> ...depends on the choice symbol I (defined at tests/Kdeploop10:41), with definition... config I bool prompt "I" if <choice> depends on <choice> ...depends on <choice> (defined at tests/Kdeploop10:38), with definition... choice bool prompt "choice" if J ...depends on J (defined at tests/Kdeploop10:46), with definition... config J bool depends on A ...depends again on A (defined at tests/Kdeploop10:1)
2018-06-19allnoconfig: Remove leftover commentUlf Magnusson
2018-06-18Add Nordic Semiconductor ASA as shared menuconfig copyright holderUlf Magnusson
Largely paid work, and it's copied into Zephyr, so it was a request. All other source files are still copyright me. Nothing changes in practice. I went for shared copyright to make sure the ISC license can never be changed.
2018-06-15Link to ACRN utilitiesUlf Magnusson