a
    ñ»j¤S  ã                   @  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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mZmZmZmZm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) e�rddl*Z*dddœdd„Z+dddœdd„Z,e-e! .d¡d ƒZ/dZ0ddœdd„Z1ddœdd„Z2d dd!œd"d#„Z3d:dddddd%œd&d'„Z4d dœd(d)„Z5dddœd*d+„Z6dddœd,d-„Z7d.dd/d0d1œd2d3„Z8d.dd4d0d5œd6d7„Z9G d8d9„ d9e ƒZ:dS );zI
Create a wheel (.whl) distribution.

A wheel is a built archive format.
é    )ÚannotationsN)ÚBytesGeneratorÚ	Generator)ÚEmailPolicy)Úlog)Úiglob)Úrmtree)ÚTYPE_CHECKINGÚCallableÚIterableÚLiteralÚSequenceÚcast)ÚZIP_DEFLATEDÚ
ZIP_STOREDé   )ÚCommandÚ__version__)Úpkginfo_to_metadata)Útags©Úversion)Ú	WheelFileÚstr)ÚnameÚ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!   úDE:\soccer\ml_env\Lib\site-packages\setuptools/command/bdist_wheel.pyÚ	safe_name#   s    r#   )r   r   c                 C  sD   zt t | ¡ƒW S  tjy>   |  dd¡} t dd| ¡ Y S 0 dS )zB
    Convert an arbitrary string to a standard version string
    ú Ú.r   r   N)r   Ú_packaging_versionÚVersionÚInvalidVersionÚreplacer   r   r   r!   r!   r"   Úsafe_version*   s
    r*   r%   zcp3\dÚbool©r   c                   C  s   t  d¡dkS )NÚPé   )ÚstructÚcalcsizer!   r!   r!   r"   Ú_is_32bit_interpreter;   s    r1   c                   C  s   dt jd › �S )NÚpyr   )ÚsysÚversion_infor!   r!   r!   r"   Ú
python_tag?   s    r5   z
str | None)Úarchive_rootr   c                 C  s^   t  ¡ }| d¡r2| dur2ddlm} || |ƒ}n tƒ rR|dkrFd}n|dkrRd}| 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extern.wheel.macosx_libfiler8   r1   r)   )r6   Úresultr8   r!   r!   r"   r=   C   s    r=   T)ÚvarÚfallbackÚexpectedÚwarnr   c                 C  s:   t  | ¡}|du r2|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 incorrectr   ©Ú
stacklevel)r<   Úget_config_varÚwarningsrC   ÚRuntimeWarning)r@   rA   rB   rC   Úvalr!   r!   r"   Úget_flagW   s    

ýrJ   c                  C  sŒ  t  d¡} t ¡ }| sœ|dv rœttdƒrœd}d}d}tdttdƒ|dkd�rPd	}td
|dk|dkojtjdk d�r~tjdk r~d}|› t ¡ › |› |› |› �}nì| rÆ|dkrÆ|  	d¡rÆd|  
d¡d  }nÂ| rì|dkrì|  	d¡rì|  
d¡d }nœ| �r*|dk�r*d |  
d¡dd… ¡}| dd¡ dd¡}n^| �rh|dk�rhd |  
d¡dd… ¡}| dd¡ dd¡}n | �r„|  dd¡ dd¡}nd}|S )zJReturn the ABI tag based on SOABI (if available) or emulate SOABI (PyPy2).ZSOABI)ÚcpÚppÚ
maxunicodeÚ ÚPy_DEBUGÚgettotalrefcountrK   )rC   ÚdÚWITH_PYMALLOC)é   é   ÚmÚcpythonr   é   r   rL   Nr   r%   r;   ÚgraalpyrS   )r<   rF   r   Úinterpreter_nameÚhasattrr3   rJ   r4   Úinterpreter_versionr>   ÚsplitÚjoinr)   )ÚsoabiÚimplrQ   rU   ÚuÚabir!   r!   r"   Úget_abi_tagh   s>    
ýürb   c                 C  s   t | ƒ dd¡S ©Nr   r;   )r#   r)   r    r!   r!   r"   Ú
safer_name�   s    rd   c                 C  s   t | ƒ dd¡S rc   )r*   r)   r   r!   r!   r"   Úsafer_version”   s    re   zCallable[..., object]z6tuple[type[Exception], Exception, types.TracebackType]ÚNone)ÚfuncÚpathÚexcinfor   c                 C  s   t | ||d ƒ d S )NrW   )Úremove_readonly_exc)rg   rh   ri   r!   r!   r"   Úremove_readonly˜   s    rk   Ú	Exception)rg   rh   Úexcr   c                 C  s   t  |tj¡ | |ƒ d S )N)ÚosÚchmodÚstatÚS_IWRITE)rg   rh   rm   r!   r!   r"   rj       s    rj   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œdd„Zdd„ Zedd „ ƒZd!dœd"d#„Zd$d%„ Zd&e› d'�fd(d(d)œd*d+„Zd(d(d,œd-d.„Zed/dœd0d1„ƒZd(d(d2œd3d4„ZdS )5Ú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=rQ   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=r`   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])rw   ry   rz   r|   rf   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ÚzipFrs   )Ú	bdist_dirÚdata_dirÚ	plat_nameÚplat_tagÚformatÚ	keep_tempÚdist_dirÚegginfo_dirÚroot_is_pureÚ
skip_buildrz   ÚownerÚgroupr|   Úcompressionr5   Úbuild_numberÚpy_limited_apiÚplat_name_supplied)Úselfr!   r!   r"   Úinitialize_optionsé   s&    zbdist_wheel.initialize_optionsc                 C  sR  | j d u r&|  d¡j}tj |d¡| _ | j d¡}| ¡  | j	d | _
| jd u| _z| j| j | _W n$ tyˆ   td| j› �ƒd ‚Y n0 d}| jdgt||ƒ¢R Ž  | j ¡ p¸| j ¡  | _| jrât t| j¡sâtdt› d�ƒ‚| j d¡}d	|v �r&t d
¡ |d	 d  ¡ }| ¡ dv �r&d| _| j d u�rN| j d d…  !¡ �sNtdƒ‚d S )NÚbdistÚwheelÚ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.rW   )Ú1ÚtrueÚyesTz1Build tag (build-number) must start with a digit.)"r~   Úget_finalized_commandÚ
bdist_basern   rh   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_dictr   rC   ÚstripÚlowerr|   r‹   Úisdigit)rŽ   r˜   r’   Zneed_optionsr‘   rI   r!   r!   r"   Úfinalize_optionsþ   s6    
ÿ
ÿ

 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   )rd   r™   Úget_namere   Úget_versionr‹   r]   )rŽ   Ú
componentsr!   r!   r"   rœ   '  s    þzbdist_wheel.wheel_dist_nameztuple[str, str, str]c                   s(  | j rtt| jƒ‰ nN| jr d‰ nB| jr:| j d¡s:| j‰ n
t| jƒ‰ tƒ rbˆ dv rVd‰ ˆ dv rbd‰ ˆ  	¡  
dd¡ 
d	d¡ 
d
d¡‰ | jr¦| jr”d}n| j}|dˆ f}n~t ¡ }t ¡ }|| }| jrÞ||  d¡rÞ| j}d}nttƒ ƒ 	¡ }||ˆ f}‡ fdd„t ¡ D ƒ}||v �s$J d|› �ƒ‚|S )NÚanyr7   )r9   Ú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!   )Úinterpreterra   )Ú.0Út©r€   r!   r"   Ú
<listcomp>d  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   rY   r[   rŒ   rb   Úsys_tags)rŽ   r_   ÚtagZ	impl_nameZimpl_verÚabi_tagÚsupported_tagsr!   r¶   r"   Úget_tag2  sF    
ÿ

ÿÿþzbdist_wheel.get_tagc                 C  sˆ  |   d¡}d|_d|_|   d¡}d|_| js6|  d¡ | j ddd�}| j|_d|_| j|_d|_	|   d	¡}d|_
d
D ] }t|d| tj | j|¡ƒ qtd}tjdkrÈtj tj | jd¡¡}| | _| _t|| jrÖdnd|ƒ t d| j› �¡ |  d¡ |  ¡ \}}}	| j› d|› d|› d|	› �}
| j�s4| 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0    Y  t+| jdg ƒ ,ddj-t.j/d d… Ž |f¡ | j0�s„t d| j› �¡ | j1�s„t.j/dk �rvt2| jt3d� nt2| jt4d� d S ) NÚbuild_scriptsÚpythonTÚ	build_extFÚbuildÚinstall)Úreinit_subcommandsÚinstall_scripts)ÚheadersÚscriptsÚdataÚpurelibÚplatlibÚinstall_rN   Úntz..Úinstall_purelibÚinstall_platlibzinstalling to r   Úinstall_egg_info)Útargetr…   z
.dist-infoz.whlÚwÚ
dist_filesrr   z{}.{}r   z	removing )rS   é   )Úonerror)Úonexc)5Úreinitialize_commandÚ
executableÚforceZinplacer‡   Úrun_commandr~   ÚrootÚcompileÚwarn_dirZno_epÚsetattrrn   rh   r]   r   r   ÚnormpathÚinstall_libbaseÚinstall_libr†   r   Úinfor¼   rœ   rz   Ú_ensure_relativeÚinstall_baser    rd   r™   rª   re   r«   Úegg2distr…   Úwrite_wheelfileÚexistsr„   Úmakedirsr   rŠ   Zwrite_filesÚgetattrÚappendr‚   r3   r4   rƒ   Údry_runr   rk   rj   )rŽ   r½   r¿   rÁ   rÃ   ÚkeyZbasedir_observedÚimpl_tagrº   r�   Zarchive_basenamer6   Zdistinfo_dirnameÚdistinfo_dirÚ
wheel_pathZwfr!   r!   r"   Úrunl  st    




ý
ÿÿÿ
*ýzbdist_wheel.runzsetuptools (ú)r   )Úwheelfile_baseÚ	generatorc                 C  sø   ddl m} |ƒ }d|d< ||d< t| jƒ ¡ |d< | jd urH| j|d< |  ¡ \}}}| d¡D ]8}| d¡D ](}	| d¡D ]}
d	 ||	|
f¡|d
< q|qnq`t	j
 |d¡}t d|› �¡ t|dƒ�"}t|dd� |¡ W d   ƒ n1 sê0    Y  d S )Nr   )ÚMessagez1.0zWheel-Versionr   zRoot-Is-PurelibZBuildr%   r   ÚTagÚWHEELz	creating Úwb)Úmaxheaderlen)Úemail.messagerñ   r   r†   r§   r‹   r¼   r\   r]   rn   rh   r   rß   Úopenr   Úflatten)rŽ   rï   rð   rñ   Úmsgrê   rº   r�   r_   ra   ÚplatZwheelfile_pathÚfr!   r!   r"   rã   Ä  s     

zbdist_wheel.write_wheelfile)rh   r   c                 C  s6   t j |¡\}}|dd… t jkr2||dd …  }|S )Nr   rW   )rn   rh   Ú
splitdriveÚsep)rŽ   rh   Údriver!   r!   r"   rà   Ü  s    zbdist_wheel._ensure_relativezIterable[str]c              	   C  s  t dkr| jjjpdS tƒ }| j d¡}t dkrFttt | jjjƒ}nd|v r`|d d  	¡ }nd}d|v rŽt
jdtd	d
� | |d d ¡ |s¤|s¤t|tƒs¤d}|D ]f}t|ƒD ]X}| d¡rÖt d|› d�¡ q´||vr´tj |¡r´t d|› d|› d�¡ | |¡ q´q¨|S )Né9   r!   Úmetadataé*   Úlicense_filesrW   Zlicense_filezEThe "license_file" option is deprecated. Use "license_files" instead.r   rD   )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\   rG   rC   ÚDeprecationWarningÚaddÚ
isinstanceÚlistr   Úendswithr   Údebugrn   rh   Úisfilerß   )rŽ   Úfilesr   ÚpatternsÚpatternrh   r!   r!   r"   Úlicense_pathsã  s>    ý

ÿÿzbdist_wheel.license_paths)Úegginfo_pathÚdistinfo_pathc                 C  sÂ  dd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 |¡r¦t	||ƒ}	t  
|¡ n‚t j |d¡}
t	||
ƒ}	tj||dd„ d� t j |d¡}t|dd��}| ¡  ¡ }W d  ƒ n1 �s0    Y  |�s(||ƒ t j |d¡}tdddd�}t|ddd��"}t||d� |	¡ W d  ƒ n1 �s|0    Y  | jD ](}t j |¡}t |t j ||¡¡ �qŒ||ƒ dS )z:Convert an .egg-info directory into a .dist-info directoryr   rf   )ru   r   c                 S  sJ   t j | ¡r0t j | ¡s0t j | ¡r0t | ¡ nt j | ¡rFt  | ¡ dS )z-Appropriately delete directory, file or link.N)rn   rh   rä   ÚislinkÚisdirÚshutilr   Úunlink)ru   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requires.txtr  znot-zip-safezSOURCES.txtr!   )ÚxÚyr!   r!   r"   Ú<lambda>9  ó    z&bdist_wheel.egg2dist.<locals>.<lambda>)Úignorezdependency_links.txtzutf-8)ÚencodingÚMETADATATF)Úutf8Úmangle_from_Úmax_line_lengthrÏ   )Úpolicy)rn   rh   rä   Úglobr]   ÚdirnameÚbasenamerŸ   r  r   Úmkdirr  Úcopytreer÷   Úreadr¦   r   r   rø   r  Úcopy)rŽ   r  r  r  r$  ÚpatÚpossibleÚerrZaltÚpkg_infoZpkginfo_pathZdependency_links_pathZdependency_links_fileZdependency_linksZpkg_info_pathZserialization_policyÚoutZlicense_pathÚfilenamer!   r!   r"   râ     sL    


ý,ý2
zbdist_wheel.egg2dist)Ú__name__Ú
__module__Ú__qualname__Údescriptionr   r   r�   r=   r‚   r]   r5   Úuser_optionsÚboolean_optionsr�   r©   Úpropertyrœ   r¼   rí   r   rã   rà   r  râ   r!   r!   r!   r"   rr   ¥   sX   þÿýÿýýÍ:)

:Y
ÿ,rr   )TT);Ú__doc__Ú
__future__r   rn   r   r  rp   r/   r3   r<   rG   Úemail.generatorr   r   Úemail.policyr   Ú	distutilsr   r$  r   r   Útypingr	   r
   r   r   r   r   Úzipfiler   r   rN   r   r   Zextern.wheel.metadatar   Zextern.packagingr   r   r&   Zextern.wheel.wheelfiler   Útypesr#   r*   Úintr\   r  r¤   r1   r5   r=   rJ   rb   rd   re   rk   rj   rr   r!   r!   r!   r"   Ú<module>   sL     ÿ(