Atlas - defconfig.py

Home / ext / kconfiglib Lines: 1 | Size: 1152 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1#!/usr/bin/env python3 2 3# Copyright (c) 2019, Ulf Magnusson 4# SPDX-License-Identifier: ISC 5 6""" 7Reads a specified configuration file, then writes a new configuration file. 8This can be used to initialize the configuration from e.g. an arch-specific 9configuration file. This input configuration file would usually be a minimal 10configuration file, as generated by e.g. savedefconfig. 11 12The default output filename is '.config'. A different filename can be passed in 13the KCONFIG_CONFIG environment variable. 14""" 15import argparse 16 17import kconfiglib 18 19 20def main(): 21 parser = argparse.ArgumentParser( 22 formatter_class=argparse.RawDescriptionHelpFormatter, 23 description=__doc__) 24 25 parser.add_argument( 26 "--kconfig", 27 default="Kconfig", 28 help="Top-level Kconfig file (default: Kconfig)") 29 30 parser.add_argument( 31 "config", 32 metavar="CONFIGURATION", 33 help="Input configuration file") 34 35 args = parser.parse_args() 36 37 kconf = kconfiglib.Kconfig(args.kconfig, suppress_traceback=True) 38 print(kconf.load_config(args.config)) 39 print(kconf.write_config()) 40 41 42if __name__ == "__main__": 43 main() 44
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.