summaryrefslogtreecommitdiff
path: root/config.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-12-22 18:13:51 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2013-12-22 18:13:51 +0100
commita9d129418d7569a12e225e130711524a89868eca (patch)
treef95478d1bc6ad320d0b165341b174c5799bd50f0 /config.py
parent13766f65fc959da18e5d775ceb7a25ed71ed401e (diff)
downloadpython-setuptools-git-a9d129418d7569a12e225e130711524a89868eca.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 a97635f2..7e10fff9 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
@@ -101,6 +102,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