
    R
hZ1                       d dl mZ d dlZd dlZd dlmZmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ ddlmZ ddlmZ ddlmZ ddl m!Z!  ej"        dej#                  Z$ ej"        dej#                  Z% ej"        d          Z& ej"        d          Z' eddd           Z(de Z)d4d Z*d5d"Z+d6d$Z, G d% d&e'          Z- G d( d)e-          Z. G d* d+e.          Z/ G d, d-e-          Z0d7d3Z1dS )8    )annotationsN)ABCMetaabstractmethod)defaultdict)Iterator)Message)Parser)EmailPolicy)iglob)Path)dedent)ZipFile   )__version__)generate_requirements)	parse_tag)	WheelFilez]
    (?P<name>.+?)-(?P<ver>.+?)
    (-(?P<pyver>py\d\.\d+)
     (-(?P<arch>.+?))?
    )?.egg$zL
    ^(?P<name>.+?)-(?P<ver>.+?)
    (-(?P<pyver>py\d\.\d+)
    )?.egg-info/z>\.(?P<platform>win32|win-amd64)(?:-(?P<pyver>py\d\.\d))?\.exe$z8\.(?P<abi>[a-z0-9]+)-(?P<platform>win32|win_amd64)\.pyd$TF)utf8mangle_from_max_line_lengthzwheel requiresstrmetadatar   returnNonec                   d }t          t                    }|                                 D ]i}|                                }|s|                    d          r |                    d          r|dd         }N||                             |           jt          |          D ]\  }}|                    ||           d S )N[]   )	r   list
splitlinesstrip
startswithendswithappendr   
add_header)r   r   extrarequirementslinekeyvalues          \/var/www/html/01_SiteInternet/03_Maps/venv/lib/python3.11/site-packages/wheel/cli/convert.pyconvert_requiresr.   0   s    E0;D0A0AL##%% 	) 	)zz|| 	??3 	DMM#$6$6 	2JEU""4((((+L99 ( (
UC''''( (    pkginfoc                   t                                          |           }|                                D ]\  }}|                                }|dk    r |dk    r|                                }d                    |d                                         t          d                    |dd                              df          }|                    |           |dk    r|	                    dd|            |d	k    r|	                    dd
|            |	                    ||           |
                    dd           d S )NUNKNOWNdescription
r   r   z	home-pagezProject-URLz
Homepage, zdownload-urlz
Download, zMetadata-Versionz2.4)r	   parsestritemslowerr"   joinlstripr   set_payloadr'   replace_header)r0   r   parsed_messager+   r,   	key_lowerdescription_liness          r-   convert_pkg_infor?   B   si   XX&&w//N$**,, , ,
UIIKK	I%% % 0 0 2 2II%a(//11499%6qrr%:;;<< E   ''''+%%/CE/C/CDDDD.((/CE/C/CDDDDU++++.66666r/   namec                z    t          j        dd|                                                               dd          S )Nz[-_.]+-_)resubr7   replace)r@   s    r-   	normalizerG   ]   s2    6)S$''--//77SAAAr/   c                      e Zd ZU ded<   ded<   dZded<   dZded<   dZded	<   d
ed<   edd            Ze	dd            Z
dS )ConvertSourcer   r@   versionzpy2.py3pyvernoneabianyplatformr   r   r   c                &    | j          d| j         dS )NrB   
.dist-info)r@   rJ   selfs    r-   dist_info_dirzConvertSource.dist_info_diri   s    )66dl6666r/   Iterator[tuple[str, bytes]]c                    d S N rR   s    r-   generate_contentszConvertSource.generate_contentsm   s    r/   N)r   r   r   rU   )__name__
__module____qualname____annotations__rK   rM   rO   propertyrT   r   rY   rX   r/   r-   rI   rI   a   s         IIILLLECH7 7 7 X7    ^  r/   rI   )	metaclassc                      e Zd ZddZd	dZdS )
EggFileSourcepathr   c                &   t                               |j                  x}st          d|j                   || _        t          |                    d                    | _        |                    d          | _        |                    d          x}rf|                    dd          | _	        |                    d          x}r4| j	                            dd	          | _
        t          |          | _        t                      | _        d S )
NzInvalid egg file name: r@   verrK   . archpycp)egg_filename_rematchr@   
ValueErrorrc   rG   grouprJ   rF   rK   rM   rO   r   r   )rS   rc   rl   rK   rh   s        r-   __init__zEggFileSource.__init__s   s    (..ty999 	DBtyBBCCC 	ekk&1122	{{5))KK(((5 	0sB//DJ{{6***t 0:--dD99 )$		r/   r   rU   c              #    K   t          | j        d          5 }t          |                                          D ]}|                    d          r|                    d          r|dk    r>|                    |                              d          }t          || j	                   nk|dk    r>|                    |                              d          }t          || j	                   n'|dk    r!| j         d|                    |          fV  ||                    |          fV  	 d d d            d S # 1 swxY w Y   d S )	Nr/z	EGG-INFO/zEGG-INFO/requires.txtutf-8zEGG-INFO/PKG-INFOzEGG-INFO/entry_points.txt/entry_points.txt)r   rc   sortednamelistr%   r$   readdecoder.   r   r?   rT   )rS   zip_filefilenamer   r0   s        r-   rY   zEggFileSource.generate_contents   s     TY$$ 	8"8#4#4#6#677 8 8$$S))  &&{33 #:::#+==#:#:#A#A'#J#J(4=AAAA!%888"*--"9"9"@"@"I"I($-@@@@!%@@@#1DDD$MM(33   
  h 7 777777/8	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s   DD??EENrc   r   rZ   )r[   r\   r]   ro   rY   rX   r/   r-   rb   rb   r   s<        " " " " 8 8 8 8 8 8r/   rb   c                      e Zd ZddZdS )EggDirectorySourcer   rU   c              #    K   t          j        | j                  D ]d\  }}}t          |          D ]L}t	          ||          }|j        j        dk    r|j        dk    r+|                    d          }t          || j	                   n|j        dk    r~|                    d          }t          || j	                   | j	                            d          x}rt          |          | _        | j	                            d          x}	r|	| _        n+|j        dk    r | j         d|                                fV  t!          |                    | j                            |                                fV  Nfd S )	NzEGG-INFOrequires.txtrs   PKG-INFONameVersionentry_points.txtrt   )oswalkrc   ru   r   parentr@   	read_textr.   r   r?   getrG   rJ   rT   
read_bytesr   relative_to)
rS   dirpathrC   	filenamesrz   rc   r   r0   r@   rJ   s
             r-   rY   z$EggDirectorySource.generate_contents   s     %'WTY%7%7 	J 	J!GQ	"9-- J JGX..;#z11yN22#'>>'#:#:(4=AAAAj00"&.."9"9($-@@@#'=#4#4V#<#<<4 8(1$DI&*m&7&7	&B&BB7 3+2DL&888#1DDD OO--   
  $**4955668I8IIIIII/J	J 	Jr/   NrZ   )r[   r\   r]   rY   rX   r/   r-   r}   r}      s.        J J J J J Jr/   r}   c                  "    e Zd ZdZd	dZd
dZdS )WininstFileSourcea  
    Handles distributions created with ``bdist_wininst``.

    The egginfo filename has the format::

        name-ver(-pyver)(-arch).egg-info

    The installer filename has the format::

        name-ver.arch(-pyver).exe

    Some things to note:

    1. The installer filename is not definitive. An installer can be renamed
       and work perfectly well as an installer. So more reliable data should
       be used whenever possible.
    2. The egg-info data should be preferred for the name and version, because
       these come straight from the distutils metadata, and are mandatory.
    3. The pyver from the egg-info data should be ignored, as it is
       constructed from the version of Python used to build the installer,
       which is irrelevant - the installer filename is correct here (even to
       the point that when it's not there, any version is implied).
    4. The architecture must be taken from the installer filename, as it is
       not included in the egg-info data.
    5. Architecture-neutral installers still have an architecture because the
       installer format itself (being executable) is architecture-specific. We
       should therefore ignore the architecture if the content is pure-python.
    rc   r   c                   || _         t                      | _        t                              |j                  x}rYt          |                    d                    | _        |                    d          x}r|	                    dd          | _
        dx}}t          | j                   5 }|                                D ]
}|                    dd          \  }}|st                              |          x}rvd}t          |                    d	                    | _        |                    d
          | _        |                    d          x}r|	                    dd          | _
        nT|sRt"                              |          x}r6d}|                    d          | _        |                    d          | _        |r|r nd d d            d S # 1 swxY w Y   d S )NrO   rK   rf   rg   Frr   r   Tr@   re   rM   )rc   r   r   
wininst_researchr@   rG   rn   rO   rF   rK   r   rv   splitegg_info_rerl   rJ   pyd_rerM   )	rS   rc   rl   rK   egg_info_found	pyd_foundry   rz   prefixs	            r-   ro   zWininstFileSource.__init__   s   			 %%di0005 	4%ekk*&=&=>>DMG,,,u 4"]]333
 &+*TY 	8$--//  #+>>#q#9#9 % 	<K4E4Eh4O4O+O5 	<%)N )%++f*=*= > >DI#(;;u#5#5DL %G 4 44u <%*]]3%;%;
" <x1H1H(H < $I${{511DH$)KK
$;$;DM! i E	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   -D!GG"Gr   rU   c              #  j  K   | j          d| j         d}| j          d| j         d}t          | j        d          5 }t	          |                                          D ]:}|                    d          r|                    dd          \  }}t          	                    |          r|
                    dd          d         }|dk    r>|                    |                              d	          }t          || j                   nf|d
k    r>|                    |                              d	          }	t          |	| j                   n"|dk    r| d|                    |          fV  |dk    r| d| }||                    |          fV  <	 d d d            d S # 1 swxY w Y   d S )NrB   rQ   z.datarq   rr   r   r    r   rs   r   r   rt   SCRIPTSz	/scripts/)r@   rJ   r   rc   ru   rv   r%   r   r   r   rsplitrw   rx   r.   r   r?   )
rS   rT   data_dirry   rz   r   target_filenamebasenamer   r0   s
             r-   rY   z#WininstFileSource.generate_contents   s7     9??t|???i55$,555TY$$ 	?"8#4#4#6#677 ? ?$$S))  +3..a*@*@'%%o66 N.55c1==bAH>11#+==#:#:#A#A'#J#J(4=AAAA!Z//"*--"9"9"@"@"I"I($-@@@@!%777,???$MM(33   
 y(()1&M&MO&M&MO &x}}X'>'>>>>>>7?	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   EF((F,/F,Nr{   rZ   )r[   r\   r]   __doc__ro   rY   rX   r/   r-   r   r      sF         :   <? ? ? ? ? ?r/   r   files	list[str]dest_dirverboseboolc                R   | D ]}t          |          D ]}t          |          }|j        dk    r4|                                rt	          |          }nt          |          }nt          |          }|rt          | ddd           t          |          |j         d|j	         d|j
         d|j         d|j         d
z  }t          |d          5 }|                                D ]\  }	}
|                    |	|
           |                    |j         d	|j                            t&          
                              d                     t+                      }|                    dd           |                    dt.                     |                    dt1          |j        dk                                                         t5          |j
         d|j         d|j                   }t7          |d           D ]%}|                    dt1          |                     &|                    |j         d|                    t&          
                              d                     d d d            n# 1 swxY w Y   |rt          d           d S )Nz.eggz...Trg   )flushendrB   z.whlwz	/METADATA)policyrs   zWheel-Versionz1.0	GeneratorzRoot-Is-PurelibrN   c                    | j         S rW   )interpreter)tags    r-   <lambda>zconvert.<locals>.<lambda>A  s     r/   )r+   Tagz/WHEELOK)r   r   suffixis_dirr}   rb   r   printr@   rJ   rK   rM   rO   r   rY   writestrrT   r   	as_stringserialization_policyencoder   r'   	GENERATORr   r7   r   ru   )r   r   r   patarchiverc   source	dest_path	wheelfilename_or_zinfocontentswheel_messagetagsr   s                 r-   convertr     s9    1 1Szz 0	 0	G==D{f$$;;== 1,>t,D,DFF*400FF*400 ;oooTr::::X; * * * *&, * * * *O* * *I 9c** i/5/G/G/I/I @ @+M8&&}h???? ""+666O--5I-JJQQ    !(		((%@@@((i@@@((%s6?e+C'D'D'J'J'L'L   !FL!Q!Q6:!Q!Q!Q!QRR!$,G,GHHH > >C!,,UCHH====""+333!++3G+HHOO   /              <  da0	1 1s   F%JJJ)r   r   r   r   r   r   )r0   r   r   r   )r@   r   r   r   )r   r   r   r   r   r   r   r   )2
__future__r   os.pathr   rD   abcr   r   collectionsr   collections.abcr   email.messager   email.parserr	   email.policyr
   globr   pathlibr   textwrapr   zipfiler   rg   r   r   r   vendored.packaging.tagsr   r   r   compileVERBOSErk   r   r   r   r   r   r.   r?   rG   rI   rb   r}   r   r   rX   r/   r-   <module>r      s   " " " " " "  				 ' ' ' ' ' ' ' ' # # # # # # $ $ $ $ $ $ ! ! ! ! ! !       $ $ $ $ $ $                               , , , , , , / / / / / / ! ! ! ! ! !"*
 J  bj J  RZE 
 
O	P	P"{	   
 #[""	( ( ( ($7 7 7 76B B B B    g    "*8 *8 *8 *8 *8M *8 *8 *8ZJ J J J J J J J:[? [? [? [? [? [? [? [?|2 2 2 2 2 2r/   