diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-06-19 03:09:11 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-06-19 03:09:11 (GMT) |
commit | 41dcf35c264b22df7821e08ea0961a3189b17def (patch) | |
tree | 2cc2ab967b646b90e9631b54dc604cdcac629870 /Lib/distutils/command | |
parent | 205a55f5c60c50ce9a064432fdf90036690e41a1 (diff) | |
parent | 2e4d3b133a8fe7be5469bc8f0d1a0f80a57f608c (diff) | |
download | cpython-41dcf35c264b22df7821e08ea0961a3189b17def.zip cpython-41dcf35c264b22df7821e08ea0961a3189b17def.tar.gz cpython-41dcf35c264b22df7821e08ea0961a3189b17def.tar.bz2 |
Issue #21722: The distutils "upload" command now exits with a non-zero return code when uploading fails.
Patch by Martin Dengler.
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r-- | Lib/distutils/command/upload.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py index b906435..1fdb456 100644 --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -12,7 +12,7 @@ import hashlib from base64 import standard_b64encode from urllib.request import urlopen, Request, HTTPError from urllib.parse import urlparse -from distutils.errors import DistutilsOptionError +from distutils.errors import DistutilsError, DistutilsOptionError from distutils.core import PyPIRCCommand from distutils.spawn import spawn from distutils import log @@ -184,7 +184,7 @@ class upload(PyPIRCCommand): reason = result.msg except OSError as e: self.announce(str(e), log.ERROR) - return + raise except HTTPError as e: status = e.code reason = e.msg @@ -193,8 +193,9 @@ class upload(PyPIRCCommand): self.announce('Server response (%s): %s' % (status, reason), log.INFO) else: - self.announce('Upload failed (%s): %s' % (status, reason), - log.ERROR) + msg = 'Upload failed (%s): %s' % (status, reason) + self.announce(msg, log.ERROR) + raise DistutilsError(msg) if self.show_response: text = self._read_pypi_response(result) msg = '\n'.join(('-' * 75, text, '-' * 75)) |