# Kconfiglib # A Python library for doing stuff with Kconfig-based configuration systems. Can extract information, query and set symbol values, and read and write .config files. Highly compatible with the scripts/kconfig/\*conf utilities in the kernel, usually invoked via make targets such as menuconfig and defconfig. ## Installation ## Installation instructions for the Linux kernel (in the kernel root): $ git clone git://github.com/ulfalizer/Kconfiglib.git $ git am Kconfiglib/makefile.patch (Note: The directory name Kconfiglib/ is significant.) In addition to creating a handy interface, the make targets are needed to pick up environment variables set in the kernel makefiles which are referenced in the Kconfig files (ARCH, SRCARCH, and KERNELVERSION as of Linux 3.7.0). Please tell me if the patch does not apply. It should be trivial to apply manually. ## Documentation ## The (extensive) documentation is generated by running $ pydoc kconfiglib in the Kconfiglib/ directory. For HTML output, use $ pydoc -w kconfiglib ## Examples ## The examples/ directory contains simple example programs that make use of Kconfiglib. See the documentation for how to run them. ## Test suite ## The test suite is run with $ python Kconfiglib/testsuite.py It comprises a set of selftests and a set of compatibility tests that compare configurations generated by Kconfiglib with configurations generated by scripts/kconfig/conf for a number of cases. You might want to use the "speedy" option; see testsuite.py. ## Misc. notes ## Please tell me if you miss some API instead of digging into internals. The internal data structures and APIs, and dependency stuff in particular, are unlikely to be exactly what you want as a user (hence why they're internal :). Patches are welcome too of course. ;) Note: To make the API more consistent and intuitive, some methods have been renamed as follows:
From To
Symbol.calc_value() Symbol.get_value()
Choice.calc_mode() Choice.get_mode()
Symbol.set_value() Symbol.set_user_value()
Choice.get_actual_items() Choice.get_symbols()
Symbol.is_choice_item() Symbol.is_choice_symbol()
Symbol.reset() Symbol.unset_user_value()
Config.reset() Config.unset_user_values()
Menu.get_depends_on_visibility()Menu.get_visibility()
The test suite failures (should be the only ones) for the following Blackfin defconfigs on e.g. Linux 3.7.0-rc8 are due to [a bug in the C implementation](https://lkml.org/lkml/2012/12/5/458): * arch/blackfin/configs/CM-BF537U\_defconfig * arch/blackfin/configs/BF548-EZKIT\_defconfig * arch/blackfin/configs/BF527-EZKIT\_defconfig * arch/blackfin/configs/BF527-EZKIT-V2\_defconfig * arch/blackfin/configs/TCM-BF537\_defconfig ## License (ISC) ## Copyright (c) 2011-2013, Ulf Magnusson Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.