summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-12-22 17:14:56 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-12-22 17:14:56 (GMT)
commit20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e (patch)
treedcbd9ab66d76647d49e94e1521d72ed4254428e2 /Lib/distutils/command
parenta936c40ede4583f8ac94362eced17325ae780abc (diff)
parent335a5128e54809b789cb82f05a913df1198fe40e (diff)
downloadcpython-20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e.zip
cpython-20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e.tar.gz
cpython-20d5adea6a9dd5a752f2d8bb2b0cef0ee7cf386e.tar.bz2
Fix TypeError on "setup.py upload --show-response".
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r--Lib/distutils/command/register.py5
-rw-r--r--Lib/distutils/command/upload.py3
2 files changed, 3 insertions, 5 deletions
diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py
index 9b39ed3..55656c2 100644
--- a/Lib/distutils/command/register.py
+++ b/Lib/distutils/command/register.py
@@ -5,7 +5,6 @@ Implements the Distutils 'register' command (register with the repository).
# created 2002/10/21, Richard Jones
-import cgi
import os, string, getpass
import io
import urllib.parse, urllib.request
@@ -88,9 +87,7 @@ class register(PyPIRCCommand):
'''
url = self.repository+'?:action=list_classifiers'
response = urllib.request.urlopen(url)
- content_type = response.getheader('content-type', 'text/plain')
- encoding = cgi.parse_header(content_type)[1].get('charset', 'ascii')
- log.info(response.read().decode(encoding))
+ log.info(self._read_pypi_response(response))
def verify_metadata(self):
''' Send the metadata to the package index server to be checked.
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 2871583..d6762e4 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -196,5 +196,6 @@ class upload(PyPIRCCommand):
self.announce('Upload failed (%s): %s' % (status, reason),
log.ERROR)
if self.show_response:
- msg = '\n'.join(('-' * 75, result.read(), '-' * 75))
+ text = self._read_pypi_response(result)
+ msg = '\n'.join(('-' * 75, text, '-' * 75))
self.announce(msg, log.INFO)