| Age | Commit message (Collapse) | Author |
|
- Commit 8a3999b ("Fix $srctree logic for the top-level Kconfig file")
fixes a major braino where the top-level Kconfig file passed to
Kconfig.__init__() wasn't looked up relative to $srctree, breaking
out-of-tree operation for e.g. menuconfig.
All Kconfig files are now consistently looked up relative to
$srctree.
- Misc. internal code cleanup
|
|
Due to a major design braino, the top-level Kconfig file passed to
Kconfig.__init__() wasn't looked up relative to $srctree, breaking
out-of-tree usage for e.g. menuconfig.
With this change, Kconfig files are consistently looked up relative to
$srctree, which makes a lot more sense.
Also remove note re. loading a subset of Kconfig files. Saying that the
top-level file and all source'd Kconfig files are looked up relative to
$srctree should make the behavior clear enough.
|
|
+= also does an in-place modification for lists, and it's a bit faster.
Also get rid of an 'if node.defaults' tests. Both symbols and choices
can have defaults, and it's not worthwhile as an optimization either.
|
|
node.item is already available as 'sym'.
|
|
select_val was only used in a single place, and there's no real harm in
calculating expr_value(self.direct_dep) twice for a warning.
|
|
Kconfiglib changes:
- Commit 1f864b1 ("Support custom printing of symbols/choices in
expressions") adds support for printing symbols and choices with a
custom format in expressions.
This makes it simpler to implement things like like turning all
symbols/choices into links when generating documentation, and
printing symbol values after symbols.
- Commit 6aea8d0 ("Don't pass encoding= to Popen()") fixes an
accidental Python 3.6+ requirement when using the $(shell)
preprocessor function with Python 3.
menuconfig changes:
- Commit 8efc358 ("menuconfig: Omit tristate value hint for
int/string/hex defaults") removes the boolean value hints to the
right of defaults in the symbol information for string/int/hex
symbols. Stuff like '- 74 (value: "n")' isn't helpful, and looks
confusing.
- Commit 3511f24 ("menuconfig: Make symbol information less spammy")
makes the symbol information more compact in general, e.g. by
skipping value hints where they aren't helpful ('FOO(=y)' instead of
'FOO(=y) (=y)'), and by shortening stuff like '(value: "y")' to just
'(=y)'.
|
|
Popen()'s 'encoding' parameter is Python 3.6+ only.
Unfortunately, Popen()'s universal_newlines=True without 'encoding' will
use the encoding from the environment. Do a manual version instead, so
that we can still use the user-specified encoding (usually UTF-8). That
might prevent problems on systems that are (poorly) configured to use
the C locale.
|
|
- *_fn() prefixes on functions are a bit silly. It makes more sense for
the expr_str() parameter, so keep it there.
- Use *_expr_str() instead of just *_str(), to make it clearer that
these deal with expressions.
|
|
- Use '(=value)' instead of '(="value")'
- Use '(=value)' instead of '(value: {})' for various headings, too
- Don't bother showing the value hint for the entire expressions when
it's just a single symbol. The value of the symbol itself is already
shown.
- Only put quotes around the value for string symbols at the top of the
symbol info display
- Deindent expressions split over multiple lines a bit
|
|
Previously, defaults for string/int/hex symbols showed up as e.g.
'17 (value: "n")' in the symbol information, which looks confusing.
Only display the hint for bool/tristate symbols to fix it.
For "non-literal" symbols, _expr_str() still takes care of showing the
value (e.g. 'FOO(="bar")').
|
|
This gets rid of the expr_str() overriding. In addition to being hacky,
it also carried over to warnings, which looked confusing.
Piggyback a code nit. _kconf and kconf no longer clash, so the globals()
hack is no longer needed.
|
|
Allow custom output formats for symbols/choices when turning expressions
into strings, via a user-supplied callback function (sc_str_fn).
This makes things like turning symbols into links in generated
documentation and displaying symbol values in the menuconfig interface
less hacky to implement.
Two new Symbol/Choice.custom_str() functions were added, as passing
extra arguments to __str__() is awkward.
|
|
Needs an initial rm_config() after earlier reorganization.
|
|
This gives a less confusing KconfigError message for syntax errors like
'config $FOO'.
|
|
- b650ccd ("Use universal newlines mode in $(shell) implementation")
improves the behavior of $(shell) on Windows. A trailing \r\n-style
newline sequence is now stripped in full, instead of leaving \r in
there.
- 6899f91 ("Restore compatibility with old kernels") restores some
compatibility with old kernels originally dropped by c19fc11 ("Drop
some compatibility and tighten up lexing").
It turns out that people are still running Kconfiglib on kernels from
at least 2013 (see https://github.com/ulfalizer/Kconfiglib/pull/48).
|
|
Add a small hack to restore compatibility with older (2015-) versions of
the Linux kernel. Weird help tokens like -help- and --help--- are now
accepted again.
Compatibility was originally dropped by commit c19fc11 ("Drop some
compatibility and tighten up lexing"), but it turns that people are
still using Kconfiglib with older kernels.
The new compatibility hack has pretty minimal impact at least.
|
|
This prevents e.g. stray \r's in command output on Windows after
stripping trailing newlines.
|
|
Just adds commit 5452ad3 ("Fix detection of hex literals"). Braino.
Include some int and hex literals in the Kstrict testcase too.
|
|
Missing 'not'. Add some literals to the Kstrict testcase.
|
|
Adds support for automatically warning for references to undefined
Kconfig symbols. See commit ca89d02 ("Add KCONFIG_STRICT flag for
flagging refs. to undefined syms").
(There was an outdated docstring in that comment. KCONFIG_STRICT needs
to be set to "y".)
|
|
Also fix up Kconfig.__init__() docstring to say that KCONFIG_STRICT
needs to be "y".
|
|
Settings KCONFIG_STRICT to y in the environment turns on warnings for
all references to undefined symbols within Kconfig files (with the only
gotcha that hex literals must be prefixed by 0x or 0X, to make it
possible to distinguish them from undefined references).
Always flagging undefined references gets awkward, as some projects
(e.g. the Linux kernel) use multiple Kconfig trees with shared files,
leading to some safe undefined references. It's helpful for other
projects though.
Having KCONFIG_STRICT as an environment variable is handy when multiple
tools are involved.
Piggyback a small README change re. warnings. Kconfiglib now has many
more warnings than the C tools.
|
|
|
|
Get rid of _UNIVERSAL_NEWLINES_MODE ("rU") and just convert "r" into
"rU" instead for Python 2. "r" and "w" are the only modes we need.
Rename _open_enc() to just _open() as well. It handles universal
newlines mode now too.
Piggyback a small note on possibly using 'yield' instead in _tokenize().
|
|
Adds e08b695 ("Add def_int, def_hex, and def_string keywords"), getting
rid of some Kconfig inconsistency.
|
|
Analogous to def_bool and def_tristate, setting the type and adding a
default at the same time.
This is a Kconfiglib extension. These keywords can be useful in projects
that make use of symbols defined in multiple locations, and remove some
Kconfig inconsistency.
|
|
https://github.com/clearlinux-pkgs/python-kconfiglib adds a patch for
this.
It avoids issues on systems that use the C locale, which implies ASCII
encoding and raises UnicodeDecodeError when reading README.rst.
Piggyback adding 'menuconfig' as another keyword.
|
|
All types besides bool and tristate require the argument to be a string.
|
|
|
|
'filename' no longer exists, and full_filename is explained in the
_enter_file() doc-comment.
|
|
Get rid of the 'relpath(..., srctree) -> join(srctree, ...)', which
undid a previous operation. _enter_file() only has a single caller and
is more of a helper function, so it's okay if the interface is a bit
weird.
|
|
source statements now always look relative to $srctree.
|
|
|
|
|
|
This release revamps the globbing design to make 'source' globbing,
requiring at least at least one matching file. A new o(r)source
statement can be used when it's okay for a pattern to not match any
files.
Relevant commit, with motivations: 7a428aa ("Switch to more sensible
globbing statements (w/ backwards compatibility)").
Backwards compatibility is maintained by having g(r)source be an alias
for o(r)source.
A small API change was introduced too: Kconfig.srctree is now set to the
empty string instead of None when $srctree is unset. This gives nice
behavior for e.g. os.path.join().
|
|
Instead of having 'source' and 'gsource', have 'source' always glob, but
require the pattern to match at least one file, throwing KconfigError
otherwise.
Have separate 'osource' and 'orsource' statements (the o is for
"optional") for cases where it's okay for the pattern to not match any
files.
This is analogous to 'include' and '-include' in Make.
The biggest flaw with 'gsource' was that there was no way to do a
globbing match while requiring something to match, possibly leading to
subtle failures.
Preserve backwards compatibility by having "gsource" and "grsource" be
aliases for "osource" and "orsource", respectively.
Also include some related changes:
- Kconfig.srctree is now set to the empty string if $srctree is unset,
rather than to None. This gives nice behavior with os.path.join() and
os.path.relpath(), which treat the empty string as the current
directory (without adding './', for os.path.join()).
- When $srctree is set, Kconfig files in the current directory will no
longer override Kconfig files in $srctree when the relative paths
match. This was likely a bug all along in the C tools, and probably
only makes sense for .config files.
I've seen it cause breakage in Zephyr.
- Clarify the behavior of $srctree in the Kconfig.__init__() docstring.
- Make MenuNode.filename be relative to $srctree for the Kconfig file
passed to Kconfig.__init__(). This makes it consistent.
The major version will be bumped later due to the small Kconfig.srctree
API change.
|
|
Bit easier to read.
|
|
Off-by-one error, though still functional. The recursive source is now
detected immediately as the file is source'd the second time.
Also remove an outdated comment re. KconfigError.
|
|
This release adds commit ac692af ("Fix absolute $srctree prefixes
showing up on gsource'd files"), which fixes a bug that could cause
$srctree to be included in some paths for e.g. generated documentation.
|
|
When using gsource with $srctree set to an absolute path, the $srctree
prefix would show up in MenuNode.filename, trickling its way into e.g.
generated documentation.
This was due to a broken test: os.path.isabs() was checked after joining
the pattern with $srctree, making it mistake an absolute $srctree for an
absolute path in the Kconfig file.
Fix the test.
|
|
This release improves performance for projects that make heavy use of
multiple definition locations for symbols, via commit 747e455
("Massively speed up U-Boot parsing").
Two new warnings are included as well:
- 652d991 ("Warn if int/hex/string symbols are evaluated logically")
- 21b5351 ("Warn if int/hex 'default' is outside active 'range'")
|
|
U-Boot has a ton of definition locations for some symbols, causing a lot
of redundant work when iterating over Kconfig.defined_syms in
_build_dep(). Iterate over set(Kconfig.defined_syms) instead, wherever
possible.
This speeds up the U-Boot parsing time from 4 seconds to 0.6 seconds on
my machine.
Also update the bundled tools to iterate over set(Kconfig.defined_syms).
The performance loss is negligible even for projects that don't use
multiple definition locations.
Update the documentation to clarify that symbols/choices defined in
multiple locations appear multiple times in Kconfig.defined_syms/choices
as well.
|
|
|
|
More environment variables are referenced now.
|
|
|
|
Only out-of-range user values generated warnings before.
The C tools warn for neither of them.
|
|
They always evaluate to n.
Would be nice if there was a trivial way to give the location(s). Just
say "somewhere" for now.
|
|
New features:
- 2433deb ("Add Kconfig preprocessor") implements a new Kconfig
preprocessor, documented in
https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-macro-language.txt.
It is required to parse the linux-next Kconfigs now, and will appear
in Linux 4.18.
'option env=...' symbols and the $FOO syntax for expanding
environment variables will be supported for backwards compatibility
for a while. Consider switching to $(FOO) though, which is the new
syntax (and removing 'option env=...' symbols).
Changed behavior:
- c19fc11 ("Drop some compatibility and tighten up lexing") makes
Kconfiglib flag invalid characters in Kconfig files as a syntax
error in all context. They were previously ignored in some places
for compatibility with old sloppy versions of the C tools.
The C tools fixed it with commit c2264564 ("kconfig: warn of
unhandled characters in Kconfig commands") in July 2015. Older
kernels might require fixing up the Kconfig files a bit now.
New warnings:
- 4200e25 ("Generalize select-with-unsatisfied-deps warning") makes
the select-with-unsatisfied-dependencies warning trigger when a
symbol with m-valued direct dependencies is y-selected.
|
|
Has been removed (and is now always on).
|
|
Implement the Kconfig preprocessor described in
https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-macro-language.txt
(which is now in linux-next and will appear in Linux 4.18).
A new Kconfig.variables property holds all the preprocessor variables so
that they can be inspected programmatically. Preprocessor variables are
represented by a new Variable class.
With the preprocessor, environment variables are referenced with $(FOO)
instead of $FOO. For backwards compatibility, $FOO is accepted as well
for now (and leaves "$FOO" as-is if FOO doesn't exist). The $FOO syntax
might be dropped at some point in the future (together with a major
version increase). It should be supported for a few months at least.
Some internals were cleaned up too, mostly related to parsing. Some
outdated documentation was fixed as well.
|