From 69ec4ed519586a033b09f18eee3ff20870ca9b57 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 4 Jul 2019 20:34:20 +0200 Subject: Rename _warn_no_prompt to _warn_assign_no_prompt Makes it consistent with the other warn_assign_* variables. Also move the initialization in Kconfig.__init__() next to the other warn_assign_* variables. --- kconfiglib.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index d5d0282..efba5df 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -795,7 +795,7 @@ class Kconfig(object): "_set_match", "_srctree_prefix", "_unset_match", - "_warn_no_prompt", + "_warn_assign_no_prompt", "choices", "comments", "config_prefix", @@ -928,7 +928,9 @@ class Kconfig(object): self.warn = warn self.warn_to_stderr = warn_to_stderr self.warn_assign_undef = os.getenv("KCONFIG_WARN_UNDEF_ASSIGN") == "y" - self.warn_assign_override = self.warn_assign_redun = True + self.warn_assign_override = True + self.warn_assign_redun = True + self._warn_assign_no_prompt = True self._encoding = encoding @@ -1080,8 +1082,6 @@ class Kconfig(object): self._add_choice_deps() - self._warn_no_prompt = True - self.mainmenu_text = self.top_node.prompt[0] @property @@ -1185,15 +1185,16 @@ class Kconfig(object): # Disable the warning about assigning to symbols without prompts. This # is normal and expected within a .config file. - self._warn_no_prompt = False + self._warn_assign_no_prompt = False - # This stub only exists to make sure _warn_no_prompt gets reenabled + # This stub only exists to make sure _warn_assign_no_prompt gets + # reenabled try: self._load_config(filename, replace) except UnicodeDecodeError as e: _decoding_error(e, filename) finally: - self._warn_no_prompt = True + self._warn_assign_no_prompt = True return ("Loaded" if replace else "Merged") + msg @@ -1894,7 +1895,7 @@ class Kconfig(object): Removes any user values from all symbols, as if Kconfig.load_config() or Symbol.set_value() had never been called. """ - self._warn_no_prompt = False + self._warn_assign_no_prompt = False try: # set_value() already rejects undefined symbols, and they don't # need to be invalidated (because their value never changes), so we @@ -1905,7 +1906,7 @@ class Kconfig(object): for choice in self.unique_choices: choice.unset_value() finally: - self._warn_no_prompt = True + self._warn_assign_no_prompt = True def enable_warnings(self): """ @@ -4785,7 +4786,7 @@ class Symbol(object): self._rec_invalidate() return - if self.kconfig._warn_no_prompt: + if self.kconfig._warn_assign_no_prompt: self.kconfig._warn(_name_and_loc(self) + " has no prompt, meaning " "user values have no effect on it") -- cgit v1.2.3