Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/wheel/cli/unpack.py: 38%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from __future__ import annotations
3from pathlib import Path
5from ..wheelfile import WheelFile
8def unpack(path: str, dest: str = ".") -> None:
9 """Unpack a wheel.
11 Wheel content will be unpacked to {dest}/{name}-{ver}, where {name}
12 is the package name and {ver} its version.
14 :param path: The path to the wheel.
15 :param dest: Destination directory (default to current directory).
16 """
17 with WheelFile(path) as wf:
18 namever = wf.parsed_filename.group("namever")
19 destination = Path(dest) / namever
20 print(f"Unpacking to: {destination}...", end="", flush=True)
21 for zinfo in wf.filelist:
22 wf.extract(zinfo, destination)
24 # Set permissions to the same values as they were set in the archive
25 # We have to do this manually due to
26 # https://github.com/python/cpython/issues/59999
27 permissions = zinfo.external_attr >> 16 & 0o777
28 destination.joinpath(zinfo.filename).chmod(permissions)
30 print("OK")