From 4c2b268d52e84452e785468dfbfabac80874ee47 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Fri, 6 Jul 2018 04:41:19 +0530 Subject: [PATCH] Add "DEPRECATION" to start of message when composing it --- src/pip/_internal/utils/deprecation.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pip/_internal/utils/deprecation.py b/src/pip/_internal/utils/deprecation.py index 94b3caa0a..e8f59705c 100644 --- a/src/pip/_internal/utils/deprecation.py +++ b/src/pip/_internal/utils/deprecation.py @@ -35,11 +35,6 @@ def _showwarning(message, category, filename, lineno, file=None, line=None): # deprecation messages for pip. logger = logging.getLogger("pip._internal.deprecations") - # This is purposely using the % formatter here instead of letting - # the logging module handle the interpolation. This is because we - # want it to appear as if someone typed this entire message out. - log_message = "DEPRECATION: %s" % message - # PipPendingDeprecationWarnings still have at least 2 # versions to go until they are removed so they can just be # warnings. Otherwise, they will be removed in the very next @@ -74,7 +69,9 @@ def deprecated(reason, replacement, issue=None, imminent=False): category = PipPendingDeprecationWarning # Construct a nice message. - message = reason + # This is purposely eagerly formatted as we want it to appear as if someone + # typed this entire message out. + message = "DEPRECATION: " + reason if replacement is not None: message += " An alternative is to {}.".format(replacement) if issue is not None: