summaryrefslogtreecommitdiff
path: root/config.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-12-22 18:14:56 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2013-12-22 18:14:56 +0100
commit6f6cd52ff5909a2b176e2b2d054bc14a46482175 (patch)
tree4d06e3b4e37bf6f0efcb0ffdc5d85389b120e837 /config.py
parent91bb029d7e809b5561df7c3ffc1253b20e65ea88 (diff)
parenta9d129418d7569a12e225e130711524a89868eca (diff)
downloadpython-setuptools-git-6f6cd52ff5909a2b176e2b2d054bc14a46482175.tar.gz
Fix TypeError on "setup.py upload --show-response".
Diffstat (limited to 'config.py')
-rw-r--r--config.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/config.py b/config.py
index 7439a83a..9440190a 100644
--- a/config.py
+++ b/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