Skip to content

Commit

Permalink
Merge pull request #6147 from dstufft/warn-on-27
Browse files Browse the repository at this point in the history
Warn on Python 2.7
  • Loading branch information
dstufft authored Jan 20, 2019
2 parents 467ee29 + f3b9cf2 commit 5074327
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions news/6148.removal
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 9 additions & 0 deletions src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

0 comments on commit 5074327

Please sign in to comment.