| Age | Commit message (Collapse) | Author |
|
The fancy regex isn't really justified. Much faster with replace() too,
though this is an unlikely hotspot.
Could have used a \g<0> backreference to refer to the entire match
instead of using a capturing group too. Hadn't discovered that.
Add some selftests for escape() and unescape() too.
|
|
|
|
Speeds things up a bit further.
Rework the unget handling to save the ungotten line directly instead of
using a flag.
Add some help texts to tests/Klocation to make sure the line number is
updated properly for those.
|
|
Check for incorrect exceptions instead of propagating them, and get rid
of the flag.
|
|
Easier to debug than a RecursionError.
Point out in the exception message that a common cause is environment
variables not being set correctly.
|
|
Old code.
|
|
Choice symbols without prompts are pointless and probably nonexistent in
practice, so it's a bit silly to run the no-prompt optimization for
them.
Piggyback copyright year update.
|
|
The Linux Kernel's merge_config.sh defaults to disabling warnings for
redundant assignments and has support for enabling them
specifically. This patch reproduces this behaviour in kconfiglib
except that we retaing kconfiglib's default behaviour of enabling the
warnings.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
|
|
Piggyback some cleanup and redundant comment removal.
|
|
Oversight. SYMBOL_AUTO (env_var) being set indirectly clears
SYMBOL_WRITE (_write_to_conf) in sym_calc_value(). The .config case was
already fine due to an explicit env_var check.
Even non-visible env. symbols ended up in the header, due to
'option env' internally adding a default.
Disallow user values altogether on 'option env' symbols, even if
specified manually. This matches the C implementation. Add a warning
too.
|
|
IANAL, but hopefully this should be enough. Don't bundle the license
file. Might be easier to work with if just kconfiglib.py is copied.
|
|
Clean up some formatting a bit too.
|
|
Confirms that all the examples that aren't tested in the test suite at
least run. Easy to miss brokenness there. Output can be inspected
manually (it'll vary depending on the kernel version).
Fix defconfig_oldconfig.py, which hadn't been properly updated for the
new API.
|
|
Add test coverage for that Choice.__repr__() path too.
|
|
Was only used by allyesconfig.py. Easy to add back if needed at any
point.
|
|
"List comprehensions no longer support the...",
https://docs.python.org/3.0/whatsnew/3.0.html
|
|
Just return (2,). More intuitive, and makes y-mode choices just work in
the menuconfig example.
Turns out to be simple to implement with choice symbol visibility
depending on the Choice.
|
|
Usability improvement discovered while putting together menuconfig
example. Would have to duplicate validity checking otherwise.
Also reject negative values for HEX symbols, just to be compatible with
the C implementation.
Keep TRI_TO_STR and STR_TO_TRI public. They're pretty handy even if
they're trivial.
|
|
s/absolute/relative/
|
|
Used to set a bunch of other options too on MODULES in the test, but
it's cleaner to do it separately.
|
|
Tests for .assignable have been added.
|
|
Just add a column for the expected values for the no-modules case to the
existing tests.
Also automatically detect choice symbols in choices with y mode and
disable the value setting test, instead of having to pass a flag.
|
|
|
|
Could never return 0 as a valid assignable value previously.
|
|
|
|
|
|
A tristate implied to y can't be set to m. Other than that, imply
doesn't affect assignable values.
Fix some copy-paste type errors too.
In the C menuconfig, a tristate with m visibility implied to y gets
stuck if you change it with space. Look into that later. Test case:
config MODULES
def_bool y
option modules
config Y_IMPLIER
def_tristate y
imply Y_IMP_M_VIS_TRI
config Y_IMP_M_VIS_TRI
tristate "y-imp m-vis tri" if m
|
|
Comprehensive selftests are important here, because the
allno/yesconfig.py scripts only check the upper and lower bound, and
allnoconfig disables modules.
Found a bug for non-selected m-visible tristates, where n didn't show up
in sym.assignable. Everything matches menuconfig after fixing that.
Still need to test symbols in choices with different modes, imply, and
.assignable for choices.
|
|
|
|
Can finally get rid of get_choices() and get_items() now.
Piggyback some more Kwtf tests, and remove some outdated comments.
There's already plenty of select/imply testing.
|
|
Scaffolding to make the test suite work with the new API. No longer
needed. get_choices() will be gone soon too.
|
|
Kinda silly to test if they're separate since a long time, but can do
that easily too with some reorganization.
|
|
Think those variables got used in other places before...
Fetch the choices by name.
Also dedotdotdot all messages for consistency.
|
|
The choice semantics tests already verify the behavior of optional
choices. Just print an optional choice instead to get some coverage for
querying it.
Do minor cleanup elsewhere.
|
|
Need to manually set the mode of the choice now.
Dependencies get a huge workout just from lack of global invalidation,
so the manual dependency tests might be redundant. Would be tricky to
reuse the old tests as is too, so they would need to be restructured at
least.
|
|
Menus are plain menu nodes now, and those are exercised elsewhere.
|
|
Can just skip the invalidation for promptless symbols. Makes things less
magic and more intuitive while still being fast. Means no docs need to
be rewritten too.
Now the warning gets printed for unset_value() as well.
|
|
_cached_vis is always calculated as a side effect of calculating any
other cached value, and so doubles as a flag for whether an item (symbol
or choice) has any cached values.
If _cached_vis is None for some item, it also indirectly means that no
other item can have any cached values that (actually) depend on the
item, because _cached_vis would have gotten calculated as a side effect
of calculating any such cached value. Therefore, it's safe to stop
recursive invalidation at an item that has _cached_vis None.
Huge speedup for the allyes/noconfig*.py scripts. allnoconfig_simpler.py
went from 2.671 seconds to 1.067 seconds.
The dependency selftests need to be updated too now that
_get_dependent() is gone. The kernel defconfig tests pass even if all
global invalidation is disabled at least (except for the few defconfigs
that don't set MODULES=y), and that's a huge invalidation test. Seems
pretty speedy too, even though there's some redundant work, so maybe
things could be simplified a bit...
|
|
Do not change the mode if y is assigned to a choice symbol inside a
choice in m mode, for example. Require Choice.set_value() to be called
instead.
This makes choices way less magical and more menuconfig-like. It would
also be confusing to be able to assign y to a choice symbol when y is
not in sym.assignable.
Set the mode manually in load_config() (y assigned to a choice symbol =>
y mode, and ditto for m). Change the warning for inconsistent values to
one that's probably less confusing, though the old one was closer to the
warning printed by the C implementation.
Need to fix a bunch of tests too...
|
|
Choice symbols get the choice itself propagated to the conditions of
their properties. This works since the Symbol/Choice value interfaces
are compatible now.
Simplifies value calculations and makes .assignable work automagically
for choice symbols in choices in any mode. One drawback is that a '&&
<choice>' now shows up on conditions when printing choice symbols, which
is not valid Kconfig. That should be easy to work around if needed at
least.
|
|
user_str_value isn't justified any more with the other API improvements.
user_value now stores 0, 1, 2 for bool/tristate symbols, and a string
for other symbol types. Much simpler and more intuitive.
Also avoid printing quotes around tristate values in __repr__(). This
was inconsistent too as it was only done for the value and user value.
Should be getting close to final API.
|
|
|
|
To be consistent with the renamed class.
Piggyback docstring fixes.
|
|
Easier to work with, allowing e.g. direct comparisons with < and >. Make
set_value() take 0, 1, 2 for bool and tristate symbols, and fix other
APIs to match.
Also:
- Add introductions to various concepts in the module docstring.
Document some more attributes. Still TODOs.
- Rename the Config class to Kconfig.
- Escape " and \ in the name of constant symbols when printing them.
Also make the (un)escaping 100% consistent with how the C tools do
it (\ before non-magic character should be unescaped too).
- Clean up the escaping/unescaping code and provide two public
escape()/unescape() functions.
- Export the original MODULES-independent type in orig_type. It's
needed for printing symbols in the reparsable __str__() Kconfig
format with just public APIs.
- Lots of other minor reorganizing and nits all over.
|
|
|
|
Probably just some usability tweaks left. Having to do STR_TO_TRI[] for
comparisons against 'assignable' values is kinda ugly and confusing.
|
|
|
|
|
|
|
|
WIP
|