diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-02-23 16:00:50 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2015-02-25 16:10:30 +0100 |
commit | e07aaba55f47c8cbe0107c324b13ee1848fc4049 (patch) | |
tree | 6bc9703cb2a95c5a7af7fd8845427b44c9ee1fd6 | |
parent | 17c7615e4847ed238652ee83222bf7524c6512dd (diff) |
config: modify configparser import statement
Usage of six.moves.configparser in the previous way failed at least with
some versions of python-six (e.g. 1.4.1) like
> >>> from six.moves.configparser import SafeConfigParser
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named configparser
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | gbp/config.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gbp/config.py b/gbp/config.py index cc46cf7..dd8905d 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -17,7 +17,7 @@ """handles command line and config file option parsing for the gbp commands""" from optparse import OptionParser, OptionGroup, Option, OptionValueError -from six.moves.configparser import SafeConfigParser, NoSectionError +from six.moves import configparser from copy import copy import os.path @@ -368,7 +368,7 @@ class GbpOptionParser(OptionParser): Parse the possible config files and set appropriate values default values """ - parser = SafeConfigParser() + parser = configparser.SafeConfigParser() # Fill in the built in values self.config = dict(self.__class__.defaults) # Update with the values from the defaults section. This is needed @@ -412,8 +412,8 @@ class GbpOptionParser(OptionParser): if parser.has_section(section): self.config.update(dict(parser._sections[section].items())) else: - raise NoSectionError("Mandatory section [%s] does not exist." - % section) + raise configparser.NoSectionError( + "Mandatory section [%s] does not exist." % section) # filter can be either a list or a string, always build a list: if self.config['filter']: |