summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-05-16 02:06:59 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-05-16 02:06:59 (GMT)
commiteb8cef26648d7d443a5570a2e653d9d07c284c42 (patch)
tree7dd5905787f5c53675e55422a999b54ccd51bfde /Lib/distutils
parentfa40bbf6252d224fb479d051d236edf6a79a0c8d (diff)
downloadcpython-eb8cef26648d7d443a5570a2e653d9d07c284c42.zip
cpython-eb8cef26648d7d443a5570a2e653d9d07c284c42.tar.gz
cpython-eb8cef26648d7d443a5570a2e653d9d07c284c42.tar.bz2
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.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/command/upload.py7
-rw-r--r--Lib/distutils/config.py6
-rw-r--r--Lib/distutils/dist.py7
3 files changed, 16 insertions, 4 deletions
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index daf6811..92c4bf2 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -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):
diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py
index f1117be..35a21ec 100644
--- a/Lib/distutils/config.py
+++ b/Lib/distutils/config.py
@@ -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
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index 0b13c1e..6299919 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -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()