未验证 提交 5a8150f8 编写于 作者: P Pradyun Gedam 提交者: GitHub

Merge pull request #5163 from pradyunsg/fix/5157

Do not warn about script location if it's with sys.executable
Do not warn about script location when installing to the directory containing
sys.executable. This is the case when 'pip install'ing without activating a
virtualenv.
......@@ -162,11 +162,14 @@ def message_about_scripts_not_on_PATH(scripts):
script_name = os.path.basename(destfile)
grouped_by_dir[parent_dir].add(script_name)
path_env_var_parts = os.environ["PATH"].split(os.pathsep)
# Warn only for directories that are not on PATH
# We don't want to warn for directories that are on PATH.
not_warn_dirs = os.environ["PATH"].split(os.pathsep)
# If an executable sits with sys.executable, we don't warn for it.
# This covers the case of venv invocations without activating the venv.
not_warn_dirs.append(os.path.dirname(sys.executable))
warn_for = {
parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items()
if parent_dir not in path_env_var_parts
if parent_dir not in not_warn_dirs
}
if not warn_for:
return None
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册