handle configparser rename in python3

The ConfigParser module was renamed to configparser, so update the
two modules using it to try both (and default to the new name).

Review-Url: https://codereview.chromium.org/2076653002
changes/90/365990/1
vapier 9 years ago committed by Commit bot
parent d60367ba30
commit 9f343717f1

@ -7,7 +7,6 @@
Includes support for svn, git-svn and git.
"""
import ConfigParser
import fnmatch
import logging
import os
@ -17,6 +16,12 @@ import subprocess
import sys
import tempfile
# The configparser module was renamed in Python 3.
try:
import configparser
except ImportError:
import ConfigParser as configparser
import patch
import scm
import subprocess2
@ -258,7 +263,7 @@ class SvnConfig(object):
self.svn_config_dir = os.path.expanduser(
os.path.join('~', '.subversion'))
svn_config_file = os.path.join(self.svn_config_dir, 'config')
parser = ConfigParser.SafeConfigParser()
parser = configparser.SafeConfigParser()
if os.path.isfile(svn_config_file):
parser.read(svn_config_file)
else:

@ -36,7 +36,6 @@ against by using the '--rev' option.
from __future__ import print_function
import ConfigParser
import cookielib
import errno
import fnmatch
@ -56,6 +55,12 @@ import urlparse
from multiprocessing.pool import ThreadPool
# The configparser module was renamed in Python 3.
try:
import configparser
except ImportError:
import ConfigParser as configparser
# The md5 module was deprecated in Python 2.5.
try:
from hashlib import md5
@ -2241,7 +2246,7 @@ def LoadSubversionAutoProperties():
subversion_config = os.path.expanduser("~/.subversion/config")
if not os.path.exists(subversion_config):
return {}
config = ConfigParser.ConfigParser()
config = configparser.ConfigParser()
config.read(subversion_config)
if (config.has_section("miscellany") and
config.has_option("miscellany", "enable-auto-props") and

Loading…
Cancel
Save