Commit 8ee4e036 authored by Antoine Pitrou's avatar Antoine Pitrou

Fix bootstrap issue by importing the cgi module lazily

parent a9d12941
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
Provides the PyPIRCCommand class, the base class for the command classes Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package. that uses .pypirc in the distutils.command package.
""" """
import cgi
import os import os
from configparser import ConfigParser from configparser import ConfigParser
...@@ -104,6 +103,7 @@ class PyPIRCCommand(Command): ...@@ -104,6 +103,7 @@ class PyPIRCCommand(Command):
def _read_pypi_response(self, response): def _read_pypi_response(self, response):
"""Read and decode a PyPI HTTP response.""" """Read and decode a PyPI HTTP response."""
import cgi
content_type = response.getheader('content-type', 'text/plain') content_type = response.getheader('content-type', 'text/plain')
encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii') encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii')
return response.read().decode(encoding) return response.read().decode(encoding)
......
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