o
    4ôjáT  ã                   @  sü  d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZm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mZmZmZ dd
lmZmZ ddl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r�ddl,Z,ze-dƒ W n e.y©   ddl%m/Z/ e/ 0¡  Y nw e 1d¡Z2dCdd„Z3dDdd„Z4e5ej& 6d¡d ƒZ7dZ8dEd d!„Z9dFd"d#„Z:dGd&d'„Z;	(dHdId-d.„Z<dJd/d0„Z=dCd1d2„Z>dDd3d4„Z?dKd;d<„Z@dLd?d@„ZAG dAdB„ dBe$ƒZBdS )MzI
Create a wheel (.whl) distribution.

A wheel is a built archive format.
é    )ÚannotationsN)ÚIterableÚSequence)ÚBytesGeneratorÚ	Generator)ÚEmailPolicy)Úiglob)Úrmtree)ÚTYPE_CHECKINGÚCallableÚLiteralÚcast)ÚZIP_DEFLATEDÚ
ZIP_STORED)Útags©Úversion)ÚCommandé   )Ú__version__)Úpkginfo_to_metadata)Ú	WheelFilezsetuptools.logging)Ú_setuptools_loggingÚwheelÚnameÚstrÚreturnc                 C  s   t  dd| ¡S )zŽConvert an arbitrary string to a standard distribution name
    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    ú[^A-Za-z0-9.]+ú-)ÚreÚsub©r   © r"   úe/var/www/html/academy/tools/voices/clone/cosy-venv/lib/python3.10/site-packages/wheel/_bdist_wheel.pyÚ	safe_name2   s   r$   r   c                 C  s@   zt t | ¡ƒW S  tjy   |  dd¡} t dd| ¡ Y S w )zB
    Convert an arbitrary string to a standard version string
    ú Ú.r   r   )r   Ú_packaging_versionÚVersionÚInvalidVersionÚreplacer   r    r   r"   r"   r#   Úsafe_version9   s   þr+   r&   zcp3\dÚboolc                   C  s   t  d¡dkS )NÚPé   )ÚstructÚcalcsizer"   r"   r"   r#   Ú_is_32bit_interpreterJ   s   r1   c                   C  s   dt jd › �S )NÚpyr   )ÚsysÚversion_infor"   r"   r"   r#   Ú
python_tagN   ó   r5   Úarchive_rootú
str | Nonec                 C  s^   t  ¡ }| d¡r| durddlm} || |ƒ}ntƒ r)|dkr#d}n|dkr)d}| d	d
¡S )z0Return our platform name 'win32', 'linux_x86_64'ÚmacosxNr   )Úcalculate_macosx_platform_tagúlinux-x86_64z
linux-i686úlinux-aarch64zlinux-armv7lr   Ú_)Ú	sysconfigÚget_platformÚ
startswithZmacosx_libfiler:   r1   r*   )r7   Úresultr:   r"   r"   r#   r?   R   s   r?   TÚvarÚfallbackÚexpectedÚwarnc                 C  s:   t  | ¡}|du r|rtjd| › d�tdd� |S ||kS )zfUse a fallback value for determining SOABI flags if the needed config
    var is unset or unavailable.NzConfig variable 'z+' is unset, Python ABI tag may be incorrecté   ©Ú
stacklevel)r>   Úget_config_varÚwarningsrE   ÚRuntimeWarning)rB   rC   rD   rE   Úvalr"   r"   r#   Úget_flagf   s   

ýrM   c                  C  sŽ  t  d¡} t ¡ }| sO|dv rOttdƒrOd}d}d}tdttdƒ|dkd�r(d	}td
|dk|dko5tjdk d�r?tjdk r?d}|› t ¡ › |› |› |› �}|S | re|dkre|  	d¡red|  
d¡d  }|S | ry|dkry|  	d¡ry|  
d¡d }|S | r—|dkr—d |  
d¡dd… ¡}| dd¡ dd¡}|S | rµ|dkrµd |  
d¡dd… ¡}| dd¡ dd¡}|S | rÃ|  dd¡ dd¡}|S d}|S )zJReturn the ABI tag based on SOABI (if available) or emulate SOABI (PyPy2).ZSOABI)ÚcpÚppÚ
maxunicodeÚ ÚPy_DEBUGÚgettotalrefcountrN   )rE   ÚdÚWITH_PYMALLOC)é   é   ÚmÚcpythonr   r   r   rO   NrF   r&   r=   ÚgraalpyrV   )r>   rI   r   Úinterpreter_nameÚhasattrr3   rM   r4   Úinterpreter_versionr@   ÚsplitÚjoinr*   )ÚsoabiÚimplrT   rX   ÚuÚabir"   r"   r#   Úget_abi_tagw   sH   
ý
îñô	øûþrd   c                 C  ó   t | ƒ dd¡S ©Nr   r=   )r$   r*   r!   r"   r"   r#   Ú
safer_nameŸ   r6   rg   c                 C  re   rf   )r+   r*   r   r"   r"   r#   Úsafer_version£   r6   rh   ÚfuncúCallable[..., object]ÚpathÚexcinfoú6tuple[type[Exception], Exception, types.TracebackType]ÚNonec                 C  s   t | ||d ƒ d S )Nr   )Úremove_readonly_exc)ri   rk   rl   r"   r"   r#   Úremove_readonly§   s   rp   ÚexcÚ	Exceptionc                 C  s   t  |tj¡ | |ƒ d S )N)ÚosÚchmodÚstatÚS_IWRITE)ri   rk   rq   r"   r"   r#   ro   ¯   s   ro   c                   @  sÚ   e Zd ZdZeedœZddddedƒ› d�fd	d
dddddddd d 	e¡¡fddde
ƒ › d�fddgZg d¢Zdd„ Zdd„ Zedd„ ƒZd5d!d"„Zd#d$„ Zd%e› d�fd6d)d*„Zd7d,d-„Zed8d/d0„ƒZd9d3d4„ZdS ):Úbdist_wheelzcreate a wheel distribution)ZstoredÚdeflated)z
bdist-dir=Úbz1temporary directory for creating the distributionz
plat-name=Úpz8platform name to embed in generated filenames (default: Nú))ú	keep-tempÚkzPkeep the pseudo-installation tree around after creating the distribution archive)z	dist-dir=rT   z-directory to put final built distributions in)ú
skip-buildNz2skip rebuilding everything (for testing/debugging))ÚrelativeNz7build the archive using relative paths (default: false))zowner=rb   z@Owner name used when creating a tar file [default: current user])zgroup=ÚgzAGroup name used when creating a tar file [default: current group])Ú	universalNz'make a universal wheel (default: false)zcompression=z6zipfile compression (one of: {}) (default: 'deflated')z, zpython-tag=z3Python implementation compatibility tag (default: 'z'))zbuild-number=NzqBuild number for this particular version. As specified in PEP-0427, this must start with a digit. [default: None])zpy-limited-api=Nz?Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false))r|   r~   r   r�   c                 C  sx   d | _ d | _d | _d | _d| _d| _d | _d | _d | _d | _	d| _
d | _d | _d| _d| _tƒ | _d | _d| _d| _d S )NÚzipFrx   )Ú	bdist_dirÚdata_dirÚ	plat_nameÚplat_tagÚformatÚ	keep_tempÚdist_dirÚegginfo_dirÚroot_is_pureÚ
skip_buildr   ÚownerÚgroupr�   Úcompressionr5   Úbuild_numberÚpy_limited_apiÚplat_name_supplied)Úselfr"   r"   r#   Úinitialize_optionsø   s&   
zbdist_wheel.initialize_optionsc                 C  sJ  | j d u r|  d¡j}tj |d¡| _ | j d¡}| ¡  | j	d | _
| jd u| _z	| j| j | _W n tyB   td| j› �ƒd ‚w d}| jdgt||ƒ¢R Ž  | j ¡ pZ| j ¡  | _| jrot t| j¡sotdt› d�ƒ‚| j d¡}d	|v r�t d
¡ |d	 d  ¡ }| ¡ dv r�d| _| j d ur¡| j d d…  !¡ s£tdƒ‚d S d S )NÚbdistr   Úegg_infoz.datazUnsupported compression: )r‰   r…   rŒ   zpy-limited-api must match 'ú'r�   z=The [wheel] section is deprecated. Use [bdist_wheel] instead.r   )Ú1ÚtrueÚyesTz1Build tag (build-number) must start with a digit.)"rƒ   Úget_finalized_commandÚ
bdist_basers   rk   r_   ÚdistributionÚget_command_objÚensure_finalizedÚwheel_dist_namer„   r…   r’   Úsupported_compressionsr�   ÚKeyErrorÚ
ValueErrorÚset_undefined_optionsr‚   Úhas_ext_modulesÚhas_c_librariesr‹   r‘   r   ÚmatchÚPY_LIMITED_API_PATTERNÚget_option_dictÚlogÚwarningÚstripÚlowerr�   r�   Úisdigit)r“   rœ   r–   Zneed_optionsr   rL   r"   r"   r#   Úfinalize_options  s>   
ÿÿ
ÿÿÿzbdist_wheel.finalize_optionsc                 C  s8   t | j ¡ ƒt| j ¡ ƒf}| jr|| jf7 }d |¡S )z4Return distribution full name with - replaced with _r   )rg   r�   Úget_namerh   Úget_versionr�   r_   )r“   Ú
componentsr"   r"   r#   r    8  s   þ
zbdist_wheel.wheel_dist_namer   útuple[str, str, str]c                   s(  | j r
tt| jƒ‰ n'| jrd‰ n!| jr| j d¡s| j‰ nt| jƒ‰ tƒ r1ˆ dv r+d‰ ˆ dv r1d‰ ˆ  	¡  
dd¡ 
d	d¡ 
d
d¡‰ | jrT| jrJd}n| j}|dˆ f}|S t ¡ }t ¡ }|| }| jrp||  d¡rp| j}d}nttƒ ƒ 	¡ }||ˆ f}‡ fdd„t ¡ D ƒ}||v s’J d|› �ƒ‚|S )NÚanyr9   )r;   Úlinux_x86_64Ú
linux_i686)r<   Úlinux_aarch64Zlinux_armv7lr   r=   r&   r%   zpy2.py3ÚnoneZcp3Úabi3c                   s   g | ]	}|j |jˆ f‘qS r"   )Úinterpreterrc   )Ú.0Út©r…   r"   r#   Ú
<listcomp>u  s    ÿz'bdist_wheel.get_tag.<locals>.<listcomp>z'would build wheel with unsupported tag )r’   r   r   r…   r‹   r@   r?   rƒ   r1   r­   r*   r�   r5   r   r[   r]   r‘   rd   Úsys_tags)r“   ra   ÚtagZ	impl_nameZimpl_verÚabi_tagZsupported_tagsr"   r½   r#   Úget_tagC  sF   
ÿ
ï

ÿ
ÿzbdist_wheel.get_tagc                 C  sŒ  |   d¡}d|_d|_|   d¡}d|_| js|  d¡ | j ddd�}| j|_d|_| j|_d|_	|   d	¡}d|_
d
D ]}t|d| tj | j|¡ƒ q:d}tjdkrdtj tj | jd¡¡}| | _| _t|| jrkdnd|ƒ t d| j› �¡ |  d¡ |  ¡ \}}}	| j› d|› d|› d|	› �}
| js™| j}ntj | j|  |j¡¡}|  dd¡ t| j ¡ ƒ› dt | j !¡ ƒ› d�}tj | j|¡}|  "| j#|¡ |  $|¡ tj %| j&¡sÞt '| j&¡ tj | j&|
d ¡}t(|d| j)ƒ�}| *|¡ W d   ƒ n1 sÿw   Y  t+| jdg ƒ ,ddj-t.j/d d… Ž |f¡ | j0�sBt d| j› �¡ | j1�sDt.j/dk �r9t2| jt3d� d S t2| jt4d� d S d S d S ) NÚbuild_scriptsÚpythonTÚ	build_extFÚbuildÚinstall)Úreinit_subcommandsÚinstall_scripts)ÚheadersÚscriptsÚdataÚpurelibÚplatlibZinstall_rQ   Úntz..Zinstall_purelibZinstall_platlibzinstalling to r   Zinstall_egg_info)ÚtargetrŠ   z
.dist-infoz.whlÚwÚ
dist_filesrw   z{}.{}rF   z	removing )rV   é   )Úonerror)Zonexc)5Úreinitialize_commandÚ
executableÚforceZinplacerŒ   Úrun_commandrƒ   ÚrootÚcompileZwarn_dirZno_epÚsetattrrs   rk   r_   r„   r   ÚnormpathZinstall_libbaseÚinstall_libr‹   rª   ÚinforÂ   r    r   Ú_ensure_relativeÚinstall_baser¤   rg   r�   r°   rh   r±   Úegg2distrŠ   Úwrite_wheelfileÚexistsr‰   Úmakedirsr   r�   Zwrite_filesÚgetattrÚappendr‡   r3   r4   rˆ   Údry_runr	   rp   ro   )r“   rÃ   rÅ   rÇ   rÉ   ÚkeyZbasedir_observedÚimpl_tagrÁ   r†   Zarchive_basenamer7   Zdistinfo_dirnameZdistinfo_dirZ
wheel_pathZwfr"   r"   r#   Úrun}  s|   




ý
ÿÿÿ
ÿýÿúzbdist_wheel.runzbdist_wheel (Úwheelfile_baser   Ú	generatorc                 C  sú   ddl m} |ƒ }d|d< ||d< t| jƒ ¡ |d< | jd ur$| j|d< |  ¡ \}}}| d¡D ]}| d¡D ]}	| d¡D ]}
d	 ||	|
f¡|d
< q>q7q0t	j
 |d¡}t d|› �¡ t|dƒ�}t|dd� |¡ W d   ƒ d S 1 svw   Y  d S )Nr   )ÚMessagez1.0zWheel-Versionr   zRoot-Is-PurelibÚBuildr&   r   ÚTagZWHEELz	creating Úwb)Úmaxheaderlen)Úemail.messagerí   r   r‹   r­   r�   rÂ   r^   r_   rs   rk   rª   rÞ   Úopenr   Úflatten)r“   rë   rì   rí   Úmsgré   rÁ   r†   ra   rc   ÚplatZwheelfile_pathÚfr"   r"   r#   râ   ×  s&   

ÿÿ"ÿzbdist_wheel.write_wheelfilerk   c                 C  s6   t j |¡\}}|dd… t jkr||dd …  }|S )Nr   r   )rs   rk   Ú
splitdriveÚsep)r“   rk   Údriver"   r"   r#   rß   ï  s   zbdist_wheel._ensure_relativeúIterable[str]c              	   C  s  t dkr| jjjp
dS tƒ }| j d¡}t dkr#ttt | jjjƒ}nd|v r0|d d  	¡ }nd}d|v rGt
jdtd	d
� | |d d ¡ |sR|sRt|tƒsRd}|D ]3}t|ƒD ],}| d¡rkt d|› d�¡ qZ||vr†tj |¡r†t d|› d|› d�¡ | |¡ qZqT|S )Né9   r"   Úmetadataé*   Úlicense_filesr   Úlicense_filezEThe "license_file" option is deprecated. Use "license_files" instead.rF   rG   )zLICEN[CS]E*zCOPYING*zNOTICE*zAUTHORS*Ú~zignoring license file "z" as it looks like a backupzadding license file "z" (matched pattern "z"))Úsetuptools_major_versionr�   rý   rÿ   Úsetr©   r   r   r   r^   rJ   rE   ÚDeprecationWarningÚaddÚ
isinstanceÚlistr   Úendswithrª   Údebugrs   rk   ÚisfilerÞ   )r“   Úfilesrý   ÚpatternsÚpatternrk   r"   r"   r#   Úlicense_pathsö  sB   ý

ÿÿ
€õzbdist_wheel.license_pathsÚegginfo_pathÚdistinfo_pathc                 C  s´  ddd„}||ƒ t j |¡s?ddl}t j t j |¡d	¡}| |¡}d
|› d�}|r;t j |d ¡}|d|› d�7 }t|ƒ‚t j |¡rPt	||ƒ}	t  
|¡ n?t j |d¡}
t	||
ƒ}	tj||dd„ d� t j |d¡}t|dd��}| ¡  ¡ }W d  ƒ n1 s„w   Y  |s�||ƒ t j |d¡}tdddd�}t|ddd��}t||d� |	¡ W d  ƒ n1 s¸w   Y  | jD ]}t j |¡}t |t j ||¡¡ qÀ||ƒ dS )z:Convert an .egg-info directory into a .dist-info directoryrz   r   r   rn   c                 S  sP   t j | ¡rt j | ¡st j | ¡rt | ¡ dS t j | ¡r&t  | ¡ dS dS )z-Appropriately delete directory, file or link.N)rs   rk   rã   ÚislinkÚisdirÚshutilr	   Úunlink)rz   r"   r"   r#   Úadios&  s
   $ÿz#bdist_wheel.egg2dist.<locals>.adiosr   Nz
*.egg-infozEgg metadata expected at z but not foundz (z) found - possible misnamed archive file?)úPKG-INFOc                 S  s   h d£S )N>   znot-zip-safezSOURCES.txtr  zrequires.txtr"   )ÚxÚyr"   r"   r#   Ú<lambda>L  s    z&bdist_wheel.egg2dist.<locals>.<lambda>)Úignorezdependency_links.txtzutf-8)ÚencodingÚMETADATATF)Úutf8Úmangle_from_Úmax_line_lengthrÑ   )Úpolicy)rz   r   r   rn   )rs   rk   rã   Úglobr_   ÚdirnameÚbasenamer£   r
  r   Úmkdirr  Úcopytreeró   Úreadr¬   r   r   rô   r  Úcopy)r“   r  r  r  r!  ÚpatÚpossibleÚerrZaltZpkg_infoZpkginfo_pathZdependency_links_pathZdependency_links_fileÚdependency_linksZpkg_info_pathZserialization_policyÚoutZlicense_pathÚfilenamer"   r"   r#   rá   #  sP   



ýÿýÿ
zbdist_wheel.egg2dist)r   r³   )rë   r   rì   r   )rk   r   r   r   )r   rû   )r  r   r  r   )Ú__name__Ú
__module__Ú__qualname__Údescriptionr   r   r¡   r?   r‡   r_   r5   Úuser_optionsÚboolean_optionsr”   r¯   Úpropertyr    rÂ   rê   Úwheel_versionrâ   rß   r  rá   r"   r"   r"   r#   rw   ´   sZ    þÿýÿýýÍ:+


:
[ÿ
,rw   )r   r   r   r   )r   r   r   r   )r   r,   )r   r   )r7   r8   r   r   )TT)
rB   r   rC   r,   rD   r,   rE   r,   r   r,   )r   r8   )ri   rj   rk   r   rl   rm   r   rn   )ri   rj   rk   r   rq   rr   r   rn   )CÚ__doc__Ú
__future__r   Úloggingrs   r   r  ru   r/   r3   r>   rJ   Úcollections.abcr   r   Úemail.generatorr   r   Úemail.policyr   r!  r   r	   Útypingr
   r   r   r   Úzipfiler   r   Ú
setuptoolsÚ	packagingr   r   r'   r   rQ   r   r5  Z	_metadatar   Z	wheelfiler   ÚtypesÚ
__import__ÚImportErrorr   Ú	configureÚ	getLoggerrª   r$   r+   Úintr^   r  r¨   r1   r5   r?   rM   rd   rg   rh   rp   ro   rw   r"   r"   r"   r#   Ú<module>   sb    ü





ÿ

(


