File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
python/private/whl_filegroup Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 6
6
from collections .abc import Iterable
7
7
from pathlib import Path
8
8
9
- WhlRecord = dict [str , tuple [ str , int ] ]
9
+ WhlRecord = Iterable [str ]
10
10
11
11
12
12
def get_record (whl_path : Path ) -> WhlRecord :
@@ -20,18 +20,16 @@ def get_record(whl_path: Path) -> WhlRecord:
20
20
except ValueError :
21
21
raise RuntimeError (f"{ whl_path } doesn't contain exactly one .dist-info/RECORD" )
22
22
record_lines = zipf .read (record_file ).decode ().splitlines ()
23
- return {
24
- file : ( filehash , int ( filelen ))
23
+ return (
24
+ line . split ( "," )[ 0 ]
25
25
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
+ )
29
27
30
28
31
29
def get_files (whl_record : WhlRecord , regex_pattern : str ) -> list [str ]:
32
30
"""Get files in a wheel that match a regex pattern."""
33
31
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 )]
35
33
36
34
37
35
def extract_files (whl_path : Path , files : Iterable [str ], outdir : Path ) -> None :
You can’t perform that action at this time.
0 commit comments