diff options
author | Christopher Larson <chris_larson@mentor.com> | 2016-04-27 16:24:00 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-06 10:31:13 +0100 |
commit | 09cbec8947a056e196209d177ac4c22c32699393 (patch) | |
tree | 1127e5a00b5becce4cfdbea0100ea17ce836a7a0 /scripts/lib/argparse_oe.py | |
parent | 3e79d54523e348258cc7d9455376429ea57106f2 (diff) | |
download | poky-09cbec8947a056e196209d177ac4c22c32699393.tar.gz |
scripts/lib/argparse_oe: simplify options title change
There's no need to iterate over the action groups here, as self._optionals and
self._positionals are available.
(From OE-Core rev: 408694f4320f3cb52a391e5b927fb8c8ba16c1d2)
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/argparse_oe.py')
-rw-r--r-- | scripts/lib/argparse_oe.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/scripts/lib/argparse_oe.py b/scripts/lib/argparse_oe.py index 75002d02af..2185a66cd8 100644 --- a/scripts/lib/argparse_oe.py +++ b/scripts/lib/argparse_oe.py | |||
@@ -14,6 +14,7 @@ class ArgumentParser(argparse.ArgumentParser): | |||
14 | kwargs.setdefault('formatter_class', OeHelpFormatter) | 14 | kwargs.setdefault('formatter_class', OeHelpFormatter) |
15 | self._subparser_groups = OrderedDict() | 15 | self._subparser_groups = OrderedDict() |
16 | super(ArgumentParser, self).__init__(*args, **kwargs) | 16 | super(ArgumentParser, self).__init__(*args, **kwargs) |
17 | self._optionals.title = 'options' | ||
17 | 18 | ||
18 | def error(self, message): | 19 | def error(self, message): |
19 | """error(message: string) | 20 | """error(message: string) |
@@ -93,10 +94,6 @@ class ArgumentSubParser(ArgumentParser): | |||
93 | if 'order' in kwargs: | 94 | if 'order' in kwargs: |
94 | self._order = kwargs.pop('order') | 95 | self._order = kwargs.pop('order') |
95 | super(ArgumentSubParser, self).__init__(*args, **kwargs) | 96 | super(ArgumentSubParser, self).__init__(*args, **kwargs) |
96 | for agroup in self._action_groups: | ||
97 | if agroup.title == 'optional arguments': | ||
98 | agroup.title = 'options' | ||
99 | break | ||
100 | 97 | ||
101 | def parse_known_args(self, args=None, namespace=None): | 98 | def parse_known_args(self, args=None, namespace=None): |
102 | # This works around argparse not handling optional positional arguments being | 99 | # This works around argparse not handling optional positional arguments being |