ó
    ‰óýjY/  ã                   ó,  • S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJrJrJrJr  SSKJr  SS	KJrJrJr  SS
KJrJr  \(       a  SSKr\\\\\4   \\4   rSS/r " S S5      r  " S S\!\5      r" " S S\!\5      r# " S S\ 5      r$g)z)Source of information about a wheel file.é    N)ÚIterator)Úcontextmanager)Úcached_property)ÚPath)ÚTYPE_CHECKINGÚBinaryIOÚClassVarÚcast)ÚInstallerError)ÚInvalidRecordEntryÚRecordEntryÚparse_record_file)Úcanonicalize_nameÚparse_wheel_filenameÚ	WheelFileÚWheelSourcec                   óØ   ^ • \ rS rSr% Sr\r\\\	      \
S'    S\S\SS4U 4S jjr\S\4S	 j5       r\S\4S
 j5       r\S\\   4S j5       rS\S\4S jrSS jrS\\   4S jrSrU =r$ )r   é   zqRepresents an installable wheel.

This is an abstract class, whose methods have to be implemented by subclasses.
Úvalidation_errorÚdistributionÚversionÚreturnNc                 ó:   >• [         TU ]  5         Xl        X l        g)zŽInitialize a WheelSource object.

:param distribution: distribution name (like ``urllib3``)
:param version: version associated with the wheel
N)ÚsuperÚ__init__r   r   )Úselfr   r   Ú	__class__s      €Ú</usr/local/lib/python3.13/site-packages/installer/sources.pyr   ÚWheelSource.__init__,   s   ø€ ô 	‰ÑÔØ(ÔØ�ó    c                 ó:   • U R                    SU R                   S3$ )ú Name of the dist-info directory.Ú-ú
.dist-info©r   r   ©r   s    r   Údist_info_dirÚWheelSource.dist_info_dir6   s"   € ð ×#Ñ#Ð$ A d§l¡l ^°:Ð>Ð>r    c                 ó:   • U R                    SU R                   S3$ )zName of the data directory.r#   z.datar%   r&   s    r   Údata_dirÚWheelSource.data_dir;   s"   € ð ×#Ñ#Ð$ A d§l¡l ^°5Ð9Ð9r    c                 ó   • [         e)z‘Get names of all files in the dist-info directory.

Sample usage/behaviour::

    >>> wheel_source.dist_info_filenames
    ['METADATA', 'WHEEL']
©ÚNotImplementedErrorr&   s    r   Údist_info_filenamesÚWheelSource.dist_info_filenames@   s
   € ô "Ð!r    Úfilenamec                 ó   • [         e)z²Get contents, from ``filename`` in the dist-info directory.

Sample usage/behaviour::

    >>> wheel_source.read_dist_info("METADATA")
    ...

:param filename: name of the file
r-   )r   r1   s     r   Úread_dist_infoÚWheelSource.read_dist_infoK   s
   € ô "Ð!r    c                 ó   • [         e)z¢Validate ``RECORD`` of the wheel.

.. versionadded:: 0.7.0

This method should be called before :py:func:`install <installer.install>`
if validation is required.
r-   r&   s    r   Úvalidate_recordÚWheelSource.validate_recordW   s
   € ô "Ð!r    c                 ó   • [         e)af  Sequential access to all contents of the wheel (including dist-info files).

This method should return an iterable. Each value from the iterable must be a
tuple containing 3 elements:

- record: 3-value tuple, to pass to
  :py:meth:`RecordEntry.from_elements <installer.records.RecordEntry.from_elements>`.
- stream: An :py:class:`io.BufferedReader` object, providing the contents of the
  file at the location provided by the first element (path).
- is_executable: A boolean, representing whether the item has an executable bit.

All paths must be relative to the root of the wheel.

Sample usage/behaviour::

    >>> iterable = wheel_source.get_contents()
    >>> next(iterable)
    (('pkg/__init__.py', '', '0'), <...>, False)

This method may be called multiple times. Each iterable returned must
provide the same content upon reading from a specific file's stream.
r-   r&   s    r   Úget_contentsÚWheelSource.get_contentsa   s
   € ô. "Ð!r    r%   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
ValueErrorr   r	   ÚtypeÚ	ExceptionÚ__annotations__Ústrr   Úpropertyr'   r*   Úlistr/   r3   r6   r   ÚWheelContentElementr9   Ú__static_attributes__Ú__classcell__©r   s   @r   r   r      sÁ   ø‡ ñð
 3=Ð�h˜t I™Ñ/Ó<ðð Sð °3ð ¸4÷ ð ð?˜só ?ó ð?ð ð:˜#ó :ó ð:ð ð" T¨#¡Yó "ó ð"ð
" sð 
"¨sô 
"ô"ð"˜hÐ':Ñ;÷ "ò "r    c                   óL   ^ • \ rS rSrSrS\\   SS4U 4S jjrS\4S jrSr	U =r
$ )	Ú_WheelFileValidationErroré{   z*Raised when a wheel file fails validation.Úissuesr   Nc                 óB   >• [         TU ]  [        U5      5        Xl        g ©N)r   r   ÚreprrN   )r   rN   r   s     €r   r   Ú"_WheelFileValidationError.__init__~   s   ø€ Ü‰Ñœ˜f›Ô&Ø�r    c                 ó$   • SU R                   < S3$ )Nz WheelFileValidationError(issues=Ú)©rN   r&   s    r   Ú__repr__Ú"_WheelFileValidationError.__repr__‚   s   € Ø1°$·+±+±ÀÐBÐBr    rU   )r;   r<   r=   r>   r?   rF   rD   r   rV   rH   rI   rJ   s   @r   rL   rL   {   s1   ø† Ù4ð˜t C™yð ¨T÷ ðC˜#÷ Cò Cr    rL   c                   óT   ^ • \ rS rSrSrS\S\S-  S\SS4U 4S jjrS\4S	 jrS
rU =r	$ )Ú_WheelFileBadDistInfoé†   z8Raised when a wheel file has issues around `.dist-info`.Úreasonr1   NÚ	dist_infor   c                óH   >• [         TU ]  U5        Xl        X l        X0l        g rP   )r   r   r[   r1   r\   )r   r[   r1   r\   r   s       €r   r   Ú_WheelFileBadDistInfo.__init__‰   s   ø€ Ü‰Ñ˜Ô ØŒØ ŒØ"�r    c                 óX   • U R                    SU R                  < SU R                  < S3$ )Nz (filename=z, dist_info=rT   ©r[   r1   r\   r&   s    r   Ú__str__Ú_WheelFileBadDistInfo.__str__�   s,   € à�{‰{ˆm˜; t§}¡}Ñ&7°|ÀDÇNÁNÑCUÐUVÐWð	
r    )r\   r1   r[   )
r;   r<   r=   r>   r?   rD   r   ra   rH   rI   rJ   s   @r   rY   rY   †   s=   ø† ÙBð# #ð #°°t±ð #Èð #ÐPT÷ #ð
˜÷ 
ò 
r    rY   c                   óò   ^ • \ rS rSrSr\rS\R                  SS4U 4S jjr	\
\SSS\S    4S	 j5       5       r\S\4S
 j5       r\S\\   4S j5       rS\S\4S jrSS.S\SS4S jjrS\\   4S jrSrU =r$ )r   é•   zØImplements `WheelSource`, for an existing file from the filesystem.

Example usage::

    >>> with WheelFile.open("sampleproject-2.0.0-py3-none-any.whl") as source:
    ...     installer.install(source, destination)
Úfr   Nc                 óÐ   >• Xl         UR                  (       d   e[        UR                  5      R                  n[	        U5      n[
        TU ]  UR                  UR                  S9  g)zpInitialize a WheelFile object.

:param f: An open zipfile, which will stay open as long as this object is used.
)r   r   N)	Ú_zipfiler1   r   Únamer   r   r   r   r   )r   re   ÚbasenameÚparsed_namer   s       €r   r   ÚWheelFile.__init__    sX   ø€ ð
 ŒØ�z�zÐˆzä˜Ÿ
™
Ó#×(Ñ(ˆÜ*¨8Ó4ˆÜ‰ÑØ×'Ñ'Ø$×1Ñ1ð 	ò 	
r    Úpathzos.PathLike[str]c              #   ó€   #   • [         R                  " U5       nU " U5      v •  SSS5        g! , (       d  f       g= f7f)z%Create a wheelfile from a given path.N)ÚzipfileÚZipFile)Úclsrl   re   s      r   ÚopenÚWheelFile.open¯   s)   é € ô �_Š_˜TÔ" aÙ�a“&ŠL÷ #×"Ö"üs   ‚>™-¤	>­
;·>c           
      ó   • U R                   R                  5        Vs1 s H  oR                  SS5      S   iM     nnU Vs/ s H  o3R                  S5      (       d  M  UPM     nn Uu  nUR                  SS	5      S   n[        U5      n[        U R                  5      nXx:w  a  [        S
U R                   R                  US9eU$ s  snf s  snf ! [         a3    [        SU R                   R                  [        [        U5      5      S9Sef = f)r"   Ú/é   r   r$   z6Wheel doesn't contain exactly one .dist-info directoryr`   Nr#   é   z7Wheel .dist-info directory doesn't match wheel filename)rg   ÚnamelistÚsplitÚendswithr@   rY   r1   rD   ÚsortedÚrsplitr   r   )	r   rl   Útop_level_directoriesrh   Ú
dist_infosr'   Údi_dnameÚnorm_di_dnameÚnorm_file_dnames	            r   r'   ÚWheelFile.dist_info_dir¶   s  € ð /3¯m©m×.DÑ.DÔ.Fó!
Ú.F d�J‰J�s˜AÓ˜qÔ!Ñ.Fð 	ð !
ñ 3ó
Ú2�T·m±mÀL×6Q�DÑ2ð 	ð 
ð	Ø)Ñˆ]ð !×'Ñ'¨¨QÓ/°Ñ2ˆÜ)¨(Ó3ˆÜ+¨D×,=Ñ,=Ó>ˆàÓ+Ü'ØPØŸ™×/Ñ/Ø'ñð ð Ðùò9!
ùò
øô ó 	Ü'ØOØŸ™×/Ñ/Üœf ZÓ0Ó1ñð ð	ð	ús   �CÁCÁCÁ'C Ã=Dc                 óè   • U R                   nU R                  R                  5        Vs/ s H<  nUSS S:w  d  M  U[        R                  " X!/5      :X  d  M+  U[        U5      S-   S PM>     sn$ s  snf )z2Get names of all files in the dist-info directory.éÿÿÿÿNrt   ru   )r'   rg   rw   Ú	posixpathÚ
commonpathÚlen)r   Úbaserh   s      r   r/   ÚWheelFile.dist_info_filenames×   s~   € ð ×!Ñ!ˆð Ÿ™×.Ñ.Ô0ó
â0�Ø�B�Cˆy˜CÑó "ð ”y×+Ò+¨T¨LÓ9Ñ9ó "ˆD”�T“˜Q‘�Ó!Ù0ñ
ð 	
ùò 
s   ©A/ºA/ÁA/r1   c                 ó˜   • [         R                  " U R                  U5      nU R                  R	                  U5      R                  S5      $ )z;Get contents, from ``filename`` in the dist-info directory.zutf-8)r„   Újoinr'   rg   ÚreadÚdecode)r   r1   rl   s      r   r3   ÚWheelFile.read_dist_infoâ   s8   € ä�~Š~˜d×0Ñ0°(Ó;ˆØ�}‰}×!Ñ! $Ó'×.Ñ.¨wÓ7Ð7r    T)Úvalidate_contentsrŽ   c                óú  •  U R                  S5      R                  5       n[        U5       Vs0 s H  o3S   U_M
     nn/ nU R
                  R                  5        GHT  nUR                  SS S:X  a  M  UR                  UR                  S5      nU R                  [        R                  " U R                  UR                  /5      :X  a]  UR                  R                  S5      S   S;   a;  Ub6  UR                  S	U R
                  R                   S
UR                   S35        MÌ  Uc9  UR                  S	U R
                  R                   SUR                   S35        GM   [        R                  " U6 nUR                  U R                   S3:X  aF  UR$                  c  UR&                  b)  UR                  S	U R
                  R                   S35        GM  UR$                  b  UR&                  c6  UR                  S	U R
                  R                   SUR                   S35        U(       d  GMÙ  U R
                  R)                  US5       nUR+                  [-        SU5      5      (       d6  UR                  S	U R
                  R                   SUR                   S35        SSS5        GMW     U(       a  [	        U5      egs  snf ! [         a-  n[	        SU R
                  R                   SU< 3/5      UeSnAff = f! [          aW  n	U	R"                   H;  n
UR                  S	U R
                  R                   SUR                   SU
 35        M=      Sn	A	GM  Sn	A	ff = f! , (       d  f       GM  = f)al  Validate ``RECORD`` of the wheel.

This method should be called before :py:func:`install <installer.install>`
if validation is required.

File names will always be validated against ``RECORD``.

If ``validate_contents`` is true, sizes and hashes of files
will also be validated against ``RECORD``.

:param validate_contents: Whether to validate content integrity.
ÚRECORDr   z!Unable to retrieve `RECORD` from z: Nrƒ   rt   )z
RECORD.p7sz
RECORD.jwszIn z, digital signature file z$ is incorrectly contained in RECORD.z, z is not mentioned in RECORDz, entry in RECORD file for z is invalid: z/RECORDz/, RECORD file incorrectly contains hash / size.z, hash / size of z is not included in RECORDÚrr   z didn't match RECORD)r3   Ú
splitlinesr   rB   rL   rg   r1   ÚinfolistÚpopr'   r„   r…   rx   Úappendr   Úfrom_elementsr   rN   Úhash_Úsizerq   Úvalidate_streamr
   )r   rŽ   Úrecord_linesÚrecordÚrecord_mappingÚexcrN   ÚitemÚrecord_argsÚeÚissueÚstreams               r   r6   ÚWheelFile.validate_recordç   s3  € ð	Ø×.Ñ.¨xÓ8×CÑCÓEˆLä0AÀ,Ô0OóÚ0O f�q‘	˜6Ò!Ñ0Oð ð ð ˆà—M‘M×*Ñ*×,ˆDØ�}‰}˜R˜SÐ! SÓ(Ùà(×,Ñ,¨T¯]©]¸DÓAˆKà×!Ñ!¤Y×%9Ò%9Ø×#Ñ# T§]¡]Ð3ó&ó à—-‘-×%Ñ% cÓ*¨2Ñ.Ð2NÓNàÑ*à—M‘MØ˜dŸm™m×4Ñ4Ð5Ð5NÈtÏ}É}Èoð  ^Bð  Côñ àÑ"Ø—‘Ø˜$Ÿ-™-×0Ñ0Ð1°°D·M±M°?ÐB]Ð^ôò ðÜ$×2Ò2°KÐ@�ð �}‰} 4×#5Ñ#5Ð"6°gÐ >Ó>à—<‘<Ñ+¨v¯{©{Ñ/Fà—M‘MØ˜dŸm™m×4Ñ4Ð5Ð5dÐeôò Ø�|‰|Ñ# v§{¡{Ñ':à—‘Ø˜$Ÿ-™-×0Ñ0Ð1Ð1BÀ4Ç=Á=À/ÐQkÐlô÷ !Ñ Ø—]‘]×'Ñ'¨¨cÔ2°fØ!×1Ñ1´$°zÀ6Ó2J×KÑKØŸ™Ø! $§-¡-×"8Ñ"8Ð!9Ð9JÈ4Ï=É=È/ÐYmÐnô÷ 3Ò2ñ_ -öj Ü+¨FÓ3Ð3ð ùòøô ó 	Ü+Ø4°T·]±]×5KÑ5KÐ4LÈBÈsÉgÐVÐWóàðûð	ûô@ &ó ØŸXœX�EØ—M‘MØ˜dŸm™m×4Ñ4Ð5Ð5PØŸ=™=˜/¨°u°gð?öñ &ö
 ûðú÷, 3×2úsM   ‚,K ®K½K Å$LÉAM*ËK Ë
LË(K>Ë>LÌ
M'ÌAM"Í"M'Í*
M:	c              #   óh  #   • U R                  S5      R                  5       n[        U5      nU Vs0 s H  o3S   U_M
     nnU R                  R	                  5        Hº  nUR
                  SS S:X  a  M  UR                  UR
                  UR
                  SS45      nUR                  S-	  n[        U=(       a"    [        R                  " U5      =(       a    US-  5      nU R                  R                  U5       n[        S	U5      n	X9U4v •  SSS5        M¼     gs  snf ! , (       d  f       MÓ  = f7f)
zýSequential access to all contents of the wheel (including dist-info files).

This implementation requires that every file that is a part of the wheel
archive has a corresponding entry in RECORD. If they are not, an
:any:`AssertionError` will be raised.
r�   r   rƒ   Nrt   Ú é   éI   r   )r3   r’   r   rg   r“   r1   r”   Úexternal_attrÚboolÚstatÚS_ISREGrq   r
   )
r   rš   Úrecordsr›   rœ   rž   ÚmodeÚis_executabler¢   Ústream_casteds
             r   r9   ÚWheelFile.get_contents8  s	  é € ð ×*Ñ*¨8Ó4×?Ñ?ÓAˆÜ# LÓ1ˆÙ:AÓBº'° ™) VÒ+¹'ˆÐBà—M‘M×*Ñ*Ö,ˆDØ�}‰}˜R˜SÐ! SÓ(Ùð $×'Ñ'¨¯©¸¿¹ÀrÈ2Ð7NÓOˆFð ×%Ñ%¨Ñ+ˆDÜ  ×!M¬$¯,ª,°tÓ*<×!MÀÈÁÓNˆMà—‘×#Ñ# DÔ)¨VÜ $ Z°Ó 8�Ø¨]Ð:Ò:÷ *Ñ)ò -ùò C÷ *Ö)üs)   ‚/D2±DÁ B;D2Ã;D ÄD2Ä 
D/	Ä*D2)rg   )r;   r<   r=   r>   r?   rL   r   rn   ro   r   Úclassmethodr   r   rq   r   rD   r'   rE   rF   r/   r3   r©   r6   rG   r9   rH   rI   rJ   s   @r   r   r   •   sÙ   ø† ñð 1Ðð
˜'Ÿ/™/ð 
¨d÷ 
ð ØðÐ*ð ¨x¸Ñ/Dó ó ó ðð
 ð˜só ó ðð@ ð
 T¨#¡Yó 
ó ð
ð8 sð 8¨sô 8ð
 <@ò O4°Dð O4ÀDõ O4ðb;˜hÐ':Ñ;÷ ;ò ;r    )%r?   r„   rª   rn   Úcollections.abcr   Ú
contextlibr   Ú	functoolsr   Úpathlibr   Útypingr   r   r	   r
   Úinstaller.exceptionsr   Úinstaller.recordsr   r   r   Úinstaller.utilsr   r   ÚosÚtuplerD   r©   rG   Ú__all__r   r@   rL   rY   r   © r    r   Ú<module>r¾      s�   ðÙ /ã Û Û Ý $Ý %Ý %Ý ÷ó õ 0ß PÑ Pß CæÛà˜E # s¨C -Ñ0°(¸DÐ@ÑAÐ ð ˜Ð
&€÷Z"ñ Z"ôzC 
¨Nô Cô
˜J¨ô 
ô};�õ };r    