1
  6   ˆl—ßi~”Ji?u8 ^¸Û·mLZ7ÿ�þB gÓä�?Ï¿ƒh¹ÄÂÁ      1
     	ˆÆÅÄ616ÃÂÁ h    	‹      ÕV]oÚ0}ï¯ðü°7¸|•m4xêÒP) Ê4MÓ4™Ø¯IÙ†ŒýúÝºÒ
4*Ñª¼ø^ÛÇ¾çØ¾¶½7þ°3ù6ê’Ï“ë>}ùÔïu-|­w ü‰_t4Ê•*@w@	�K[ Y–•³zY›9LÆº8j€uF®,œ ìÌËÛØñBÉZâ9å"Éz‰�¿‰žÐg•�8neAÈ¥
¤Í}'cˆe¬Íjcê5H´�ÒE„QKirÿfÊÄ7ògÞïAcÂ&¨7Õb•s©>k\œ~-�O×ás×0Ï…dÉ#5OÚÔé”2OÅsbMÐ¦ �X˜F<¹-ÏÕŒ¹6ýÞë \˜�f'¡‘³6ýØi.†mŸ²�1ß�¹FÌ%e}n‰µP3%Å^ðM¾QöOè_ÚÀ¨Ô)�ÜC%nKtdSŽZÏQAh¶QDüo5xð`1F—ãî`â÷ÆÅ’ˆ|Š{vÇØEÊF¸‡‰#¾22pˆÝÈ+b½M¦6½¸«’y£æ¡£Œ�Ù‰|‚âEr›è,Ù�ºS®ü…)[›m’�XÕ*µf©Z-Õ¤ViÕß²ˆ	}õ‚ôC…W'H	§â–²;ïE¤Ü…”ååk!?Ó‘�f›û¾LOÃ•U�Öw-æìÃúzªHõ]«ÒÜ«ç¹ü=:Ãu¬í1öã…ï"ë¸[`>öô”]L7ïjøçŸÞAr¡41æA u¤’9ªyÜrðÞT^ÍáZÈ%¾È”öù×�?Øüí<Xÿ(=(~·ý8§Å@    [   ˆl–Ým_Jõ0–52 Z¸î2Ê˜´o�þ\Œ¬Ü­€¬‘¦„ë@þÀ„­ßÅ_ŠI|¥�+Wé3ž¯a—ßi~”Ji?u8 _¸Ë×yLZ7ÿÄ ?÷     """Support for installing and building the "wheel" binary package format.
"""

import collections
import compileall
import contextlib
import csv
import importlib
import logging
import os.path
import re
import shutil
import sys
import warnings
from base64 import urlsafe_b64encode
from email.message import Message
from itertools import chain, filterfalse, starmap
from typing import (
    IO,
    TYPE_CHECKING,
    Any,
    BinaryIO,
    Callable,
    Dict,
    Generator,
    Iterable,
    Iterator,
    List,
    NewType,
    Optional,
    Sequence,
    Set,
    Tuple,
    Union,
    cast,
)
from zipfile import ZipFile, ZipInfo

from pip._vendor.distlib.scripts import ScriptMaker
from pip._vendor.distlib.util import get_export_entry
from pip._vendor.packaging.utils import canonicalize_name

from pip._internal.exceptions import InstallationError
from pip._internal.locations import get_major_minor_version
from pip._internal.metadata import (
    BaseDistribution,
    FilesystemWheel,
    get_wheel_distribution,
)
from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
from pip._internal.utils.filesystem import adjacent_tmp_file, replace
from pip._internal.utils.misc import captured_stdout, ensure_dir, hash_file, partition
from pip._internal.utils.unpacking import (
    current_umask,
    is_within_directory,
    set_extracted_file_to_default_mode_plus_executable,
    zip_item_is_executable,
)
from pip._internal.utils.wheel import parse_wheel

if TYPE_CHECKING:
    from typing import Protocol

    class File(Protocol):
        src_record_path: "RecordPath"
        dest_path: str
        changed: bool

        def save(self) -> None:
            pass


logger = logging.getLogger(__name__)

RecordPath = NewType("RecordPath", str)
InstalledCSVRow = Tuple[RecordPath, str, Union[int, str]]


def rehash(path: str, blocksize: int = 1 << 20) -> Tuple[str, str]:
    """Return (encoded_digest, length) for path using hashlib.sha256()"""
    h, length = hash_file(path, blocksize)
    digest = "sha256=" + urlsafe_b64encode(h.digest()).decode("latin1").rstrip("=")
    return (digest, str(length))


def csv_io_kwargs(mode: str) -> Dict[str, Any]:
    """Return keyword arguments to properly open a CSV file
    in the given mode.
    """
    return {"mode": mode, "newline": "", "encoding": "utf-8"}


def fix_script(path: str) -> bool:
    """Replace #!python with #!/path/to/python
    Return True if file was changed.
    """
    # XXX RECORD hashes will need to be updated
    assert os.path.isfile(path)

    with open(path, "rb") as script:
        firstline = script.readline()
        if not firstline.startswith(b"#!python"):
            return False
        exename = sys.executable.encode(sys.getfilesystemencoding())
        firstline = b"#!" + exename + os.linesep.encode("ascii")
        rest = script.read()
    with open(path, "wb") as script:
        script.write(firstline)
        script.write(rest)
    return True


def wheel_root_is_purelib(metadata: Message) -> bool:
    return metadata.get("Root-Is-Purelib", "").lower() == "true"


def get_entrypoints(dist: BaseDistribution) -> Tuple[Dict[str, str], Dict[str, str]]:
    console_scripts