[git-buildpackage] [PATCH] config: modify configparser import statement

Markus Lehtonen markus.lehtonen at linux.intel.com
Mon Feb 23 16:11:04 CET 2015


Usage of six.moves.configparser in the previous way failed at least with
some versions of python and python-six.

Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
---
 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']:
-- 
1.8.4.5



More information about the git-buildpackage mailing list