Commit eb8cef26 authored by Alexandre Vassalotti's avatar Alexandre Vassalotti

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.
parent fa40bbf6
......@@ -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()
......
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