diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-22 17:14:56 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-22 17:14:56 (GMT) |
commit | 20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e (patch) | |
tree | dcbd9ab66d76647d49e94e1521d72ed4254428e2 /Lib/distutils/config.py | |
parent | a936c40ede4583f8ac94362eced17325ae780abc (diff) | |
parent | 335a5128e54809b789cb82f05a913df1198fe40e (diff) | |
download | cpython-20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e.zip cpython-20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e.tar.gz cpython-20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e.tar.bz2 |
Fix TypeError on "setup.py upload --show-response".
Diffstat (limited to 'Lib/distutils/config.py')
-rw-r--r-- | Lib/distutils/config.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py index 7439a83..9440190 100644 --- a/Lib/distutils/config.py +++ b/Lib/distutils/config.py @@ -3,6 +3,7 @@ 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 @@ -110,6 +111,12 @@ class PyPIRCCommand(Command): return {} + def _read_pypi_response(self, response): + """Read and decode a PyPI HTTP response.""" + content_type = response.getheader('content-type', 'text/plain') + encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii') + return response.read().decode(encoding) + def initialize_options(self): """Initialize options.""" self.repository = None |