Skip to content

Commit 52a6318

Browse files
committed
message_about_scripts_not_on_PATH: use pathlib also for parent_dir and script_name directly
1 parent a5a5e28 commit 52a6318

File tree

1 file changed

+5
-5
lines changed
  • src/pip/_internal/operations/install

1 file changed

+5
-5
lines changed

src/pip/_internal/operations/install/wheel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ def message_about_scripts_not_on_PATH(scripts: Sequence[str]) -> Optional[str]:
136136
return None
137137

138138
# Group scripts by the path they were installed in
139-
grouped_by_dir: Dict[str, Set[str]] = collections.defaultdict(set)
139+
grouped_by_dir: Dict[Path, Set[str]] = collections.defaultdict(set)
140140
for destfile in scripts:
141-
parent_dir = os.path.dirname(destfile)
142-
script_name = os.path.basename(destfile)
141+
parent_dir = Path(destfile).parent.resolve()
142+
script_name = Path(destfile).name
143143
grouped_by_dir[parent_dir].add(script_name)
144144

145145
# We don't want to warn for directories that are on PATH.
@@ -149,10 +149,10 @@ def message_about_scripts_not_on_PATH(scripts: Sequence[str]) -> Optional[str]:
149149
# If an executable sits with sys.executable, we don't warn for it.
150150
# This covers the case of venv invocations without activating the venv.
151151
not_warn_dirs.append(Path(sys.executable).parent.resolve())
152-
warn_for: Dict[str, Set[str]] = {
152+
warn_for: Dict[Path, Set[str]] = {
153153
parent_dir: scripts
154154
for parent_dir, scripts in grouped_by_dir.items()
155-
if Path(parent_dir).resolve() not in not_warn_dirs
155+
if parent_dir not in not_warn_dirs
156156
}
157157
if not warn_for:
158158
return None

0 commit comments

Comments
 (0)