| Age | Commit message (Collapse) | Author |
|
Adds a small missed optimization opportunity, in commit 74ce9d3
("Optimize fetching of initial token on line").
|
|
|
|
Another possible optimization was missed in commit ab89ef6 ("Get rid of
_next_token() and _peek_token()"): The index of the initial token on a
line is known to be 0, so there's no need to check _tokens_i.
Also reads a bit clearer.
|
|
Tightens up syntax checking and improves a warning:
- Commit 13a7bae ("Flag extra trailing tokens in all contexts") adds
checking for extra trailing tokens in a few overlooked cases.
- Commit f356ba8 ("Clarify that select/imply is a no-op for choice
symbols") clarifies the warning when selecting/implying a choice
symbol.
Parsing performance was improved slightly as well.
|
|
The warning for selecting/implying a choice symbol could be
misunderstood as saying that select/imply has no effect on choice
symbols in a particular case. Select/imply never has an effect on choice
symbols though.
Rephrase the warning to make it clearer.
|
|
The following cases were let through without a parse error (with the
extra tokens just being ignored):
- endif/endmenu/enchoice <extra tokens>
- default FOO <extra tokens> (though 'default FOO if' flagged an
error)
Make them generate an error.
|
|
These are pretty hot. Inline them to save a few % of parsing time.
They're pretty simple anyway.
_tokens_i was initialized to -1 to simplify the _next_token()
implementation. With _next_token() gone, initialize it to 0 instead,
which simplifies some other code.
|
|
The KCONFIG_WARN_UNDEF test often fails on Python 3.4 (3.5 not tested),
but the output is still correct. It just differs due to dict ordering
randomness.
Python 3.6 iterates over dicts in insertion order in practice, and
Python 3.7 made it part of the spec, so enable the test for 3.6 and
later.
Python 2.7 seems fine as well.
|
|
- Commit ee25489 ("menuconfig: Print '----' instead of '---> (empty)'")
makes the menuconfig display empty menus (e.g. from disabled
'menuconfig' symbols) in a less spammy way, matching the C tools.
- Commit 6313925 ("Remove message re. Kconfiglib 10 backwards compat.
break") removes an old message printed when the top-level Kconfig
file can't be opened and $srctree is set. Hopefully it's been noticed
by now.
- Commit a1a4430 ("Use 'foo.__class__ is Bar' instead of
'isinstance(foo, Bar)'") improves parsing and evaluation performance a
bit.
|
|
They're either proper menus, choices, or 'menuconfig' symbols.
|
|
|
|
This matches the C tools and is a bit less spammy. Maybe it's less clear
what it means at a glance, but it's probably less confusing for disabled
'menuconfig' symbols at least.
|
|
Helps to have a fancier example too.
|
|
The message has been in for three months now. Hopefully that was enough
for it to get noticed.
|
|
This is 30%-60% faster for both the matching and non-matching case, as
measured with timeit on Python 2.7 and 3.6, and saves at least a few
percent of total parsing time (and probably some evaluation time too).
isinstance(foo, tuple) is particularly slow.
Symbol and Choice instances are always created by us, so potential
subclassing shouldn't be a problem.
|
|
Adds commit df61771 ("menuconfig: Never snap scroll back to
max_scroll"), which fixes a small menuconfig UI nit.
Add 'configuration-management' as a tag to setup.py as well.
|
|
|
|
When scroll > max_scroll (blank space at the bottom of the menu, and
also scrolled down), moving the cursor down would snap the scroll back
to max_scroll, with a small annoying jump. This could happen when going
into show-all mode and moving the cursor down near the bottom of a menu,
for example.
Fix it by leaving the scroll as-is when scroll >= max_scroll (increasing
it by one otherwise).
|
|
Move the addition of the visible child nodes and use += instead of
extend().
|
|
Not noticeable performance-wise, but a bit neater.
|
|
|
|
Adds commit b65baa4 ("Add support for KCONFIG_ALLCONFIG"), which allows
particular symbol values to be forced during all{def,no,mod,yes}config.
|
|
This allows some symbol values to be forced while running
all{def,no,yes,mod}config.py. See Documentation/kbuild/kconfig.txt in
the Linux kernel.
Add a helper function load_allconfig() to Kconfiglib to avoid code
duplication in the tools.
Also add functions for enabling/disabling the warning that's generated
when a symbol is assigned multiple times in a (set of) .config files and
the values differ. It should be disabled when merging the
KCONFIG_ALLCONFIG configuration file. Previously, only the warning
generated when the assigned values are identical could be disabled.
Disable all warnings related to assigning a symbol multiple times in
examples/merge_config.py as well.
|
|
|
|
|
|
Adds two small library/menuconfig improvements:
- Commit 7992519 ("Always strip trailing whitespace in 'MenuNode.help'
and __str__()") tightens up the format of strings a bit, and
documents it.
- Commit b810bda ("menuconfig: Support HOME and END in the jump-to
dialog") adds support for some keys that were missing from the
jump-to dialog.
|
|
Oversight. END can be handy for viewing all choices, menus, and
comments, which appear at the end.
Also support Ctrl-D as an alias for Page Down. Ctrl-U is already used by
the edit box (erase to beginning of line).
Also change the jump-to dialog title to hint that other things besides
symbols can be jumped to.
|
|
For strings with no $ or \ in them (99.86% of all strings in the Linux
x86 Kconfigs), we can just find() the matching quote directly.
Saves a few % of tokenization time.
|
|
|
|
Previously, you could get either one or two newlines at the end of
MenuNode.help and the various __str__() methods, though this wasn't
documented.
Always stripping trailing whitespace is cleaner e.g. when using print(),
which automatically appends a trailing newline, and makes things
consistent.
Hopefully nothing relied on the old undocumented behavior. It's fine for
genrest.py at least.
|
|
|
|
|
|
Adds a small menuconfig improvement: Commit 35af004 ("menuconfig: Move
cursor to choice selection when entering choices").
|
|
Previously, the first entry was selected, like for menus.
Also tweak _center_vertically() so that the menu is never scrolled down
when all entries fit on the screen.
|
|
Set UNKNOWN (representing 'no type') to 0, which is falsy, to simplify
some checks.
Also reorder some dictionary keys for consistency.
|
|
Adds fixes for two obscure crashes, related to consecutive empty if's
and toggling symbols without a type in the menuconfig:
- Commit 0e6cd82 ("Fix removal of multiple consecutive 'if' nodes")
- Commit db60270 ("menuconfig: Fix crash when toggling symbols without
a type")
|
|
Trying to toggle the following symbol crashed the menuconfig:
config FOO
prompt "foo"
Symbols defined without a type are pointless and generate a warning
(particular definition locations can omit the type, but some definition
location should give a type if the symbol is defined in multiple
locations). We should never crash for them though.
Fix the crash. The code assumed that the symbol's current value would
appear in Symbol.assignable, like for a visible bool/tristate, but
symbols without types get their name as their value.
Also skip printing "(NEW)" next to symbols without a type.
|
|
Despite 'if' nodes being flattened before 'if' removal, consecutive 'if'
nodes can still show up for code like the following:
...
if X
endif
if X
endif
...
_remove_ifs() failed to remove the second 'if' node, leading to a crash
e.g. when turning on show-all mode in the menuconfig in a menu with such
code (due to the unexpected 'if' node).
Stuff like the above could potentially result from 'osource's with no
matches, though I just spotted the error while looking over the code.
Fix the 'if' removal logic to properly handle consecutive 'if' nodes.
|
|
Adds commit 8be38f2 ("Don't show backtraces for expected exceptions in
tools"), which hides backtraces for expected errors from tools (like
Kconfig syntax errors and missing files).
|
|
KconfigError and IOError are part of normal operation and don't indicate
a problem with the library itself. Catch and print them in
standard_kconfig() and sys.exit(), to avoid spammy backtraces from e.g.
menuconfig.py when Kconfig files don't exist or have errors.
|
|
Can get away with a single variable by assigning node.list earlier, and
save a tiny bit of work with a chained assignment.
Also clarify what the tricky Python chained assignments correspond to,
where it matters.
|
|
Turns into a weird-looking 'Error loading ' otherwise.
Maybe Enter should be ignored for empty filenames instead...
|
|
Commit 14603c0 ("Make errno/strerror/filename available on IOError")
makes IOError/OSError.errno/strerror/filename available to scripts, when
it is raised from e.g. Kconfig.load_config().
Previously, some implementation trickery related to custom exception
messages meant that they weren't available.
|
|
An error reporting flaw was that most raised IOErrors got their
errno/strerror/filename fields stripped, due to wanting to show a custom
messages. The problem was that adding back 'errno' and 'strerror' made
IOError.__str__() always return a fixed string
("[Errno <errno>] <strerror>"), ignoring any custom message.
This is friendly to users, but unfriendly to scripts (the menuconfig had
a workaround). Make things friendly to both by raising an internal
subclass of IOError instead, that preserves errno/strerror/filename but
prints a custom message. The exception can then still be caught as
IOError/OSError by scripts.
|
|
|
|
After commit e0256b6 ("Have MENU and COMMENT match _T_MENU and
_T_COMMENT"), the only falsy value for node.item is None, since all
token constants are truthy (since they're never 0).
|
|
Tiny bit faster and smaller. Clear in context.
|
|
Same approach as for the expression type symbolic constants. Removes a
tiny bit of conversion and makes things a bit more consistent.
|
|
|
|
Made more sense when the code was part of _build_dep(). The same thing
is explained in the function docstring now.
|