| Age | Commit message (Collapse) | Author |
|
Fixes two minor issues that didn't trigger for the kernel defconfigs but
were found by inspecting the Kconfig C sources:
- 5f3d307 (Fix 'default' on non-visible choice symbols)
- f76a524 (Hide non-tristate symbols in non-y tristate choices)
Also includes some minor optimizations and a lot of code cleanups,
including prefixing all internal identifiers with _.
|
|
The old error from the test suite was cryptic.
|
|
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.
|
|
|
|
|
|
Shows up when you do 'pip show kconfiglib', which previously showed
UNKNOWN for the license. I was hoping it'd be inferred from the trove
classifiers.
Make this a 1.0.2 release.
|
|
Will make it work for most people out of the box, plus it's good default practice anyway.
|
|
Gets the get_defconfig_filename() fixes out.
|
|
...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.
|
|
|
|
Previously, $srctree/path/to/defconfig would be looked up before
/path/to/defconfig, and the code wouldn't check if /path/to/defconfig
was an absolute path ($srctree is ignored otherwise). Sloppy old
oversights. The behavior now fully matches the C implementation.
Also fix some related things:
- An 'if m' suffices to select a defconfig. We previously required 'y'.
- Make the code less hacky and possibly more Windows-friendly by using
os.path.relpath() to de-absolutize paths, and stop using
os.path.normpath() as it could change the meaning of paths that
contain symbolic links.
- Explain what happens if 'option defconfig_list' is set on multiple
symbols and print a warning in that case.
- Fix get_srctree(). It would previously return "." instead of None if
$srctree was unset at parse time. Somehow forgot to to test this. The
code is now much more straightforward.
|
|
There's already parse_val_and_cond(), which handles '<x> if <y>' where
both <x> and <y> need to be parsed. Add a corresponding _parse_cond()
helper which can be used in cases where only <y> should be parsed (for
'select', 'imply', and 'range').
Also move both _parse_val_and_cond() and _parse_cond() outside
_parse_properties(). More explicit, and shows a small performance
improvement during parsing.
|
|
Bit more specific than https://pypi.python.org.
|
|
|
|
|
|
Along with the v1.0.0 tag. First version has been pushed to PyPI.
|
|
Preparation for adding to PyPI. Switch to setuptools and add a bunch
more metadata. Use semantic versioning (http://semver.org).
|
|
Packaging preparation.
Unspams the README a bit (but spams the tree...). Should make GitHub
display the license automatically.
|
|
|
|
In preparation for creating a PyPI package. This is the documentation
format PyPI expects. Some automatic conversion workarounds can be found
on Google, but keep it simple and eliminate a step.
Add a fancy table of contents using ::contents too.
|
|
|
|
Makes ANDs between nonexistent expressions yield a nonexistent
expression.
|
|
|
|
- Get rid of _sym_str_string(), which was only used here.
- Remove 'if expr is None' case that could never trigger
- Add a test for printing string symbols, as they are a bit tricky:
Default values should not be evaluated to tristate values.
|
|
Store simple (<operator>, <operand 1>, <operand 2>) tuples instead of
(<operator>, [list of operands]) tuples.
The thought process behind the original representation was to avoid
creating lots of nodes for long X && Y && Z && ... chains that sometimes
appear, and possibly speed up evaluation. In retrospect, it's pretty
bad, for the following reasons:
1) _make_and() and _make_or() created lots of new merged lists instead
of simply reusing the tuples already allocated for the
subexpressions. This is slow and memory hungry.
2) Any gain in evaluating long expressions would barely offset slower
evaluation of short expressions.
3) The code became more complex.
Most importantly, this change makes expressions more straightforward to
work with for people peeking into internals.
|
|
|
|
|
|
Given recent issues, some people seem to run Kconfiglib on Windows.
|
|
|
|
|
|
|
|
- Reorder some things by relevance.
- Kinda-sorta officially sanction digging into internals (for
expressions anyway).
- Be a bit less rambling.
- Fix dead link to gen-manual-lists.py. It was removed after
the listing was removed from the Buildroot manual.
|
|
Previously we would load all arches once in the beginning and reuse them
throughout the test suite. With 36 arches with all symbols evaluated and
cached, this used many gigabytes of memory (unless the test suite was
run with pypy). Restructure things so that we only keep one arch loaded
at a time. This adds some reparsing, but it's not a big deal.
Do an ugly piggy-backing of some code cleanup in the test suite (mostly
using un-numbered {} with format()).
|
|
Supported since Python 2.7, which is seven years old, plus it was
already used in a few spots.
Do some minor cleanup in the printing routines at the same time.
Also remove dubious string append performance note, where it's more
about wanting to pass something mutable anyway.
|