From e07aaba55f47c8cbe0107c324b13ee1848fc4049 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 23 Feb 2015 16:00:50 +0200 Subject: 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 "", line 1, in > ImportError: No module named configparser Signed-off-by: Markus Lehtonen --- gbp/config.py | 8 ++++---- 1 file 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']: -- cgit v1.2.3