summaryrefslogtreecommitdiff
path: root/setuptools/command/upload.py
diff options
context:
space:
mode:
authorPaul Ganssle <paul@ganssle.io>2018-11-07 17:07:58 -0500
committerPaul Ganssle <paul@ganssle.io>2018-11-07 17:38:44 -0500
commitfe2c9e4292699635c91174bc049aefe81bf6116c (patch)
tree58ef477473868e95edeabb62d76da5bc6953b2fe /setuptools/command/upload.py
parent727dd60f6a11f38d165250c543ba135687fa2e61 (diff)
downloadpython-setuptools-git-fe2c9e4292699635c91174bc049aefe81bf6116c.tar.gz
Fix show_response behavior on Python 2
The `upload.show_response` feature was not added until Python 3. Rather than backport it, it is now enabled only if supported. This also adds a "smoke test" for the feature.
Diffstat (limited to 'setuptools/command/upload.py')
-rw-r--r--setuptools/command/upload.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py
index 99d86011..f57fe796 100644
--- a/setuptools/command/upload.py
+++ b/setuptools/command/upload.py
@@ -172,9 +172,11 @@ class upload(orig.upload):
self.announce('Server response (%s): %s' % (status, reason),
log.INFO)
if self.show_response:
- text = self._read_pypi_response(result)
- msg = '\n'.join(('-' * 75, text, '-' * 75))
- self.announce(msg, log.INFO)
+ text = getattr(self, '_read_pypi_response',
+ lambda x: None)(result)
+ if text is not None:
+ msg = '\n'.join(('-' * 75, text, '-' * 75))
+ self.announce(msg, log.INFO)
else:
msg = 'Upload failed (%s): %s' % (status, reason)
self.announce(msg, log.ERROR)