File tree 3 files changed +12
-3
lines changed
src/pip/_internal/operations/install
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change
1
+ Normalize paths before checking if installed scripts are on PATH.
Original file line number Diff line number Diff line change @@ -143,16 +143,18 @@ def message_about_scripts_not_on_PATH(scripts: Sequence[str]) -> Optional[str]:
143
143
144
144
# We don't want to warn for directories that are on PATH.
145
145
not_warn_dirs = [
146
- os .path .normcase (i ).rstrip (os .sep )
146
+ os .path .normcase (os . path . normpath ( i ) ).rstrip (os .sep )
147
147
for i in os .environ .get ("PATH" , "" ).split (os .pathsep )
148
148
]
149
149
# If an executable sits with sys.executable, we don't warn for it.
150
150
# This covers the case of venv invocations without activating the venv.
151
- not_warn_dirs .append (os .path .normcase (os .path .dirname (sys .executable )))
151
+ not_warn_dirs .append (
152
+ os .path .normcase (os .path .normpath (os .path .dirname (sys .executable )))
153
+ )
152
154
warn_for : Dict [str , Set [str ]] = {
153
155
parent_dir : scripts
154
156
for parent_dir , scripts in grouped_by_dir .items ()
155
- if os .path .normcase (parent_dir ) not in not_warn_dirs
157
+ if os .path .normcase (os . path . normpath ( parent_dir ) ) not in not_warn_dirs
156
158
}
157
159
if not warn_for :
158
160
return None
Original file line number Diff line number Diff line change @@ -588,6 +588,12 @@ def test_multi_script__single_dir_on_PATH(self) -> None:
588
588
)
589
589
assert retval is None
590
590
591
+ def test_PATH_check_path_normalization (self ) -> None :
592
+ retval = self ._template (
593
+ paths = ["/a/./b/../b//c/" , "/d/e/bin" ], scripts = ["/a/b/c/foo" ]
594
+ )
595
+ assert retval is None
596
+
591
597
def test_single_script__single_dir_on_PATH (self ) -> None :
592
598
retval = self ._template (paths = ["/a/b" , "/c/d/bin" ], scripts = ["/a/b/foo" ])
593
599
assert retval is None
You can’t perform that action at this time.
0 commit comments