From 06309e301b0008605c4f2c5ad1d3a07276e3865c Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 7 Aug 2013 02:05:18 +0200 Subject: Add Symbol and Choice interfaces for getting prompt strings. --- kconfiglib.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 0704cc0..743d48f 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2495,6 +2495,16 @@ class Symbol(Item, _HasVisibility): """Returns the name of the symbol.""" return self.name + def get_prompts(self): + """Returns a list of prompts defined for the symbol, in the order they + appear in the configuration files. Returns the empty list for symbols + with no prompt. + + This list will have a single entry for the vast majority of symbols + having prompts, but having multiple prompts for a single symbol is + possible through having multiple 'config' entries for it.""" + return [prompt for prompt, _ in self.orig_prompts] + def get_upper_bound(self): """For string/hex/int symbols and for bool and tristate symbols that cannot be modified (see is_modifiable()), returns None. @@ -3230,6 +3240,17 @@ class Choice(Item, _HasVisibility): as of Linux 3.7.0-rc8.""" return self.name + def get_prompts(self): + """Returns a list of prompts defined for the choice, in the order they + appear in the configuration files. Returns the empty list for choices + with no prompt. + + This list will have a single entry for the vast majority of choices + having prompts, but having multiple prompts for a single choice is + possible through having multiple 'choice' entries for it (though I'm + not sure if that ever happens in practice).""" + return [prompt for prompt, _ in self.orig_prompts] + def get_help(self): """Returns the help text of the choice, or None if the choice has no help text.""" -- cgit v1.2.3