
    Mi0              
       8   S r SSKrSSKrSSKrSSKrSSK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  SSKJrJrJrJrJrJrJrJrJrJr  SS	KJr  \(       a  SS
K J!r!J"r"  \" S\#5      r$\\$S4   r%/ SQr&\RN                  S:H  r(\((       a  SOSr)\RT                  " S\RV                  \RX                  -  5      r-\
" S/ SQ5      r.\RT                  " S\RV                  \RX                  -  5      r/\" \%S5      r0S\#S\4S jr1S\#S\#4S jr2S\#S\.4S jr3S\S\S\#S\\#\44   4S  jr5S0S! jr6\Rn                  S"\S#\#S\\   4S$ j5       r8S% 4S&\\\$\4      S'\\$/\\#   4   S\4S( jjr9S)\#S\\\#\#\#S*4      4S+ jr:S\44S, jr;S-\\#S.4   SS4S/ jr<g)1z=Utilities related to handling / interacting with wheel files.    N)
namedtuple)ConfigParser)Message)
FeedParser)compat32)
TYPE_CHECKINGBinaryIOCallableIterableIteratorNewTypeOptionalTupleUnioncast)RecordEntry)LauncherKindScriptSectionScheme.)
parse_metadata_fileparse_wheel_filenamecopyfileobj_with_hashingget_launcher_kindfix_shebangconstruct_record_fileparse_entrypointsmake_file_executableWheelFilenameSCHEME_NAMESnti   i   z
    ^
    (?P<distribution>.+?)
    -(?P<version>.*?)
    (?:-(?P<build_tag>\d[^-]*?))?
    -(?P<tag>.+?-.+?-.+?)
    \.whl
    $
    r   )distributionversion	build_tagtagzZ
    (?P<module>[\w.]+)\s*
    (:\s*(?P<attrs>[\w.]+))\s*
    (?P<extras>\[.*\])?\s*$
    )purelibplatlibheadersscriptsdatacontentsreturnc                 ^    [        [        S9nUR                  U 5        UR                  5       $ )zParse :pep:`376` ``PKG-INFO``-style metadata files.

``METADATA`` and ``WHEEL`` files (as per :pep:`427`) use the same syntax
and can also be parsed using this function.

:param contents: The entire contents of the file
)policy)r   r   feedclose)r*   feed_parsers     i/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/installer/utils.pyr   r   U   s+     H-KX    namec                 N    [         R                  " SSU 5      R                  5       $ )zaCanonicalize a project name according to PEP-503.

:param name: The project name to canonicalize
z[-_.]+-)resublower)r3   s    r1   canonicalize_namer9   b   s     
 66)S$'--//r2   filenamec                     [         R                  U 5      nU(       d  [        SU  35      e[        UR	                  5       6 $ )z^Parse a wheel filename, into it's various components.

:param filename: The filename to parse
zNot a valid wheel filename: )_WHEEL_FILENAME_REGEXmatch
ValueErrorr   groups)r:   
wheel_infos     r1   r   r   j   s>    
 ',,X6J7zBCC*++-..r2   sourcedesthash_algorithmc                 Z   [         R                  " U5      nSn U R                  [        5      nU(       d  O2UR	                  U5        UR                  U5        U[        U5      -  nMO  [        R                  " UR                  5       5      R                  S5      R                  S5      U4$ )ag  Copy a buffer while computing the content's hash and size.

Copies the source buffer into the destination buffer while computing the
hash of the contents. Adapted from :any:`shutil.copyfileobj`.

:param source: buffer holding the source data
:param dest: destination buffer
:param hash_algorithm: hashing algorithm

:return: size, hash digest of the contents
r   ascii=)hashlibnewread_COPY_BUFSIZEupdatewritelenbase64urlsafe_b64encodedigestdecoderstrip)rA   rB   rC   hashersizebufs         r1   r   r   u   s      [[(FD
kk-(c

3C  ##FMMO4;;GDKKCPRVVVr2   c                  >   [         R                  S:w  a  gS[        R                  R	                  5       ;   a  gS[        R                  R	                  5       ;   a  gS[        R                  R	                  5       ;   a  g[        R
                  S	:X  a  g
[        S5      e)z.Get the launcher kind for the current machine.r    posixamd64z	win-amd64z(arm64)z	win-arm64z(arm)zwin-armwin32zwin-ia32z&Unknown launcher kind for this machine)osr3   sysr"   r8   platformNotImplementedError r2   r1   r   r      ss    	ww$#++##%%CKK%%''#++##%%
||w
F
GGr2   streaminterpreterc              #     #    U R                  S5        U R                  S5      S:X  a  [        R                  " 5       nUR	                  SU S3R                  5       5        U R                  S5        U R                  5          U R                  [        5      nU(       d  OUR	                  U5        M0  UR                  S5        Uv   UR                  5         gU R                  S5        U v   g7f)zReplace ``#!python`` shebang in a stream with the correct interpreter.

:param stream: stream to modify
:param interpreter: "correct interpreter" to substitute the shebang with

:returns: A context manager, that provides an appropriately modified stream.
r      s   #!pythonz#!
N)	seekrI   ioBytesIOrL   encodereadlinerJ   r/   )r_   r`   
new_streamrU   s       r1   r   r      s      KKN{{1~$ZZ\
2k]"-4467A++m,CS!	 
 	As   C-C/c                     g )Nr^   )_s    r1   <lambda>rl      s    Tr2   recordsprefix_for_schemec                 (   [         R                  " [         R                  " 5       SSSS9n[        R                  " USSSS9nU  H+  u  pEUR                  UR                  U" U5      5      5        M-     UR                  S	5        UR                  5       $ )
a'  Construct a RECORD file.

:param records:
    ``records`` as passed into :any:`WheelDestination.finalize_installation`
:param prefix_for_scheme:
    function to get a prefix to add for RECORD entries, within a scheme

:return: A stream that can be written to file. Must be closed by the caller.
zutf-8T )encodingwrite_throughnewline,"rc   )	delimiter	quotecharlineterminatorr   )	re   TextIOWrapperrf   csvwriterwriterowto_rowrd   detach)rm   rn   r_   r{   schemerecords         r1   r   r      sw     


wdBF ZZ#TRF!&7&?@A "
KKN==?r2   textr   c           
   #     #    [        SS9n[        Ul        UR                  U 5        UR	                  5        H  nUS;  a  M  UR                  U5       H  u  p4[        U[        5      (       d   e[        R                  U5      nU(       d   eUR                  S5      n[        U[        5      (       d   eUR                  S5      nUc   e[        U[        5      (       d   e[        SUS[        S5      *  5      nX6Xx4v   M     M     g7f)	zParse ``entry_points.txt``-style files.

:param text: entire contents of the file
:return:
    name of the script, module to use, attribute to call, kind of script (cli / gui)
rF   )
delimiters)console_scriptsgui_scriptsmoduleattrsNr   _scripts)r   stroptionxformread_stringsectionsitems
isinstance_ENTRYPOINT_REGEXr=   groupr   rM   )	r   configsectionr3   valuer=   r   r   script_sections	            r1   r   r      s      S)FF
t??$<<!<<0KDdC((((%++E2EL5[[*Ffc****KK(E$$$eS))))!/7;Mc*o=M3NON55 1	 %s   D	Dc                  ^    [         R                  " S5      n [         R                  " U 5        U $ )zBGet the current umask which involves having to set it temporarily.r   )rZ   umask)masks    r1   _current_umaskr      s    88A;DHHTNKr2   pathzos.PathLike[str]c                 P    [         R                  " U S[        5       ) -  S-  5        g)z.Make the file at the provided path executable.i  I   N)rZ   chmodr   )r   s    r1   r   r     s     HHTE^---57r2   )r+   r   )=__doc__rN   
contextlibrz   rG   re   rZ   r6   r[   collectionsr   configparserr   email.messager   email.parserr   email.policyr   typingr   r	   r
   r   r   r   r   r   r   r   installer.recordsr   installer.scriptsr   r   r   r   
AllSchemes__all__r3   _WINDOWSrJ   compileVERBOSEUNICODEr<   r   r   r   r   r9   r   intr   r   contextmanagerr   r   r   r   r   r^   r2   r1   <module>r      s1   C   
  	 	 	 
 " % ! # !   *=	3	63;
 77d?'Y 

 JJ  D
 JJ
 JJ  J TU
# 
' 
0C 0C 0/3 /= /WW
W W 38_	W:H"  s x7I  > <JeFK/01(3- 78 .6C 6HU3S/3Q-R$S 6D 8uS*<%<= 8$ 8r2   