Skip to content
Open
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)
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