"JdzdZddlZddlmZddlmZddlmZmZddl m Z m Z ddl m Z ddlmZmZdd lmZdd lmZd ZejeZGd d eZde dededefdZde dedeeeffdZde dedefdZde dedefdZde dedefdZ dedee!dffdZ"dee!dfdeddfdZ#dS)z0Support functions for working with wheel files. N)Message)Parser)DictTuple) BadZipFileZipFile)canonicalize_name)DistInfoDistribution Distribution)UnsupportedWheel) DictMetadata)rcTeZdZdZdeeefdeddffd Zdedeffd ZxZ S) WheelMetadatazaMetadata provider that maps metadata decoding exceptions to our internal exception type. metadata wheel_namereturnNcXt|||_dS)N)super__init__ _wheel_name)selfrr __class__s L/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/wheel.pyrzWheelMetadata.__init__s) """%namec t|S#t$r}td|jd|d}~wwxYw)NzError decoding metadata for : )r get_metadataUnicodeDecodeErrorr r)rrers rrzWheelMetadata.get_metadatasg 77''-- -!   "Ft/?FF1FF  s $ A AA ) __name__ __module__ __qualname____doc__rstrbytesrr __classcell__)rs@rrrs&c5j!1&s&t&&&&&&rr wheel_ziprlocationrc  t||\ } fd|D}i}|D]q}|dd\}} t||||<0#t$r5}t d|t |d}~wwxYwt||} t|| |S)zaGet a pkg_resources distribution given a wheel. :raises UnsupportedWheel: on any errors cDg|]}|d|S)/) startswith).0pinfo_dirs r z8pkg_resources_distribution_for_wheel..2s0VVVAnnn9U9UVaVVVrr-r{} has an invalid wheel, {}N)r*r project_name) parse_wheelnamelistsplitread_wheel_metadata_filer formatr&rr ) r)rr*_metadata_files metadata_textpath metadata_namer!rr1s @r$pkg_resources_distribution_for_wheelr?)si..KHaVVVV!3!3!5!5VVVN&(MWW::c1--= W+CIt+T+TM- ( ( W W W"#@#G#GcRSff#U#UVV V W]H55H HSW X X XXsA)) B(30B##B(c  t||}t||}t|}nB#t$r5}td|t |d}~wwxYwt ||||fS)zExtract information from the provided wheel, ensuring it meets basic standards. Returns the name of the .dist-info directory and the parsed WHEEL metadata. r3N)wheel_dist_info_dirwheel_metadata wheel_versionr r9r&check_compatibility)r)rr1rversionr!s rr5r5Bs S&y$77!)X66)) SSS<CCD#a&&QQRRRS&&& X s/2 A10A,,A1sourcecd|D}d|D}|stdt|dkr5tdd||d}t |}t |}||s#td|||S) zReturns 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. cFh|]}|dddS)r-rr)r7)r/r0s r z&wheel_dist_info_dir..[s)===aqwwsAq!===rc<g|]}|d|S)z .dist-info)endswith)r/ss rr2z'wheel_dist_info_dir..]s)@@@qqzz,'?'?@@@@rz.dist-info directory not foundrz)multiple .dist-info directories found: {}z, rz2.dist-info directory {!r} does not start with {!r})r6r lenr9joinr r.)rFrsubdirs info_dirsr1 info_dir_namecanonical_names rrArATs>=6??+<+<===G@@G@@@I A?@@@ 9~~ 7 > >tyy?S?S T T   |H%h//M&t,,N  # #N 3 3  @ G G.     Orr=c ||S#tttf$r}t d|d|d}~wwxYw)Nzcould not read z file: )readrKeyError RuntimeErrorr )rFr=r!s rr8r8useG{{4    , /GGGEEEEEFFFGsAAA dist_info_dirc|d}t||} |}n'#t$r}td|d|d}~wwxYwt |S)ziReturn the WHEEL metadata of an extracted wheel, if possible. Otherwise, raise UnsupportedWheel. z/WHEELzerror decoding rN)r8decoder r rparsestr)rFrWr=wheel_contents wheel_textr!s rrBrB~s # # #D-fd;;NB#**,, BBB@@@1@@AAAB 88  Z ( ((s, AA  A wheel_data.c|d}|td|} ttt|dS#t $rtd|wxYw)zbGiven WHEEL metadata, return the parsed Wheel-Version. Otherwise, raise UnsupportedWheel. z Wheel-VersionNzWHEEL is missing Wheel-Version.zinvalid Wheel-Version: )r striptuplemapintr7 ValueError)r] version_textrEs rrCrCso.L?@@@  ""GFSgmmC0011222 FFFDDDEEEFs 4A$$BrEc b|dtdkrItd|dt t ||tkrCt ddt t |dSdS)aRaises 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 pipr_z*Installing from a newer Wheel-Version (%s)N)VERSION_COMPATIBLEr r9rNrbr&loggerwarning)rErs rrDrDsqz&q))) VD#((3sG+<+<"="=>>    % % % 8 HHSg&& ' '      & %r)$r%logging email.messager email.parserrtypingrrzipfilerrpip._vendor.packaging.utilsr pip._vendor.pkg_resourcesr r pip._internal.exceptionsr !pip._internal.utils.pkg_resourcesr rg getLoggerr"rhrr&r?r5rAr'r8rBrcrCrDrrrus\!!!!!!''''''''999999HHHHHHHH555555::::::  8 $ $L&YY!Y-0YYYYY27#%W 2E$ssBGWGCGEGGGG)7)3)7))))& Fg F%S/ F F F F  sCx        r