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..a4b6aa1ef33 100644 --- a/src/pip/_internal/cli/base_command.py +++ b/src/pip/_internal/cli/base_command.py @@ -143,6 +143,15 @@ 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 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, + ) # TODO: Try to get these passing down from the command? # without resorting to os.environ to hold these. 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)]