xref: /optee_os/scripts/kconfig/kconfiglib/olddefconfig.py (revision c689edbb2550c76ae81dcecab717d82a564b2d7b)
1#!/usr/bin/env python3
2
3# Copyright (c) 2018-2019, Ulf Magnusson
4# SPDX-License-Identifier: ISC
5
6"""
7Updates an old .config file or creates a new one, by filling in default values
8for all new symbols. This is the same as picking the default selection for all
9symbols in oldconfig, or entering the menuconfig interface and immediately
10saving.
11
12The default input/output filename is '.config'. A different filename can be
13passed in the KCONFIG_CONFIG environment variable.
14
15When overwriting a configuration file, the old version is saved to
16<filename>.old (e.g. .config.old).
17"""
18import kconfiglib
19
20
21def main():
22    kconf = kconfiglib.standard_kconfig(__doc__)
23    print(kconf.load_config())
24    print(kconf.write_config())
25
26
27if __name__ == "__main__":
28    main()
29