Update ConfigParser imports for python3
We're starting to run jeepyb under python3 in the new gerrit image.
Change-Id: Ia71cb13f3b45055bbb9a311807fa65a89c8be62a
diff --git a/jeepyb/cmd/close_pull_requests.py b/jeepyb/cmd/close_pull_requests.py
index ad41f41..4ead4ad 100644
--- a/jeepyb/cmd/close_pull_requests.py
+++ b/jeepyb/cmd/close_pull_requests.py
@@ -39,7 +39,7 @@
# oauth_token = GITHUB_OAUTH_TOKEN
import argparse
-import ConfigParser
+from six.moves import configparser
import github
import logging
import os
@@ -87,7 +87,7 @@
GITHUB_SECURE_CONFIG = os.environ.get('GITHUB_SECURE_CONFIG',
'/etc/github/github.secure.config')
- secure_config = ConfigParser.ConfigParser()
+ secure_config = configparser.ConfigParser()
secure_config.read(GITHUB_SECURE_CONFIG)
registry = u.ProjectsRegistry()
diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py
index d97875f..d4362c1 100644
--- a/jeepyb/cmd/manage_projects.py
+++ b/jeepyb/cmd/manage_projects.py
@@ -51,7 +51,7 @@
# project: OTHER_PROJECT_NAME
import argparse
-import ConfigParser
+from six.moves import configparser
import glob
import hashlib
import json
@@ -273,7 +273,7 @@
if not needs_update:
return False
- secure_config = ConfigParser.ConfigParser()
+ secure_config = configparser.ConfigParser()
secure_config.read(github_secure_config)
global orgs
diff --git a/jeepyb/cmd/openstackwatch.py b/jeepyb/cmd/openstackwatch.py
index 47add37..1064fc7 100644
--- a/jeepyb/cmd/openstackwatch.py
+++ b/jeepyb/cmd/openstackwatch.py
@@ -23,7 +23,7 @@
__author__ = "Chmouel Boudjnah <chmouel@chmouel.com>"
-import ConfigParser
+from six.moves import configparser
import cStringIO
import datetime
import json
@@ -63,7 +63,7 @@
ret = {}
if not os.path.exists(inifile):
return
- config = ConfigParser.RawConfigParser(allow_no_value=True)
+ config = configparser.RawConfigParser(allow_no_value=True)
config.read(inifile)
if config.has_section('swift'):
diff --git a/jeepyb/cmd/update_blueprint.py b/jeepyb/cmd/update_blueprint.py
index 97cf6b2..0649dff 100644
--- a/jeepyb/cmd/update_blueprint.py
+++ b/jeepyb/cmd/update_blueprint.py
@@ -18,7 +18,7 @@
# corresponding Launchpad blueprints with links back to the change.
import argparse
-import ConfigParser
+from six.moves import configparser
import os
import re
import StringIO
@@ -55,7 +55,7 @@
text = "%s%s" % (text, line.lstrip())
fp = StringIO.StringIO(text)
- c = ConfigParser.ConfigParser()
+ c = configparser.ConfigParser()
c.readfp(fp)
return c
diff --git a/jeepyb/gerritdb.py b/jeepyb/gerritdb.py
index 79f311a..963f997 100644
--- a/jeepyb/gerritdb.py
+++ b/jeepyb/gerritdb.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import ConfigParser
+from six.moves import configparser
import os
import StringIO
@@ -35,7 +35,7 @@
text += line.lstrip()
fp = StringIO.StringIO(text)
- c = ConfigParser.ConfigParser()
+ c = configparser.ConfigParser()
c.readfp(fp)
return c
diff --git a/jeepyb/projects.py b/jeepyb/projects.py
index 043f7cf..bcf29b2 100644
--- a/jeepyb/projects.py
+++ b/jeepyb/projects.py
@@ -26,7 +26,7 @@
- no-launchpad-blueprints
"""
-import ConfigParser
+from six.moves import configparser
import jeepyb.utils as u
@@ -69,7 +69,7 @@
# ...and if it's not set, then still don't use it.
return False
# It's okay if the global option or even the section for this don't exist.
- except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
+ except (configparser.NoSectionError, configparser.NoOptionError):
pass
# If we got this far, we either explicitly or implicitly default to use it.
return True
diff --git a/jeepyb/utils.py b/jeepyb/utils.py
index 21ae550..2a0efd2 100644
--- a/jeepyb/utils.py
+++ b/jeepyb/utils.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import ConfigParser
+from six.moves import configparser
import logging
import os
import shlex
@@ -196,7 +196,7 @@
self._configs_list = self.yaml_doc[1]
if os.path.exists(PROJECTS_INI):
- self.defaults = ConfigParser.ConfigParser()
+ self.defaults = configparser.ConfigParser()
self.defaults.read(PROJECTS_INI)
else:
try:
diff --git a/tox.ini b/tox.ini
index 925577c..835b4ac 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,6 +5,7 @@
setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
+basepython = python3
[testenv:pep8]
commands = flake8