| Age | Commit message (Collapse) | Author |
|
Removes repeated KCONFIG_CONFIG boilerplate.
Also make allyesconfig use KCONFIG_CONFIG when writing (oversight), and
document the sys.exit() behavior for standard_kconfig().
|
|
standard_kconfig() gets the top-level Kconfig file from the first
command-line argument, defaulting to "Kconfig". This removes some
boilerplate from tools.
|
|
Handy e.g. when implementing advanced search features.
|
|
Useful in various places outside the library, e.g. in the upcoming
packaged allyesconfig implementation, and when generating documentation.
|
|
Commit cbf32e2 ("Expand environment variables in strings directly")
added direct expansion of environment variables is strings, with commit
b9384a1 ("Restore compatibility with $UNAME_RELEASE") adding a hack to
restore compatibility with the predefined $UNAME_RELEASE symbol, used by
DEFCONFIG_LIST in the Linux kernel.
With the compatibility hack in place, there's no longer any need to
define UNAME_RELEASE as a proper symbol. Remove it.
|
|
D'oh
|
|
Shaves ~6% off the _parse_help() runtime for the x86 Kconfigs in
cProfile.
|
|
|
|
This takes some heuristics, as it's indistinguishable from a reference
to an undefined symbol. Guess that the quotes are missing if the
'default' value isn't all-uppercase.
|
|
Since commit cbf32e2 ("Expand environment variables in strings
directly"), Kconfiglib expands environment variables directly in strings
instead of using the 'option env=...' mechanism (this is planned for the
C tools too). This new behavior is backwards-compatible as long as all
'option env=...' symbols have the same name as the environment variables
they reference.
Warn if 'option env="FOO"' appears on a symbol that isn't named FOO, to
point out compatibility issues and help with debugging.
|
|
This code is surprisingly hot.
|
|
Only a single caller left now, in a hot loop.
|
|
Also strip the prompt in that case. Leading/trailing whitespace in
prompts leads to ugly workarounds in e.g. reStructuredText
documentation, where '*prompt *' is invalid.
|
|
UNAME_RELEASE is expanded in one of the 'default's of the DEFCONFIG_LIST
symbol in the Linux kernel. This broke after "$FOO" was changed to
directly expand to the value of the environment variable FOO, rather
than to the value of the symbol FOO.
Restore compatibility with a small wrapper.
|
|
This is less twisty, and generates slightly smaller bytecode. Probably
doesn't help to special-case the first line.
|
|
More readable.
|
|
Now that environment variables are expanded directly with
os.path.expandvars(), "$SRCARCH" will be kept as is if SRCARCH isn't
set. arch/$SRCARCH/Kconfig won't exist, unlike arch//Kconfig.
|
|
Get rid of some code duplication.
|
|
Get rid of some code duplication.
|
|
|
|
This allows accurate documentation to be generated for symbols and
choices defined in multiple locations. There are now MenuNode.defaults,
MenuNode.selects, etc., lists that mirror the corresponding
Symbol/Choice lists.
Symbol/Choice.__str__() now correctly show property locations as well,
by simply concatenating the strings returned by MenuNode.__str__() for
each node.
_parse_properties() was modified to add all properties directly to the
menu node instead of adding them to the contained symbol or choice. The
properties are then copied up to symbols and choices in
_finalize_tree(). Dependency propagation is handled at the same time.
As a side effect, this cleans up the code a bit and de-bloats
_parse_properties().
Update the menuconfig implementation to use the new functionality. It
now lists the menu nodes for symbols and choices with the correct
properties for each node (previously, all defaults, selects, implies,
and ranges appeared on the first definition).
|
|
Make "$FOO" directly reference the environment variable $FOO in e.g.
'source' statements, instead of the symbol FOO. Use os.path.expandvars()
to expand strings (which preserves "$FOO" as-is if no environment
variable FOO exists).
This gets rid of the 'option env' "bounce" symbols, which are mostly
just spam and are buggy in the C tools (dependencies aren't always
respected, due to parsing and evaluation getting mixed up). The same
change will probably appear soon in the C tools as well.
Keep accepting 'option env' to preserve some backwards compatibility,
but ignore it when expanding strings. For compatibility with the C
tools, bounce symbols will need to be named the same as the environment
variables they reference (which is the case for the Linux kernel).
This is a compatibility break, so the major version will be bumped to 6
at the next release.
The main motivation for adding this now is to allow recording properties
on each MenuNode in a clean way. 'option env' symbols interact badly
with delayed dependency propagation.
Side note: I have a feeling that recording environment variable values
might be redundant to trigger rebuilds if sync_deps() is run at each
compile. It should detect all changes to symbol values due to
environment variables changing value.
|
|
Enough people have run into exceptions due to running in the C locale
that it seems worthwhile.
Add a new 'encoding' parameter to Kconfig.__init__() that specifies the
encoding to use and make it default to "utf-8". Passing None gives the
old behavior of using the encoding specified in the environment.
Related PEP: https://www.python.org/dev/peps/pep-0538/
|
|
Also make printing of warnings to stderr optional. It's on by default,
since it's almost always what you want.
This makes printing and processing of warnings more flexible, compared
to always printing warnings to stderr as soon as they're generated. It
was inspired by wanting to promote certain warnings to errors in Zephyr,
which previously required capturing stderr.
|
|
...including the optional ones. Previously, those were independent.
This is more intuitive, and it seems unlikely that you'd want some of
the optional warnings printed without having general warnings printed.
This is a small API behavior change, so the major version will be bumped
to 5 at the next release. Programs that enabled optional warnings
without enabling general warnings will be affected.
This means that all warnings now go through the same code path, which
will come in handy for later changes (making the warnings available in a
list, though with stderr printing still enabled by default).
Add some more documentation for the Kconfig.__init__() 'warn' parameter
and the enable_redun_warnings() function as well, and clean up the
variable naming a bit.
|
|
These errors are a pain to debug otherwise, and might look like
Kconfiglib brokenness.
Another option would be ignore decoding errors, or do the
'surrogateescape' thing on reading and writing, but keep it simple for
now. Pointing out the problem might be more helpful.
|
|
Flag lines matching neither 'CONFIG_FOO=...' nor
'# CONFIG_FOO is not set' that aren't blank or comments.
|
|
Same as Symbol.direct_dep (OR of node dependencies from all definition
locations). It's handy to have available when generating information
about choices.
|
|
I've had to implement the logic for walking reverse dependencies (from
select) a couple of times now, and it's always a bit tricky to get
right. Reduce code duplication and simplify things by adding a helper
function split_expr() that splits an expression into a list of either
its AND or OR operands.
A nice side effect is that e.g. the warning generated for selecting a
symbol with unsatisfied direct dependencies now lists the selecting
symbols in the order that they appear in the Kconfig files.
split_expr() might be helpful for splitting other types of expressions
as well, e.g. to put operands on separate lines when generating
documentation.
|
|
Previously, the warnings
warning: FOO (defined at Kconfig:1, Kconfig:6) defined with type unknown
warning: the default selection BAR (defined at Kconfig:9) of FOO (defined at Kconfig:1, Kconfig:6) is not contained in the choice
were printed for this (obscure, but okay) pair of definitions:
choice FOO
default BAR
endchoice
choice FOO
prompt "foo"
config BAR
bool "bar"
endchoice
The problem is that BAR is not known to be a choice symbol by the time
the first choice definition is encountered in _finalize_tree(), since
that's determined only when the second definition is encountered (it
needs to happen there, because implicit submenus can influence whether a
symbol is a choice symbol or not, and implicit submenus are determined
in _finalize_tree()).
Fix it by moving the sanity checks out of _finalize_tree() and into a
separate pass over all symbols and choices that runs after
_finalize_tree(). That might avoid other gotchas too.
|
|
Oversight
|
|
'is_menuconfig' is set after 'item' in the other cases.
|
|
Extending the scope of is_menuconfig so that it's True for all items
whose children should be displayed in a separate menu turns out to be
handy when implementing menuconfig-like functionality.
Keep the old name for backwards compatibility. It's good enough.
|
|
This is redundant from an evaluation perspective, as && has higher
precedence than ||, but is easier to read.
A && B || C && D is now rendered as "(A && B) || (C && D)".
|
|
This is redundant on its own, as only a single symbol can be
selected/implied, meaning just .name will work fine too. It means that
all symbols appearing in the __str__() representation of symbols and
choices are now printed via expr_str() though, which might come in handy
soon.
|
|
- Detect Symbol directly instead of as (not tuple) + (not choice)
- Test explicitly for a tuple (non-Symbol) in NOT
- Add some tests to get better coverage for NOT and parentheses
|
|
This has no effect.
Model the warning on the one for selecting a symbol with unsatisfied
dependencies.
This is a Kconfiglib-exclusive warning so far.
|
|
|
|
Bit shorter, still clear in context.
|
|
Simplify the looping and remove some comments that aren't super helpful.
Also put " - " at the beginning of the lines listing the selecting
symbols. Bit more readable.
|
|
A valid int/hex user value can never be an empty string, so they test
can be simplified.
|
|
Example warning:
warning: user value 0x100 on the hex symbol HEX (defined at Kconfig:18) ignored due to being outside the active range ([0x13, 0x73]) -- falling back on defaults
This is a Kconfiglib-exclusive warning. It might be tricky to implement
in the C tools, due to weird two-phase handling of int/hex symbols.
There is unfortunately no easy way to map the warning back to a .config
line, as the active 'range' can't be known in general until the entire
configuration has been read (consider 'range 0 10 if FOO' for example).
Instead, the warning is generated when the symbol value is calculated.
|
|
set_value() already rejects invalid int/hex values, so there's no need
to check the value in str_value().
|
|
No need to create a list. glob() just does list(iglob()) internally as
well.
|
|
There's no need to handle prompts like defaults, selects, etc. in
_parse_properties(), because prompts belong to menu nodes, which means
only local dependencies will be propagated anyway.
Makes the code a bit less twisty.
|
|
Consistent with how dependencies are propagated elsewhere.
Get rid of the 'parent_dep' variable too.
|
|
|
|
|
|
Bit more readable to have the parent node and the previous node next to
each other.
Also rename 'prev_node' to just 'prev', to be consistent with 'parent'.
There's fewer parameters than in the past now, making it pretty easy to
follow anyway. Remove some inline parameter-related comments too.
|
|
- Restructure the test.
- Call the function _int_hex_ok() instead. Bit less spammy. Also add a
doc-comment to explain it.
|