diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-01-12 15:40:42 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-02-13 18:54:16 +0100 |
commit | bca9f76135c5b4975b261018f0c9013243f38846 (patch) | |
tree | 9047069f7ac0c33ae3e920412d2c489f28fe3e01 /gbp/config.py | |
parent | 24e772577b071cb4297a5ed4b807aab334027144 (diff) |
Refactor config.py as preparation for rpm support.
Split GbpOptionParser in to a common base class and a Debian
specific subclass, as a preparation for upcoming RPM support.
This allows having different default values (and help texts) for common
options between different package types, and, clearer separation of
package type specific options.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Diffstat (limited to 'gbp/config.py')
-rw-r--r-- | gbp/config.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gbp/config.py b/gbp/config.py index e857b3e..87334f0 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -51,7 +51,7 @@ class GbpOption(Option): TYPE_CHECKER['path'] = expand_path TYPE_CHECKER['tristate'] = check_tristate -class GbpOptionParser(OptionParser): +class GbpOptionParserCommon(OptionParser): """ Handles commandline options and parsing of config files @ivar command: the gbp command we store the options for @@ -68,9 +68,7 @@ class GbpOptionParser(OptionParser): @cvar config_files: list of config files we parse @type config_files: list """ - defaults = { 'builder' : 'debuild -i -I', - 'cleaner' : 'debuild -d clean', - 'debian-branch' : 'master', + defaults = { 'debian-branch' : 'master', 'upstream-branch' : 'upstream', 'upstream-tree' : 'TAG', 'pristine-tar' : 'False', @@ -327,4 +325,15 @@ class GbpOptionGroup(OptionGroup): neg_help = "negates '--%s%s'" % (self.parser.prefix, option_name) self.add_config_file_option(option_name="no-%s" % option_name, dest=dest, help=neg_help, action="store_false") + +class GbpOptionParserDebian(GbpOptionParserCommon): + """ + Handles commandline options and parsing of config files for Debian tools + """ + defaults = dict(GbpOptionParserCommon.defaults) + defaults.update( { + 'builder' : 'debuild -i -I', + 'cleaner' : 'debuild -d clean', + } ) + # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: |