summaryrefslogtreecommitdiff
path: root/config.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-12-22 19:41:31 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2013-12-22 19:41:31 +0100
commit85217523aea99ac5ef7adca77d234ea8727ab1c2 (patch)
treed988016a2249c8159f26f90d2709c506dfc1a1b9 /config.py
parent6f6cd52ff5909a2b176e2b2d054bc14a46482175 (diff)
parent8ee4e0365d4d31b4d0b42511567fa2c2657dcdcb (diff)
downloadpython-setuptools-git-85217523aea99ac5ef7adca77d234ea8727ab1c2.tar.gz
Fix bootstrap issue by importing the cgi module lazily
Diffstat (limited to 'config.py')
-rw-r--r--config.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/config.py b/config.py
index 9440190a..382aca8f 100644
--- a/config.py
+++ b/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
@@ -113,6 +112,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)