U nÏ aŠã@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__©úZC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-6mt8ur68\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 || |dS)zaGet a pkg_resources distribution given a wheel. :raises UnsupportedWheel: on any errors cs g|]}| d ˆ¡¡r|‘qS)z{}/)Ú startswithr ©Ú.0Úp©Úinfo_dirrrÚ Bsz8pkg_resources_distribution_for_wheel..ú/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Žttdd„| ¡Dƒƒƒ}dd„|Dƒ}|s4tdƒ‚t|ƒdkrTtd 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|]}| d¡dVqdS)r/rN)r5r)rrrÚ |sz&wheel_dist_info_dir..cSsg|]}| d¡r|‘qS)z .dist-info)Úendswith)r*Úsrrrr.~s z'wheel_dist_info_dir..z.dist-info directory not foundrz)multiple .dist-info directories found: {}z, rz2.dist-info directory {!r} does not start with {!r}) ÚlistÚ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 )rLr<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)rLÚ 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 piprXz*Installing from a newer Wheel-Version (%s)N)ÚVERSION_COMPATIBLEr r rKr[r7ÚloggerÚwarning)rDr!rrrrCËs ÿÿþrC))r&Ú __future__rÚloggingÚ email.parserrÚzipfilerÚpip._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#rarr?r3r@r6rArBrCrrrrÚs6            %&