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:
Alexandre Vassalotti 2008-05-16 02:06:59 +00:00
parent fa40bbf625
commit eb8cef2664
3 changed files with 16 additions and 4 deletions

View File

@ -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):

View File

@ -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

View File

@ -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()