diff options
Diffstat (limited to 'setuptools/command/upload.py')
-rw-r--r-- | setuptools/command/upload.py | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py index a44173a..ec7f81e 100644 --- a/setuptools/command/upload.py +++ b/setuptools/command/upload.py @@ -1,42 +1,17 @@ -import getpass +from distutils import log from distutils.command import upload as orig +from setuptools.errors import RemovedCommandError + class upload(orig.upload): - """ - Override default upload behavior to obtain password - in a variety of different ways. - """ + """Formerly used to upload packages to PyPI.""" - def finalize_options(self): - orig.upload.finalize_options(self) - self.username = ( - self.username or - getpass.getuser() - ) - # Attempt to obtain password. Short circuit evaluation at the first - # sign of success. - self.password = ( - self.password or - self._load_password_from_keyring() or - self._prompt_for_password() + def run(self): + msg = ( + "The upload command has been removed, use twine to upload " + + "instead (https://pypi.org/p/twine)" ) - def _load_password_from_keyring(self): - """ - Attempt to load password from keyring. Suppress Exceptions. - """ - try: - keyring = __import__('keyring') - return keyring.get_password(self.repository, self.username) - except Exception: - pass - - def _prompt_for_password(self): - """ - Prompt for a password on the tty. Suppress Exceptions. - """ - try: - return getpass.getpass() - except (Exception, KeyboardInterrupt): - pass + self.announce("ERROR: " + msg, log.ERROR) + raise RemovedCommandError(msg) |