Update ConfigParser imports for python3

We're starting to run jeepyb under python3 in the new gerrit image.

Change-Id: Ia71cb13f3b45055bbb9a311807fa65a89c8be62a
This commit is contained in:
Monty Taylor 2020-03-21 16:09:11 -05:00
parent 2bb53ddb7f
commit 20808ddc5d
8 changed files with 15 additions and 14 deletions

View File

@ -39,7 +39,7 @@
# oauth_token = GITHUB_OAUTH_TOKEN # oauth_token = GITHUB_OAUTH_TOKEN
import argparse import argparse
import ConfigParser from six.moves import configparser
import github import github
import logging import logging
import os import os
@ -87,7 +87,7 @@ def main():
GITHUB_SECURE_CONFIG = os.environ.get('GITHUB_SECURE_CONFIG', GITHUB_SECURE_CONFIG = os.environ.get('GITHUB_SECURE_CONFIG',
'/etc/github/github.secure.config') '/etc/github/github.secure.config')
secure_config = ConfigParser.ConfigParser() secure_config = configparser.ConfigParser()
secure_config.read(GITHUB_SECURE_CONFIG) secure_config.read(GITHUB_SECURE_CONFIG)
registry = u.ProjectsRegistry() registry = u.ProjectsRegistry()

View File

@ -51,7 +51,7 @@
# project: OTHER_PROJECT_NAME # project: OTHER_PROJECT_NAME
import argparse import argparse
import ConfigParser from six.moves import configparser
import glob import glob
import hashlib import hashlib
import json import json
@ -273,7 +273,7 @@ def create_update_github_project(
if not needs_update: if not needs_update:
return False return False
secure_config = ConfigParser.ConfigParser() secure_config = configparser.ConfigParser()
secure_config.read(github_secure_config) secure_config.read(github_secure_config)
global orgs global orgs

View File

@ -23,7 +23,7 @@ from __future__ import print_function
__author__ = "Chmouel Boudjnah <chmouel@chmouel.com>" __author__ = "Chmouel Boudjnah <chmouel@chmouel.com>"
import ConfigParser from six.moves import configparser
import cStringIO import cStringIO
import datetime import datetime
import json import json
@ -63,7 +63,7 @@ def parse_ini(inifile):
ret = {} ret = {}
if not os.path.exists(inifile): if not os.path.exists(inifile):
return return
config = ConfigParser.RawConfigParser(allow_no_value=True) config = configparser.RawConfigParser(allow_no_value=True)
config.read(inifile) config.read(inifile)
if config.has_section('swift'): if config.has_section('swift'):

View File

@ -18,7 +18,7 @@
# corresponding Launchpad blueprints with links back to the change. # corresponding Launchpad blueprints with links back to the change.
import argparse import argparse
import ConfigParser from six.moves import configparser
import os import os
import re import re
import StringIO import StringIO
@ -55,7 +55,7 @@ def get_broken_config(filename):
text = "%s%s" % (text, line.lstrip()) text = "%s%s" % (text, line.lstrip())
fp = StringIO.StringIO(text) fp = StringIO.StringIO(text)
c = ConfigParser.ConfigParser() c = configparser.ConfigParser()
c.readfp(fp) c.readfp(fp)
return c return c

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import ConfigParser from six.moves import configparser
import os import os
import StringIO import StringIO
@ -35,7 +35,7 @@ def get_broken_config(filename):
text += line.lstrip() text += line.lstrip()
fp = StringIO.StringIO(text) fp = StringIO.StringIO(text)
c = ConfigParser.ConfigParser() c = configparser.ConfigParser()
c.readfp(fp) c.readfp(fp)
return c return c

View File

@ -26,7 +26,7 @@ Expected review.projects.yaml format:
- no-launchpad-blueprints - no-launchpad-blueprints
""" """
import ConfigParser from six.moves import configparser
import jeepyb.utils as u import jeepyb.utils as u
@ -69,7 +69,7 @@ def has_github(project_full_name):
# ...and if it's not set, then still don't use it. # ...and if it's not set, then still don't use it.
return False return False
# It's okay if the global option or even the section for this don't exist. # 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 pass
# If we got this far, we either explicitly or implicitly default to use it. # If we got this far, we either explicitly or implicitly default to use it.
return True return True

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import ConfigParser from six.moves import configparser
import logging import logging
import os import os
import shlex import shlex
@ -196,7 +196,7 @@ class ProjectsRegistry(object):
self._configs_list = self.yaml_doc[1] self._configs_list = self.yaml_doc[1]
if os.path.exists(PROJECTS_INI): if os.path.exists(PROJECTS_INI):
self.defaults = ConfigParser.ConfigParser() self.defaults = configparser.ConfigParser()
self.defaults.read(PROJECTS_INI) self.defaults.read(PROJECTS_INI)
else: else:
try: try:

View File

@ -5,6 +5,7 @@ envlist = pep8
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
basepython = python3
[testenv:pep8] [testenv:pep8]
commands = flake8 commands = flake8