GbpOptionParser: allow using the default 'dest' attribute
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Mon, 20 May 2013 08:28:51 +0000 (11:28 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 14 Nov 2014 12:22:04 +0000 (14:22 +0200)
Make it possible to add options without explicitly defining the 'dest'
attribute - in which case the default of OptionParser is used.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/config.py

index 63c11cb..75d35fe 100644 (file)
@@ -462,23 +462,21 @@ class GbpOptionParser(OptionParser):
         return default
 
     @safe_option
-    def add_config_file_option(self, option_name, dest, help=None, **kwargs):
+    def add_config_file_option(self, option_name, help=None, **kwargs):
         """
         set a option for the command line parser, the default is read from the config file
         param option_name: name of the option
         type option_name: string
-        param dest: where to store this option
-        type dest: string
         param help: help text
         type help: string
         """
         if not help:
             help = self.help[option_name]
-        OptionParser.add_option(self, "--%s%s" % (self.prefix, option_name), dest=dest,
+        OptionParser.add_option(self, "--%s%s" % (self.prefix, option_name),
                                 default=self.get_default(option_name, **kwargs),
                                 help=help % self.config, **kwargs)
 
-    def add_boolean_config_file_option(self, option_name, dest):
+    def add_boolean_config_file_option(self, option_name, dest=None):
         self.add_config_file_option(option_name=option_name, dest=dest, action="store_true")
         neg_help = "negates '--%s%s'" % (self.prefix, option_name)
         self.add_config_file_option(option_name="no-%s" % option_name, dest=dest, help=neg_help, action="store_false")