summaryrefslogtreecommitdiff
path: root/Lib/distutils
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-12-22 19:37:17 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2013-12-22 19:37:17 +0100
commite62a40401ddfd45ca70d4971e9ad05d4af4f6d78 (patch)
treeb76920ec17bca51ee82665560ec9b774ef45e4d3 /Lib/distutils
parent335a5128e54809b789cb82f05a913df1198fe40e (diff)
downloadcpython-git-e62a40401ddfd45ca70d4971e9ad05d4af4f6d78.tar.gz
Fix bootstrap issue by importing the cgi module lazily
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/config.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py
index 7e10fff9d9..106e146598 100644
--- a/Lib/distutils/config.py
+++ b/Lib/distutils/config.py
@@ -3,7 +3,6 @@
Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
-import cgi
import os
from configparser import ConfigParser
@@ -104,6 +103,7 @@ class PyPIRCCommand(Command):
def _read_pypi_response(self, response):
"""Read and decode a PyPI HTTP response."""
+ import cgi
content_type = response.getheader('content-type', 'text/plain')
encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii')
return response.read().decode(encoding)