Commit ca4321bb authored by Jason R. Coombs's avatar Jason R. Coombs

Use the modern name for the configparser module

parent 477fef2d
......@@ -1402,7 +1402,7 @@ def expand_paths(inputs):
def extract_wininst_cfg(dist_filename):
"""Extract configuration data from a bdist_wininst .exe
Returns a ConfigParser.RawConfigParser, or None
Returns a configparser.RawConfigParser, or None
"""
f = open(dist_filename, 'rb')
try:
......@@ -1415,7 +1415,7 @@ def extract_wininst_cfg(dist_filename):
return None
f.seek(prepended - 12)
from setuptools.compat import StringIO, ConfigParser
from setuptools.compat import StringIO, configparser
import struct
tag, cfglen, bmlen = struct.unpack("<iii", f.read(12))
......@@ -1423,7 +1423,7 @@ def extract_wininst_cfg(dist_filename):
return None # not a valid tag
f.seek(prepended - (12 + cfglen))
cfg = ConfigParser.RawConfigParser(
cfg = configparser.RawConfigParser(
{'version': '', 'target_version': ''})
try:
part = f.read(cfglen)
......@@ -1433,7 +1433,7 @@ def extract_wininst_cfg(dist_filename):
# be text, so decode it.
config = config.decode(sys.getfilesystemencoding())
cfg.readfp(StringIO(config))
except ConfigParser.Error:
except configparser.Error:
return None
if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
return None
......
......@@ -37,10 +37,10 @@ def edit_config(filename, settings, dry_run=False):
while a dictionary lists settings to be changed or deleted in that section.
A setting of ``None`` means to delete that setting.
"""
from setuptools.compat import ConfigParser
from setuptools.compat import configparser
log.debug("Reading configuration from %s", filename)
opts = ConfigParser.RawConfigParser()
opts = configparser.RawConfigParser()
opts.read([filename])
for section, options in settings.items():
if options is None:
......
......@@ -7,7 +7,7 @@ PY2 = not PY3
if PY2:
basestring = basestring
import __builtin__ as builtins
import ConfigParser
import ConfigParser as configparser
from StringIO import StringIO
BytesIO = StringIO
func_code = lambda o: o.func_code
......@@ -38,7 +38,7 @@ if PY2:
if PY3:
basestring = str
import builtins
import configparser as ConfigParser
import configparser
from io import StringIO, BytesIO
func_code = lambda o: o.__code__
func_globals = lambda o: o.__globals__
......
......@@ -20,7 +20,7 @@ from distutils.errors import DistutilsError
from setuptools.compat import (
urllib2, httplib, StringIO, HTTPError, urlparse, urlunparse, unquote,
splituser, url2pathname, name2codepoint, unichr, urljoin, urlsplit,
urlunsplit, ConfigParser, filter, map,
urlunsplit, configparser, filter, map,
)
from setuptools.compat import filterfalse
from fnmatch import translate
......@@ -945,14 +945,14 @@ class Credential(object):
def __str__(self):
return '%(username)s:%(password)s' % vars(self)
class PyPIConfig(ConfigParser.ConfigParser):
class PyPIConfig(configparser.ConfigParser):
def __init__(self):
"""
Load from ~/.pypirc
"""
defaults = dict.fromkeys(['username', 'password', 'repository'], '')
ConfigParser.ConfigParser.__init__(self, defaults)
configparser.ConfigParser.__init__(self, defaults)
rc = os.path.join(os.path.expanduser('~'), '.pypirc')
if os.path.exists(rc):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment