From 71dbc9c3d51bee333acf43143dd3d44ad0f37450 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sat, 19 Jan 2019 14:48:55 -0500 Subject: [PATCH 1/3] Warn on Python 2.7 --- news/6148.removal | 2 ++ src/pip/_internal/cli/base_command.py | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 news/6148.removal diff --git a/news/6148.removal b/news/6148.removal new file mode 100644 index 00000000000..1be44f45424 --- /dev/null +++ b/news/6148.removal @@ -0,0 +1,2 @@ +Start printing a warning for Python 2.7 to warn of impending Python 2.7 End-of-life and +prompt users to start migrating to Python 3. diff --git a/src/pip/_internal/cli/base_command.py b/src/pip/_internal/cli/base_command.py index e1f45826ce4..648b7f7cca5 100644 --- a/src/pip/_internal/cli/base_command.py +++ b/src/pip/_internal/cli/base_command.py @@ -143,6 +143,14 @@ def main(self, args): replacement=None, gone_in='19.2', ) + elif sys.version_info[:2] == (2, 7): + deprecated( + "Python 2.7 will reach the end of it's life on January 1st, 2020. " + "Please upgrade your Python as Python 2.7 won't be maintained after " + "that date. A future version of pip will drop support for Python 2.7.", + replacement=None, + gone_in=None, + ) # TODO: Try to get these passing down from the command? # without resorting to os.environ to hold these. From a44579ca2dcf4498d71654a3a0ccedec9292a128 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sat, 19 Jan 2019 15:01:33 -0500 Subject: [PATCH 2/3] Fix tests for deprecated Pythons --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1b51fc8d322..c2d8fc32883 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -349,4 +349,4 @@ def in_memory_pip(): @pytest.fixture def deprecated_python(): """Used to indicate wheither pip deprecated this python version""" - return sys.version_info[:2] == (3, 4) + return sys.version_info[:2] in [(3, 4), (2, 7)] From f3b9cf2e8f03b22c4e9b2d5754d69cf2a55b8896 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sat, 19 Jan 2019 19:09:04 -0500 Subject: [PATCH 3/3] fix grammar, line lengths --- src/pip/_internal/cli/base_command.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pip/_internal/cli/base_command.py b/src/pip/_internal/cli/base_command.py index 648b7f7cca5..a4b6aa1ef33 100644 --- a/src/pip/_internal/cli/base_command.py +++ b/src/pip/_internal/cli/base_command.py @@ -145,9 +145,10 @@ def main(self, args): ) elif sys.version_info[:2] == (2, 7): deprecated( - "Python 2.7 will reach the end of it's life on January 1st, 2020. " - "Please upgrade your Python as Python 2.7 won't be maintained after " - "that date. A future version of pip will drop support for Python 2.7.", + "Python 2.7 will reach the end of its life on January 1st, " + "2020. Please upgrade your Python as Python 2.7 won't be " + "maintained after that date. A future version of pip will " + "drop support for Python 2.7.", replacement=None, gone_in=None, )