Skip to content

Commit 68d44e6

Browse files
Make RECORD from wheel available via whl_filegroup
1 parent ade0b2b commit 68d44e6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

python/private/whl_filegroup/extract_wheel_files.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from collections.abc import Iterable
77
from pathlib import Path
88

9-
WhlRecord = dict[str, tuple[str, int]]
9+
WhlRecord = Iterable[str]
1010

1111

1212
def get_record(whl_path: Path) -> WhlRecord:
@@ -20,18 +20,16 @@ def get_record(whl_path: Path) -> WhlRecord:
2020
except ValueError:
2121
raise RuntimeError(f"{whl_path} doesn't contain exactly one .dist-info/RECORD")
2222
record_lines = zipf.read(record_file).decode().splitlines()
23-
return {
24-
file: (filehash, int(filelen))
23+
return (
24+
line.split(",")[0]
2525
for line in record_lines
26-
for file, filehash, filelen in [line.split(",")]
27-
if filehash # Skip RECORD itself, which has no hash or length
28-
}
26+
)
2927

3028

3129
def get_files(whl_record: WhlRecord, regex_pattern: str) -> list[str]:
3230
"""Get files in a wheel that match a regex pattern."""
3331
p = re.compile(regex_pattern)
34-
return [filepath for filepath in whl_record.keys() if re.match(p, filepath)]
32+
return [filepath for filepath in whl_record if re.match(p, filepath)]
3533

3634

3735
def extract_files(whl_path: Path, files: Iterable[str], outdir: Path) -> None:

0 commit comments

Comments
 (0)