1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
U
H=®d‡ã@s dZddlmZddlZddlmZddlmZddlm    Z    ddl
m Z ddl m Z mZdd    lmZdd
lmZdd lmZer¨dd lmZdd lmZmZddl
mZe rºddlmZn ddlmZdZe e¡Z Gdd„deƒZ!dd„Z"dd„Z#dd„Z$dd„Z%dd„Z&dd„Z'd d!„Z(dS)"z0Support functions for working with wheel files.
é)Úabsolute_importN)ÚParser)ÚZipFile)Úcanonicalize_name)ÚDistInfoDistribution)ÚPY2Ú
ensure_str)ÚUnsupportedWheel)Ú DictMetadata)ÚMYPY_CHECK_RUNNING)ÚMessage)ÚDictÚTuple)Ú Distribution)Ú
BadZipfile)Ú
BadZipFile)ércs,eZdZdZ‡fdd„Z‡fdd„Z‡ZS)Ú WheelMetadatazaMetadata provider that maps metadata decoding exceptions to our
    internal exception type.
    cstt|ƒ |¡||_dS)N)ÚsuperrÚ__init__Ú _wheel_name)ÚselfÚmetadataÚ
wheel_name©Ú    __class__©úPD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_internal/utils/wheel.pyr(szWheelMetadata.__init__c
sLztt|ƒ |¡WStk
rF}ztd |j|¡ƒ‚W5d}~XYnXdS)Nz"Error decoding metadata for {}: {})rrÚ get_metadataÚUnicodeDecodeErrorr    Úformatr)rÚnameÚerrrr-sÿÿzWheelMetadata.get_metadata)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrÚ __classcell__rrrrr$s rc s¬t||ƒ\‰}‡fdd„| ¡Dƒ}i}|D]f}t|ƒ}| dd¡\}}zt||ƒ||<Wq,tk
r}    ztd |t|    ƒ¡ƒ‚W5d}    ~    XYq,Xq,t||ƒ}
t    ||
|dS)zaGet a pkg_resources distribution given a wheel.
 
    :raises UnsupportedWheel: on any errors
    cs g|]}| d ˆ¡¡r|‘qS)z{}/)Ú
startswithr ©Ú.0Úp©Úinfo_dirrrÚ
<listcomp>Bsz8pkg_resources_distribution_for_wheel.<locals>.<listcomp>ú/rú{} has an invalid wheel, {}N)ÚlocationrÚ project_name)
Ú parse_wheelÚnamelistrÚsplitÚread_wheel_metadata_filer    r Ústrrr) Ú    wheel_zipr!r1Ú_Úmetadata_filesÚ metadata_textÚpathÚ    full_pathÚ metadata_namer"rrr,rÚ$pkg_resources_distribution_for_wheel:s.
ÿÿ ÿ
ÿr?c
Csjz t||ƒ}t||ƒ}t|ƒ}Wn6tk
rV}ztd |t|ƒ¡ƒ‚W5d}~XYnXt||ƒ||fS)z©Extract information from the provided wheel, ensuring it meets basic
    standards.
 
    Returns the name of the .dist-info directory and the parsed WHEEL metadata.
    r0N)Úwheel_dist_info_dirÚwheel_metadataÚ wheel_versionr    r r7Úcheck_compatibility)r8r!r-rÚversionr"rrrr3_s
 
 ÿ
r3cCsŠtdd„| ¡Dƒƒ}dd„|Dƒ}|s0tdƒ‚t|ƒdkrPtd d |¡¡ƒ‚|d    }t|ƒ}t|ƒ}| |¡s‚td
 ||¡ƒ‚t|ƒS) z®Returns the name of the contained .dist-info directory.
 
    Raises AssertionError or UnsupportedWheel if not found, >1 found, or
    it doesn't match the provided name.
    css|]}| dd¡dVqdS)r/rrN)r5r)rrrÚ    <genexpr>|sz&wheel_dist_info_dir.<locals>.<genexpr>cSsg|]}| d¡r|‘qS)z
.dist-info)Úendswith)r*Úsrrrr.~s
z'wheel_dist_info_dir.<locals>.<listcomp>z.dist-info directory not foundrz)multiple .dist-info directories found: {}z, rz2.dist-info directory {!r} does not start with {!r})    Úsetr4r    Úlenr Újoinrr(r)Úsourcer!ÚsubdirsÚ    info_dirsr-Ú info_dir_nameÚcanonical_namerrrr@ts* ÿÿ
ÿÿr@c
CsJz | |¡WStttfk
rD}ztd ||¡ƒ‚W5d}~XYnXdS)Nzcould not read {!r} file: {!r})ÚreadrÚKeyErrorÚ RuntimeErrorr    r )rKr<r"rrrr6šs  
ÿr6c
Cs`d |¡}t||ƒ}z t|ƒ}Wn2tk
rR}ztd ||¡ƒ‚W5d}~XYnXtƒ |¡S)ziReturn the WHEEL metadata of an extracted wheel, if possible.
    Otherwise, raise UnsupportedWheel.
    z{}/WHEELzerror decoding {!r}: {!r}N)r r6rrr    rÚparsestr)rKÚ dist_info_dirr<Úwheel_contentsÚ
wheel_textr"rrrrA¦s
 
 "rAcCs^|d}|dkrtdƒ‚| ¡}zttt| d¡ƒƒWStk
rXtd |¡ƒ‚YnXdS)zbGiven WHEEL metadata, return the parsed Wheel-Version.
    Otherwise, raise UnsupportedWheel.
    z Wheel-VersionNzWHEEL is missing Wheel-VersionÚ.zinvalid Wheel-Version: {!r})r    ÚstripÚtupleÚmapÚintr5Ú
ValueErrorr )Ú
wheel_dataÚ version_textrDrrrrBºsrBc    CsR|dtdkr.td |d tt|ƒ¡¡ƒ‚n |tkrNt dd tt|ƒ¡¡dS)aåRaises errors or warns if called with an incompatible Wheel-Version.
 
    pip should refuse to install a Wheel-Version that's a major series
    ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when
    installing a version only minor version ahead (e.g 1.2 > 1.1).
 
    version: a 2-tuple representing a Wheel-Version (Major, Minor)
    name: name of wheel or package to raise exception about
 
    :raises UnsupportedWheel: when an incompatible Wheel-Version is given
    rzB{}'s Wheel-Version ({}) is not compatible with this version of piprWz*Installing from a newer Wheel-Version (%s)N)ÚVERSION_COMPATIBLEr    r rJrZr7ÚloggerÚwarning)rDr!rrrrCËs ÿÿþrC))r&Ú
__future__rÚloggingÚ email.parserrÚzipfilerZpip._vendor.packaging.utilsrZpip._vendor.pkg_resourcesrZpip._vendor.sixrrÚpip._internal.exceptionsr    Ú!pip._internal.utils.pkg_resourcesr
Úpip._internal.utils.typingr Ú email.messager Útypingr rrrrr_Ú    getLoggerr#r`rr?r3r@r6rArBrCrrrrÚ<module>s6           
%&