summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-03-26Use expr_str() to print selected/implied symbolsUlf Magnusson
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.
2018-03-26Refactor expr_str() casesUlf Magnusson
- 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
2018-03-25merge_config.py: Clean up name_and_loc_str()Ulf Magnusson
- Rename to name_and_loc(), to be consistent with the kconfiglib.py version - Use a comment instead of a docstring. Shorten the description a bit too. - Piggyback a missing # in conf3 in the module docstring. Typo.
2018-03-24Warn if a choice symbol is selected or impliedUlf Magnusson
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.
2018-03-24_check_choice_sanity() style nitUlf Magnusson
2018-03-24Rename _name_and_loc_str() to _name_and_loc()Ulf Magnusson
Bit shorter, still clear in context.
2018-03-24Refactor _warn_select_unsatisfied_deps()Ulf Magnusson
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.
2018-03-24Remove redundant int/hex user value 'is None' checkUlf Magnusson
A valid int/hex user value can never be an empty string, so they test can be simplified.
2018-03-23testsuite.py: Remove redundant enable_warnings() callUlf Magnusson
The Kconfig object is replaced immediately after it.
2018-03-23Warn if user (.config) value is outside of 'range'Ulf Magnusson
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.
2018-03-22Remove redundant int/hex user value validity checkUlf Magnusson
set_value() already rejects invalid int/hex values, so there's no need to check the value in str_value().
2018-03-20Add kconfig.py from Zephyr as a real-world exampleUlf Magnusson
2018-03-20Use iglob() rather than glob()Ulf Magnusson
No need to create a list. glob() just does list(iglob()) internally as well.
2018-03-20Get rid of local 'prompt' variableUlf Magnusson
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.
2018-03-20Add parent deps to the right in _T_IFUlf Magnusson
Consistent with how dependencies are propagated elsewhere. Get rid of the 'parent_dep' variable too.
2018-03-20_parse_properties() nitUlf Magnusson
2018-03-20Clean up some parent dependency conditionalsUlf Magnusson
2018-03-20Reorder _parse_block() parametersUlf Magnusson
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.
2018-03-19Clean up _int_hex_value_is_sane()Ulf Magnusson
- Restructure the test. - Call the function _int_hex_ok() instead. Bit less spammy. Also add a doc-comment to explain it.
2018-03-19Clean up _expr_depends_on() a bitUlf Magnusson
'left' is guaranteed to be 'sym' if the preceding conditional was true.
2018-03-19Simplify _has_auto_menu_dep()Ulf Magnusson
Also rename it to _auto_menu_dep().
2018-03-19Remove empty prompt text check in _flatten()Ulf Magnusson
Originally taken from the C implementation, but seems pointless. The only way to get an empty prompt text is to explicitly define a symbol with e.g. 'prompt ""'.
2018-03-18Add print_config_tree.py example script (#42)Ricardo F
Works like menuconfig.py, but just dumps the tree, with a specified .config file as base. Handy for diffing.
2018-03-17Make 4.1.0 releasev4.1.0Ulf Magnusson
Only adds daac69d ("Add a globbing source statement"). 'gource' doubles as an include-if-exists function.
2018-03-17Remove TILE architecture from test suiteUlf Magnusson
Removed in linux-next.
2018-03-16Link to pymenuconfigUlf Magnusson
A menuconfig implementation built on top of Kconfiglib using TkInter.
2018-03-13Test grsource with nonexistent fileUlf Magnusson
Just for completeness.
2018-03-13Mention rsource and gsource in READMEUlf Magnusson
2018-03-13Add a globbing source statementUlf Magnusson
'gsource' works like 'source', but takes a glob pattern and sources all matching files. Works as a no-op if no files match, and hence doubles as an include-if-exists function, similar to '-include' in 'make'. Add a 'grsource' statement as well, mirroring 'rsource'. Came up in https://github.com/ulfalizer/Kconfiglib/pull/40.
2018-03-11Fix broken formattingUlf Magnusson
2018-03-11Make 4.0.0 releasev4.0.0Ulf Magnusson
Includes a small API behavior change, hence the major version bump: - db63301 ("Return "" for unwritten symbols in Symbol.config_string") New features: - Support for incremental builds using the same scheme as the include/config/ directory in the C tools. See the new Kconfig.sync_deps() function and commit 378dedc ("Add support for incremental builds"). - Minimal configuration (defconfig) writing, generating identical files to the C implementation. See commit 652f11b ("Add minimal configuration file generation support"). The C 'make savedefconfig' implementation is currently broken in obscure cases involving tristate choices (due to broken invalidation code), so the tests are disabled for now. I have a patch for the C implementation that I will submit. Fixes: - user_value wasn't set for choice symbols set to y via load_config() with replace=True. Fixed by commit 0bd841d ("Properly remember y user values for choice symbols"). Didn't affect correctness, only the API. Other changes: - 778ec47 ("Only write '# CONFIG_FOO is not set' for visible symbols") mirrors a change I made to the C tools. - bbe3ae9 ("Do not write the defconfig_list symbol to .config") mirrors another change made to the C tools. - Misc. refactoring and cleanup.
2018-03-11Add minimal configuration file generation supportUlf Magnusson
Works like 'make savedefconfig' in the C tools. Call it write_min_config() rather than write_defconfig() to be a bit more explicit. Add a test similar to test_defconfig that compares Kconfiglib minimal configuration output against the C implementation, for all defconfig files. Disable the tests for now. The C tools have a bug that causes an incorrect configuration to be generated for tristate choices in some cases. They will be re-enabled once those are fixed.
2018-03-11Properly remember y user values for choice symbolsUlf Magnusson
Commit e8b4ecb ("Don't special-case user_value for choice symbols set to y") was meant to make user_value reflect an y value assigned to a choice symbol, but didn't get it right for load_config() with replace=True: The user value was set at first, but was then unset again due to a misplaced '_was_set = True' assignment. This commit makes y choice symbol user values always be remembered. The correctness of generated files was not affected, since the user selection of a choice is actually remembered as Choice.user_selection. The previous commit just turned into a no-op for load_config() with replace=True.
2018-03-10testsuite.py: Break out a defconfig_files() helperUlf Magnusson
defconfig_files() yields all the defconfig files for a particular arch/ subdirectory. This will allow reuse when savedefconfig is tested. Also simplify the code a bit.
2018-03-09testsuite.py: Don't count defconfig filesUlf Magnusson
Not that important of a stat, plus there might be more tests that process defconfig files soon, making it kinda meaningless.
2018-03-06Simplify test suite loggingUlf Magnusson
No great need to log timestamps anymore.
2018-03-06Avoid shadowing test_defconfig() 'srcarch' parameterUlf Magnusson
The 'for' overrode 'srcarch', which is currently harmless, but ugly.
2018-03-06testsuite.py: Use 'srcarch' instead of '_arch' in test_defconfig()Ulf Magnusson
Makes sense as SRCARCH holds the arch/ subdirectory and _arch might be confused for ARCH.
2018-03-06testsuite.py: Refactor run_compatibility_tests()Ulf Magnusson
Get rid of the compare_configs flag and just do the comparison from the test functions themselves with a helper. Also get rid of the test_load() test. That's indirectly tested through the other tests, and test_alldefconfig() runs first and is speedy.
2018-03-05Use comments instead of docstrings for internal functionsUlf Magnusson
The original idea was that it might be handy to look up docstrings for internal functions from the Python prompt (or an IDE) while figuring out the code. Not sure it's that useful in practice though. Comments shorten the code a bit, and might make it clearer at a glance that the function is internal.
2018-03-05Move 'val' initialization a bit later in tri_value()Ulf Magnusson
Makes it harder to miss.
2018-03-05Remove _get_* prefix from internal worker functionsUlf Magnusson
The _get_* prefixes don't improve readability and are inconsistent: All other getters are simply named after the thing they fetch. Leftover from Kconfiglib 1.
2018-03-05Fix defconfig_list-related comment typoUlf Magnusson
s/the defconfig_list/the defconfig_list symbol/
2018-03-05Do not write the defconfig_list symbol to .configUlf Magnusson
Mirrors the following change to the C tools, now in linux-next: commit c21a6e352766005d42c1ccae32b31e0438903eb9 Author: Masahiro Yamada <yamada.masahiro@socionext.com> Date: Sat Feb 17 03:38:32 2018 +0900 kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list The 'defconfig_list' is a weird attribute. If the '.config' is missing, conf_read_simple() iterates over all visible defaults, then it uses the first one for which fopen() succeeds. config DEFCONFIG_LIST string depends on !UML option defconfig_list default "/lib/modules/$UNAME_RELEASE/.config" default "/etc/kernel-config" default "/boot/config-$UNAME_RELEASE" default "$ARCH_DEFCONFIG" default "arch/$ARCH/defconfig" However, like other symbols, the first visible default is always written out to the .config file. This might be different from what has been actually used. For example, on my machine, the third one "/boot/config-$UNAME_RELEASE" is opened, like follows: $ rm .config $ make oldconfig 2>/dev/null scripts/kconfig/conf --oldconfig Kconfig # # using defaults found in /boot/config-4.4.0-112-generic # * * Restart config... * * * IRQ subsystem * Expose irq internals in debugfs (GENERIC_IRQ_DEBUGFS) [N/y/?] (NEW) However, the resulted .config file contains the first one since it is visible: $ grep CONFIG_DEFCONFIG_LIST .config CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" In order to stop confusing people, prevent this CONFIG option from being written to the .config file. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-03-05Simplify sync_deps() value testsUlf Magnusson
Use the result from the initial str_value call in more places. Also add a comment to make it clear how _write_to_conf is calculated, mirroring the ones in write_config() and write_autoconf().
2018-03-03_write_old_vals() consistency nitUlf Magnusson
2018-03-03Simplify initial auto.conf setupUlf Magnusson
Instead of creating an empty initial auto.conf and immediately loading it, look for a missing auto.conf in _load_old_vals() and treat that the same as an empty auto.conf (by returning after clearing the old values). The initial auto.conf will then be written as normal by _write_old_vals(). Also flesh out the sync_deps() docstring a bit: - Make it clear that sync_deps() should be run at each build - Be more explicit about what it means for a symbol to have changed (different output in autoconf.h)
2018-03-03Accept existing directory with no auto.conf in sync_deps()Ulf Magnusson
An initial empty auto.conf will be created, just as when sync_deps() creates the directory. This is more flexible. There's no good reason to require the directory to be created by sync_deps().
2018-03-01Simplify _parse_factor() error handlingUlf Magnusson
"malformed expression" should be clear enough for a missing end parenthesis too. Expressions are generally short.
2018-03-01Give .config location in invalid bool/tristate value warningUlf Magnusson
Oversight