Skip to content

Commit

Permalink
message_about_scripts_not_on_PATH: use pathlib also for parent_dir an…
Browse files Browse the repository at this point in the history
…d script_name directly
  • Loading branch information
lorddavidiii committed Jan 11, 2023
1 parent a5a5e28 commit e67d631
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pip/_internal/operations/install/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def message_about_scripts_not_on_PATH(scripts: Sequence[str]) -> Optional[str]:
# Group scripts by the path they were installed in
grouped_by_dir: Dict[str, Set[str]] = collections.defaultdict(set)
for destfile in scripts:
parent_dir = os.path.dirname(destfile)
script_name = os.path.basename(destfile)
parent_dir = Path(destfile).parent.resolve()
script_name = Path(destfile).name
grouped_by_dir[parent_dir].add(script_name)

# We don't want to warn for directories that are on PATH.
Expand All @@ -152,7 +152,7 @@ def message_about_scripts_not_on_PATH(scripts: Sequence[str]) -> Optional[str]:
warn_for: Dict[str, Set[str]] = {
parent_dir: scripts
for parent_dir, scripts in grouped_by_dir.items()
if Path(parent_dir).resolve() not in not_warn_dirs
if parent_dir not in not_warn_dirs
}
if not warn_for:
return None
Expand Down

0 comments on commit e67d631

Please sign in to comment.