| Age | Commit message (Collapse) | Author |
|
WIP
|
|
Get the symbol name without the '$' straight from the regex.
|
|
$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.
|
|
Didn't even notice that it had become empty...
|
|
Clearer.
|
|
|
|
Add some micro-optimizations that speed up allyesconfig.py by 10-20%
with CPython. Clean up some minor stuff too.
|
|
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.
|
|
Also be a bit more consistent in how property variables are ordered.
|
|
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.)
|
|
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.
|
|
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.
|
|
Calculate as needed instead. Old cruft.
|
|
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.
|
|
- 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.
|
|
There's already a "misc." section. Also fix typo in docstring.
|
|
Minor fixes:
- Even with print_undef_assign=True, "# CONFIG_NOT_DEFINED is not set"
would not generate a warning.
- Change the warning when a variable is set more than once in the
.config to be a bit more explicit.
- Only de-quote and unescape assignments to string variables, which is
nicer and matches the C implementation.
|
|
Rearrange a bit and document that a trailing newline does not need to be
added. Clean up the tests a bit too.
|
|
Previously we'd crash instead of printing the warning, because we didn't
pass 'filename' and 'linenr' to _stderr_msg(). This code path currently
can't be reached via load_config() and needs an explicit
set_user_value(), so the bug went undetected.
Fix by breaking out a separate _warn_undef_assign() that defaults
'filename' and 'linenr' to None, similar to _warn().
|
|
By consistently stripping trailing whitespace instead of stripping
initial whitespace in the string/operator case, we do less redundant
work and handle the '\n's at the end of lines better. Shaves a few % off
the _tokenize() runtime in cProfile and line_profiler.
|
|
More explicit.
|
|
Think I had it in the back of my head somewhere that not invalidating
undefined symbols could break some obscure cases, but turns out it's
perfectly safe: Nothing can change the value of an undefined symbol.
They always get their name as their value.
There's no need to unset user values on them either, because
set_user_value() already refuses to to set one on them.
Lets us get rid of the Python 2/3 compatibility hack and instead iterate
over a plain list of defined symbols.
|
|
The clear loop in write_config() already guarantees that
_already_written will be set for all symbols that could be written out
to the .config. Clarifies the scope.
Also change the code to only clear _already_written for defined symbols.
No other symbols could ever be written out. Gives a nice loop over a
plain list.
|
|
|
|
- Get rid of the use_defaults* variables and clean up the defaults
logic. As a side effect, '_write_to_conf' is now set in all paths and
doesn't need to be set initially in the function.
- Rename 'new_val' to just 'val'.
- Clean up the range handling for INT/HEX a bit.
- Other minor nits.
|
|
Can be handled inline in a nicer way, especially with writelines().
|
|
- Use the nifty writelines() function, which I had completely missed.
Saves creating a large temporary string for each .config (though it's
probably not a big deal). Since writelines() doesn't add any
newlines, tweak the string literals to add them.
- Get rid of _make_block_conf(). This helper made more sense in ancient
versions where there was a separate _Block class.
- Rename _make_conf() to _add_config_strings() to be a bit more
explicit.
- Also rename the 'append_fn' parameter to 'add_fn'.
- Misc. minor nits.
|
|
Better to be explicit. Weren't that many users left now either.
|
|
Mirrors Config._config_filename and makes it clearer which file each
variable refers to.
|
|
Those are related: The hack in _parse_expr() accidentally overwrote the
_filename variable, causing get_kconfig_filename() to return the wrong
filename if the base Kconfig file ended with a 'source' statement.
Remove the hack and explicitly pass all the variables. It might have
made more sense in an older version of the code.
Also add back the grammar in a different format, some more comments, and
a mind dump from tinkering with the parsing code.
|
|
Single user, not worth the obfuscation. Also fix an outdated reference
re. 'transform_m' and remove the grammar as it makes things seem more
complex than they really are.
|
|
There's old ad-hoc code that does this in the C implementation, added in
f5eaa32 (kconfig: tristate choices with mixed tristate and boolean
values). Unless a tristate choice is in "y" mode, non-tristate symbols
get visibility "n".
There are currently no tristate choices with non-tristate symbols in the
kernel, so this never triggered.
Modify some self tests that weren't aware of this behavior, and add some
new ones. Also remove an old pointless test.
|
|
- A small modification to _initial_token_re_match makes it reject
comments too, saving some manual code (and probably lots of string
copying).
- Reorganize things to handle 'previous' in a nicer way.
- Use tuples instead instead of lists in the no-tokens and _T_HELP
cases. Could preallocate and return an empty _Feed too, but it seems
like overkilling it.
Profiling done with cProfile and line_profiler.
|
|
|
|
Previously, 'default CHOICE_SYM [if <cond>]' in a choice would skip any
following 'default' properties if <cond> was non-'n'. However, those
other defaults should still be considered if CHOICE_SYM has visibility
'n'. Previously, we'd immediately fall back to selecting the first
visible symbol in the choice in that case.
get_selection_from_defaults() now exactly mirrors sym_choice_default()
from the C implementation, and got less convoluted too.
Nothing in the kernel defconfigs triggered this.
Add a new test case too.
|
|
|
|
Probably not worthwhile to do anything overly fancy in the mentioned
cases. Add some more helpful comments instead.
Piggyback another comment nit.
|
|
The constructors previously defaulted all properties. This is dead code
for properties that are always set on items from outside during parsing,
and obfuscates the code flow and wastes time. Instead, just mention
other properties that exist in comments in the constructors.
Also add test cases for missing and empty 'choice' help texts. Removing
the default 'self._help = None' assignment in Choice.__init__() wasn't
caught by the selftests.
|
|
|
|
|
|
We only look at the value $CONFIG_ had when the configuration was
loaded, so it's safe. Forgotten cleanup.
|
|
'menuconfig' only deals with presentation in the configuration
interfaces, and we don't handle it in any special way yet. Also point
this out with some comments.
|
|
Old overmicrooptimization. Many of these involve constants that don't
need to be looked up now too, and so should get faster.
|
|
|
|
The default string conversions for bools is fine. Turns "true"/"false"
into "True"/"False" in object string representations. Hopefully that's
not too bad of a backwards-compatibiltiy break.
|
|
I didn't do this when I first wrote Kconfiglib, for whatever reason.
Makes the public API clearer to people browsing the code (though it was
already done for function names) and has some other nice side effects
like uncluttering the module-level documentation and making
autocompletion in ipython more useful. Might avoid pissing off some
people too.
Remove the trailing from _ from stuff that no longer clashes with
keywords.
Piggyback some formatting cleanups for stuff I happened to spot. It's a
huge unwieldy diff anyway.
|
|
...instead of os.path.exists(). This more closely mimics the test in the
C implementation, which boils down to fopen(file, "r") == NULL.
Could open(filename) and catch exceptions too, but it might be
overkilling things.
|
|
This code in zconf.l says !=, not ==. Thought the behavior seemed weird.
if (!f && name != NULL && name[0] != '/') {
env = getenv(SRCTREE);
if (env) {
sprintf(fullname, "%s/%s", env, name);
f = fopen(fullname, "r");
}
}
return f;
Thankfully only broken for a short while. Also gives much simpler code.
|
|
_clean_up_path() was only ever passed filenames, so stripping trailing
slashes was redundant. Better to strike at the root of the problem too,
which is the os.path.join() with 'base_dir' defaulting to ".".
The old hack gave incorrect results in obscure cases: Turning .//oops
into /oops is wrong.
The new version should be Windows-friendly as well.
|
|
|