mirror of https://github.com/pypa/pip
Add warning when using old console script wrappers
We use sys.stderr instead of our `deprecated` helper because logging is not set up at the time this is executed.
This commit is contained in:
parent
973cb349ba
commit
38585adaec
|
@ -1,3 +1,5 @@
|
|||
import sys
|
||||
|
||||
from pip._internal.cli.main import main
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
|
@ -18,4 +20,12 @@ def _wrapper(args=None):
|
|||
directing them to an appropriate place for help, we now define all of
|
||||
our old entrypoints as wrappers for the current one.
|
||||
"""
|
||||
sys.stderr.write(
|
||||
"WARNING: pip is being invoked by an old script wrapper. This will "
|
||||
"fail in a future version of pip.\n"
|
||||
"Please see https://github.com/pypa/pip/issues/5599 for advice on "
|
||||
"fixing the underlying issue.\n"
|
||||
"To avoid this problem you can invoke Python with '-m pip' instead of "
|
||||
"running pip directly.\n"
|
||||
)
|
||||
return main(args)
|
||||
|
|
|
@ -29,5 +29,6 @@ def test_entrypoints_work(entrypoint, script):
|
|||
|
||||
script.pip("install", "-vvv", str(fake_pkg))
|
||||
result = script.pip("-V")
|
||||
result2 = script.run("fake_pip", "-V")
|
||||
result2 = script.run("fake_pip", "-V", allow_stderr_warning=True)
|
||||
assert result.stdout == result2.stdout
|
||||
assert "old script wrapper" in result2.stderr
|
||||
|
|
Loading…
Reference in New Issue