diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-12-14 17:15:57 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-12-14 17:35:45 +0100 |
| commit | c2414bdf64c03470061d280a7d1b5ea97bab3185 (patch) | |
| tree | e7958a9b498b3271f3b27a8ca2cd359d0bd976dd /kconfiglib.py | |
| parent | 595eabcb624d9da1a7bb47365ca4f7a8e76fe44a (diff) | |
Add a member function version of load_allconfig()
There was no great reason for this function to be a global function to
begin with. Having it as a member function simplifies callers.
load_allconfig() is a bit special in that it fails with sys.exit(),
which is helpful for tools, but that probably doesn't influence where it
belongs.
Keep the global function for backwards compatibility. A deprecation
warning might be added at some point.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 700ce7a..6199e8b 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1363,6 +1363,28 @@ class Kconfig(object): elif self.warn_assign_override: self._warn(msg, filename, linenr) + def load_allconfig(self, filename): + """ + Helper for all*config. Loads (merges) the configuration file specified + by KCONFIG_ALLCONFIG, if any. See Documentation/kbuild/kconfig.txt in + the Linux kernel. + + Disables warnings for duplicated assignments within configuration files + for the duration of the call + (kconf.warn_assign_override/warn_assign_redun = False), and restores + the previous warning settings at the end. The KCONFIG_ALLCONFIG + configuration file is expected to override symbols. + + Exits with sys.exit() (which raises a SystemExit exception) and prints + an error to stderr if KCONFIG_ALLCONFIG is set but the configuration + file can't be opened. + + filename: + Command-specific configuration filename - "allyes.config", + "allno.config", etc. + """ + load_allconfig(self, filename) + def write_autoconf(self, filename=None, header=None): r""" Writes out symbol values as a C header file, matching the format used @@ -6184,25 +6206,9 @@ def standard_config_filename(): def load_allconfig(kconf, filename): """ - Helper for all*config. Loads (merges) the configuration file specified by - KCONFIG_ALLCONFIG, if any. See Documentation/kbuild/kconfig.txt in the - Linux kernel. - - Disables warnings for duplicated assignments within configuration files for - the duration of the call (kconf.warn_assign_override/warn_assign_redun = False), - and restores the previous warning settings at the end. The - KCONFIG_ALLCONFIG configuration file is expected to override symbols. - - Exits with sys.exit() (which raises a SystemExit exception) and prints an - error to stderr if KCONFIG_ALLCONFIG is set but the configuration file - can't be opened. - - kconf: - Kconfig instance to load the configuration in. - - filename: - Command-specific configuration filename - "allyes.config", - "allno.config", etc. + Use Kconfig.load_allconfig() instead, which was added in Kconfiglib 13.4.0. + Supported for backwards compatibility. Might be removed at some point after + a long period of deprecation warnings. """ allconfig = os.getenv("KCONFIG_ALLCONFIG") if allconfig is None: |
