Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/compare_scan_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import platform
import sys
import urllib.parse
import urllib.request
from pathlib import Path

MAX_DEPENDENCY_FILES = 200_000
Expand Down Expand Up @@ -178,7 +179,9 @@ def hash_file(digest, label, path):
parsed = urllib.parse.urlsplit(raw_url)
if parsed.scheme != "file" or parsed.netloc not in {"", "localhost"}:
raise RuntimeError(f"editable dependency is not a local file target: {normalized_name}")
editable_root = Path(urllib.parse.unquote(parsed.path)).resolve(strict=True)
# url2pathname, not unquote: a Windows file URL's path is "/C:/..."
# and Path() would read the leading slash as a root, producing "C:\C:\...".
editable_root = Path(urllib.request.url2pathname(parsed.path)).resolve(strict=True)
Comment on lines 179 to +184

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also handle local paths that start with // here? On Python 3.14, a URL such as file:////tmp/dep passes the check above, but this conversion treats tmp as a hostname and raises URLError, stopping the accuracy check. I reproduced this on Python 3.14.7; the previous code accepts the same path.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. Yes, the // local-path case is handled in #490, which supersedes this PR.

#490 preserves the empty-authority delimiter for paths beginning with // on Python 3.14 and includes regression coverage for both the Windows drive-path and double-slash cases.

To avoid duplicating the implementation, I’ll leave #486 unchanged and let the corrected replacement land through #490.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming, @SanHsien. We've closed #486 as superseded by #490, since #490 already includes the fix and regression tests for both Windows drive paths and the // case. This avoids duplicate changes and keeps the remaining review in #490.

if not editable_root.is_dir():
raise RuntimeError(f"editable dependency target is not a directory: {normalized_name}")
for editable_path in sorted(editable_root.rglob("*")):
Expand Down
Loading