[oe-commits] [openembedded-core] 23/31: scripts/lib/argparse_oe: simplify options title change

git at git.openembedded.org git at git.openembedded.org
Fri Apr 29 08:24:30 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit f5bb28e2cda7c3ede40087f940afbd96cd33841d
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Wed Apr 27 16:24:00 2016 -0700

    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.
    
    Signed-off-by: Christopher Larson <chris_larson at mentor.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/argparse_oe.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/scripts/lib/argparse_oe.py b/scripts/lib/argparse_oe.py
index 75002d0..2185a66 100644
--- a/scripts/lib/argparse_oe.py
+++ b/scripts/lib/argparse_oe.py
@@ -14,6 +14,7 @@ class ArgumentParser(argparse.ArgumentParser):
         kwargs.setdefault('formatter_class', OeHelpFormatter)
         self._subparser_groups = OrderedDict()
         super(ArgumentParser, self).__init__(*args, **kwargs)
+        self._optionals.title = 'options'
 
     def error(self, message):
         """error(message: string)
@@ -93,10 +94,6 @@ class ArgumentSubParser(ArgumentParser):
         if 'order' in kwargs:
             self._order = kwargs.pop('order')
         super(ArgumentSubParser, self).__init__(*args, **kwargs)
-        for agroup in self._action_groups:
-            if agroup.title == 'optional arguments':
-                agroup.title = 'options'
-                break
 
     def parse_known_args(self, args=None, namespace=None):
         # This works around argparse not handling optional positional arguments being

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list