Fixed import of configparser in the distutils module.
If configparser is unavailable, try to import configparser using its old name. This is required for backward-compatibility with older Python versions.
This commit is contained in:
parent
fa40bbf625
commit
eb8cef2664
|
@ -10,11 +10,16 @@ from hashlib import md5
|
|||
import os
|
||||
import socket
|
||||
import platform
|
||||
import ConfigParser
|
||||
import httplib
|
||||
import base64
|
||||
import urlparse
|
||||
import cStringIO as StringIO
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
# For backward-compatibility with Python versions < 2.6.
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
|
||||
class upload(PyPIRCCommand):
|
||||
|
||||
|
|
|
@ -5,7 +5,11 @@ that uses .pypirc in the distutils.command package.
|
|||
"""
|
||||
import os
|
||||
import sys
|
||||
from ConfigParser import ConfigParser
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
# For backward-compatibility with Python versions < 2.6.
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
from distutils.cmd import Command
|
||||
|
||||
|
|
|
@ -358,8 +358,11 @@ Common commands: (see '--help-commands' for more)
|
|||
|
||||
|
||||
def parse_config_files (self, filenames=None):
|
||||
|
||||
from ConfigParser import ConfigParser
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
# For backward-compatibility with Python versions < 2.6.
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
if filenames is None:
|
||||
filenames = self.find_config_files()
|
||||
|
|
Loading…
Reference in New Issue