From: Markus Lehtonen Date: Mon, 20 May 2013 08:28:51 +0000 (+0300) Subject: GbpOptionParser: allow using the default 'dest' attribute X-Git-Tag: tizen/0.6.22-20150206~180 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0e102fed98fa8a02ba906d54d0acf4873018cc8;p=tools%2Fgit-buildpackage.git GbpOptionParser: allow using the default 'dest' attribute 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 --- diff --git a/gbp/config.py b/gbp/config.py index 63c11cb..75d35fe 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -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")