Commit 202f679a authored by Godefroid Chapelle's avatar Godefroid Chapelle

Problem: pip Python2.7 warning displayed too often

Solution: show it only once
parent 911dfb3f
...@@ -4,7 +4,9 @@ Change History ...@@ -4,7 +4,9 @@ Change History
3.0.0a2 (unreleased) 3.0.0a2 (unreleased)
==================== ====================
- Better patch for ``pkg_resources.Distribution.hashcmp`` performance. - Show only once pip warning about python version.
- Better patch for ``pkg_resources.Distribution.hashcmp`` performance.
3.0.0a1 (2020-05-17) 3.0.0a1 (2020-05-17)
......
...@@ -1659,6 +1659,17 @@ def call_pip_install(spec, dest): ...@@ -1659,6 +1659,17 @@ def call_pip_install(spec, dest):
args.append(spec) args.append(spec)
try:
from pip._internal.cli.cmdoptions import no_python_version_warning
HAS_WARNING_OPTION = True
except ImportError:
HAS_WARNING_OPTION = False
if HAS_WARNING_OPTION:
if not hasattr(call_pip_install, 'displayed'):
call_pip_install.displayed = True
else:
args.append('--no-python-version-warning')
if level <= logging.DEBUG: if level <= logging.DEBUG:
logger.debug('Running pip install:\n"%s"\npath=%s\n', logger.debug('Running pip install:\n"%s"\npath=%s\n',
'" "'.join(args), path) '" "'.join(args), path)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment