
    lc]K                       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
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 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& ddl'm(Z( ej)        Z)ej*        Z* e+ ej,        d          j-        .                    d          d                   Z/dZ0d Z1d Z2d dZ3d Z4d Z5d Z6d Z7 G d de          Z8dS )!zI
Create a wheel (.whl) distribution.

A wheel is a built archive format.
    )annotationsN)OrderedDict)BytesGenerator	Generator)EmailPolicy)iglob)BytesIO)rmtree)ZIP_DEFLATED
ZIP_STORED)Command   )__version__)calculate_macosx_platform_tag)pkginfo_to_metadata)log)tags)	WheelFile
setuptools.zcp3\dc                 ,    dt           j        d          S )Npyr   )sysversion_info     1lib/python3.11/site-packages/wheel/bdist_wheel.py
python_tagr   +   s    % #%%%r   c                    t          j                    }|                    d          r| t          | |          }n|dk    rt          j        dk    rd}|                    dd          S )z0Return our platform name 'win32', 'linux_x86_64'macosxNlinux-x86_64z
linux-i686-_)	sysconfigget_platform
startswithr   r   maxsizereplace)archive_rootresults     r   r&   r&   /   sr    #%%F"" | .|VDD	>	! ckZ&? >>#s###r   Tc                    t          j        |           }|2|r.t          j        d                    |           t
          d           |S ||k    S )zfUse a fallback value for determining SOABI flags if the needed config
    var is unset or unavailable.Nz>Config variable '{}' is unset, Python ABI tag may be incorrect   )r%   get_config_varwarningswarnformatRuntimeWarning)varfallbackexpectedr0   vals        r   get_flagr7   ;   s_     
"3
'
'C
  	M%vc{{	   (?r   c                    t          j        d          } t          j                    }| s|dv rt	          t
          d          rd}d}d}t          dt	          t
          d          |dk              rd	}t          d
|dk    |dk    ot
          j        dk               rt
          j        dk     rd}| t          j                     | | | }n| r%|dk    rd| 	                    d          d         z   }n| ra|dk    r[d
                    | 	                    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).SOABI)cppp
maxunicode Py_DEBUGgettotalrefcountr:   )r0   dWITH_PYMALLOC)      mr#   r   r;   Nr-   r   r$   )r%   r.   r   interpreter_namehasattrr   r7   r   interpreter_versionsplitjoinr)   )soabiimplr@   rD   uabis         r   get_abi_tagrN   K   s   $W--E ""D T\) gc<.H.H J-? @ @PTVVV 	ADL$,<3#3f#<
 
 
 	 '		
 A<t/11<1<a<<<	 	44< 	U[[%%a((	 44< hhu{{3''+,,kk#s##++C55	 mmC%%--c377Jr   c                H    t          |                               dd          S Nr#   r$   )	safe_namer)   )names    r   
safer_namerS   l   s    T??""3,,,r   c                H    t          |                               dd          S rP   )safe_versionr)   )versions    r   safer_versionrW   p   s       ((c222r   c                    t          t          |d                              t          j        |t          j                    | |           d S )Nr   )printstroschmodstatS_IWRITE)funcpathexcinfos      r   remove_readonlyrb   t   s?    	#gaj//HT4=!!!DJJJJJr   c                  L   e Zd ZdZ edefdefg          Zdddd ed          z  fd	d
dddddddd	                    d
                    e                    fddd e            z  fddgZg dZd Zd Zed             Zd Zd Zdez   dz   fdZd  Zed!             Zd" ZdS )#bdist_wheelzcreate a wheel distributionstoreddeflated)z
bdist-dir=bz1temporary directory for creating the distributionz
plat-name=pz;platform name to embed in generated filenames (default: %s)N)	keep-tempkzPkeep the pseudo-installation tree around after creating the distribution archive)z	dist-dir=r@   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=rL   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=z7Python implementation compatibility tag (default: '%s'))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))ri   rk   rl   rn   c                (   d | _         d | _        d | _        d | _        d| _        d| _        d | _        d | _        d | _        d | _	        d| _
        d | _        d | _        d| _        d| _        t                      | _        d | _        d| _        d| _        d S )NzipFrf   )	bdist_dirdata_dir	plat_nameplat_tagr1   	keep_tempdist_diregginfo_dirroot_is_pure
skip_buildrl   ownergrouprn   compressionr   build_numberpy_limited_apiplat_name_supplied)selfs    r   initialize_optionszbdist_wheel.initialize_options   s     

%$,, #"'r   c                   | j         ?|                     d          j        }t          j                            |d          | _         | j        dz   | _        | j        d u| _	        	 | j
        | j                 | _        n%# t          $ r t          d| j                   w xY wd} | j        dgt          ||          R   | j                                        p| j                                         | _        | j        r6t+          j        t.          | j                  st          dt.          z            | j                            d          }d|v rQt3          j        d           |d         d	                                         }|                                d
v rd| _        | j        0| j        d d	                                         st          d          d S d S )Nbdistwheelz.datazUnsupported compression: )rv   rs   ry   zpy-limited-api must match '%s'rn   z=The [wheel] section is deprecated. Use [bdist_wheel] instead.r   )1trueyesTz1Build tag (build-number) must start with a digit.) rq   get_finalized_command
bdist_baser[   r`   rI   wheel_dist_namerr   rs   r   supported_compressionsr|   KeyError
ValueErrorset_undefined_optionsrp   distributionhas_ext_moduleshas_c_librariesrx   r~   rematchPY_LIMITED_API_PATTERNget_option_dictr   warningstriplowerrn   r}   isdigit)r   r   need_optionsr   r6   s        r   finalize_optionszbdist_wheel.finalize_options   s   > 	?33G<<GJW\\*g>>DN,w6"&."<	M#:4;KLD 	M 	M 	MK9IKKLLL	M ?""7MS|-L-LMMMM --//V43D3T3T3V3V
  	Xrx"D$7(
 (
 	X =@VVWWW !11'::% 	&KO   $Q'--//Cyy{{22 &!% 	R1B2A21F1N1N1P1P 	RPQQQ	R 	R 	R 	Rs   %A= ="Bc                    t          | j                                                  t          | j                                                  f}| j        r|| j        fz  }d                    |          S )z4Return distribution full name with - replaced with _r#   )rS   r   get_namerW   get_versionr}   rI   )r   
componentss     r   r   zbdist_wheel.wheel_dist_name   sn     t(113344$+7799::

  	/4,..Jxx
###r   c                    | j         r| j        n]| j        rdnS| j        r"| j                            d          s| j        nt	          | j                  dv rt          j        dk    rd                                	                    dd          	                    dd          | j        r| j
        rd	}n| j        }|d
f}nt          j                    }t          j                    }||z   }| j        r"||z                       d          r
| j        }d}n-t!          t#                                                                }||f}fdt          j                    D             }||v sJ d|             |S )Nanyr    )r!   linux_x86_64r"   
linux_i686r#   r$   r   zpy2.py3nonecp3abi3c                .    g | ]}|j         |j        fS r   )interpreterrM   ).0trs   s     r   
<listcomp>z'bdist_wheel.get_tag.<locals>.<listcomp>4  s1       67y1  r   z'would build wheel with unsupported tag )r   rs   rx   r'   r&   rq   r   r(   r   r)   rn   r   r   rE   rG   r~   rZ   rN   sys_tags)r   rK   tag	impl_nameimpl_verabi_tagsupported_tagsrs   s          @r   get_tagzbdist_wheel.get_tag  s    " 	)II 	)II ~ 	9dn&?&?&I&I 	9 N		 )88	 ==)K:-) )	OO%%--c377??SII	 	?~ ' +CC-//I/11Hx'D" 5	H(<'H'H'O'O 5* kmm,,2244),C   ;?=??  N ~%? ?>>>? ? ? 
r   c           	     ,   |                      d          }d|_        d|_        |                      d          }d|_        | j        s|                     d           |                      dd          }| j        |_        d|_        | j        |_        d|_	        |                      d	          }d|_
        d
D ]9}t          |d|z   t          j                            | j        |                     :d}t          j        dk    rPt          j                            t          j                            | j        d                    }|x| _        | _        t          || j        rdnd|           t+          j        d| j                    |                     d           |                                 \  }}}	| j         d| d| d|	 }
| j        s| j        }n=t          j                            | j        |                     |j                            }|                     dd           d                    t=          | j                                                   tC          | j        "                                                    }t          j                            | j        |          }| #                    | j$        |           | %                    |           t          j        &                    | j'                  st          j(        | j'                   t          j                            | j'        |
dz             }tS          |d| j*                  5 }|+                    |           d d d            n# 1 swxY w Y   tY          | j        dg           -                    d dj        t\          j/        d d          |f           | j0        s@t+          j        d| j                    | j1        ste          | j        tf                     d S d S d S )Nbuild_scriptspythonT	build_extFbuildinstall)reinit_subcommandsinstall_scripts)headersscriptsdatapurelibplatlibinstall_r=   ntz..install_purelibinstall_platlibzinstalling to r#   install_egg_info)targetrw   z{}-{}.dist-infoz.whlw
dist_filesrd   z{}.{}r-   z	removing )onerror)4reinitialize_command
executableforceinplacery   run_commandrq   rootcompilewarn_dirno_epsetattrr[   r`   rI   rr   rR   normpathinstall_libbaseinstall_librx   r   infor   r   rl   _ensure_relativeinstall_baser   r1   rS   r   r   rW   r   egg2distrw   write_wheelfileexistsrv   makedirsr   r|   write_filesgetattrappendr   r   ru   dry_runr
   rb   )r   r   r   r   r   keybasedir_observedimpl_tagr   rt   archive_basenamer*   distinfo_dirnamedistinfo_dir
wheel_pathwfs                   r   runzbdist_wheel.run<  s8   11/BB#+ "--k::	!	 	&W%%%++I$+OO~!_ 
 334EFF $ H 	Q 	QCGZ#-rw||DM3/O/OPPPP7d? 	G  "w//T]D0Q0QRR6FFD 4#3!%!2I8I	
 	
 	
 	2$.22333###&*llnn#'8"2TTXTTTT(TT} 	>LL7<< 5 5g6J K K L 	""#57PQQQ,33t(113344$+7799::
 
 w||DN4DEEd&555\*** w~~dm,, 	'K&&&W\\$-1AF1JKK
z3(899 	)RNN<(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	!<44;; 0! 45	
 	
 	
 ~ 	@H111222< @t~??????	@ 	@@ @s   M::M>M>zbdist_wheel ()c                >   ddl m}  |            }d|d<   ||d<   t          | j                                                  |d<   | j        
| j        |d<   |                                 \  }}}|                    d          D ]M}|                    d          D ]5}	|                    d          D ]}
d	                    ||	|
f          |d
<   6Nt          j
                            |d          }t          j        d|            t                      }t          |d                              |           t!          |d          5 }|                    |                                                    dd                     d d d            d S # 1 swxY w Y   d S )Nr   )Messagez1.0zWheel-Versionr   zRoot-Is-PurelibBuildr   r#   TagWHEELz	creating )maxheaderlenwbs   
   )email.messager   rZ   rx   r   r}   r   rH   rI   r[   r`   r   r   r	   r   flattenopenwritegetvaluer)   )r   wheelfile_base	generatorr   msgr   r   rt   rK   rM   platwheelfile_pathbufferfs                 r   r   zbdist_wheel.write_wheelfile  s    	*)))))gii$O$K!$T%6!7!7!=!=!?!? 	-,CL '+llnn#'8NN3'' 	= 	=D}}S)) = =$NN3// = =D!$4d*;!<!<CJJ== ng>>-^--...vA...66s;;;.$'' 	?1GGFOO%%--gu==>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   	<FFFc                    t           j                            |          \  }}|dd         t           j        k    r||dd          z   }|S )Nr   r   )r[   r`   
splitdrivesep)r   r`   drives      r   r   zbdist_wheel._ensure_relative  sI    g((..t!9 	$48#Dr   c           	        t           dk    r| j        j        j        pdS t	                      }| j                            d          }t           dk    r| j        j        j        }n'd|v r!|d         d                                         }nd}d|v r;t          j        dt                     |
                    |d         d                    |s|st          |t                    sd	}|D ]}t          |          D ]}|                    d
          rt          j        d| d           0||vrOt"          j                            |          r0t          j        d| d| d           |
                    |           |S )N9   r   metadata*   license_filesr   license_filezEThe "license_file" option is deprecated. Use "license_files" instead.)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   rH   r/   r0   DeprecationWarningadd
isinstancelistr   endswithr   debugr[   r`   isfiler   )r   filesr  patternspatternr`   s         r   license_pathszbdist_wheel.license_paths  s   #r) 	B$-;ArA$44Z@@#r) 	(1?HH (* #O4Q7==??X% 	3MW"   IIh~.q1222 	JX 	Jj4.H.H 	JIH 	$ 	$Gg $ $==%% IS$SSS   u$ $)=)= $HUUU'UUU   IIdOOO$ r   c                t   d } ||           t           j                            |          sddl}t           j                            t           j                            |          d          }|                    |          }d| d}|r.t           j                            |d                   }|d| dz  }t          |          t           j                            |          r'|}	t          ||          }
t          j
        |           nt           j                            |d	          }	t          ||	          }
t          j        ||d
            t           j                            |d          }t          |          5 }|                                                                }ddd           n# 1 swxY w Y   |s ||           t           j                            |d          }t!          ddd          }t          |dd          5 }t#          ||                              |
           ddd           n# 1 swxY w Y   | j        D ]T}t           j                            |          }t          j        |t           j                            ||                     U ||           dS )z:Convert an .egg-info directory into a .dist-info directoryc                V   t           j                            |           rTt           j                            |           s5t           j                            |           rt          j        |            dS t           j                            |           rt          j        |            dS dS )z-Appropriately delete directory, file or link.N)r[   r`   r   islinkisdirshutilr
   unlink)rh   s    r   adiosz#bdist_wheel.egg2dist.<locals>.adios  s    w~~a   ):): rw}}Q?O?O a     "" 	! r   r   Nz
*.egg-infozEgg metadata expected at z but not foundz (z) found - possible misnamed archive file?)PKG-INFOc                
    h dS )N>   SOURCES.txtnot-zip-saferequires.txtr  r   )xys     r   <lambda>z&bdist_wheel.egg2dist.<locals>.<lambda>
  s     % % % r   )ignorezdependency_links.txtMETADATATF)utf8mangle_from_max_line_lengthr   zutf-8)encoding)policy)r[   r`   r   globrI   dirnamebasenamer   r  r   mkdirr  copytreer   readr   r   r   r   r  copy)r   egginfo_pathdistinfo_pathr  r-  patpossibleerraltpkginfo_pathpkg_infodependency_links_pathdependency_links_filedependency_linkspkg_info_pathserialization_policyoutlicense_pathfilenames                      r   r   zbdist_wheel.egg2dist  sN   	 	 	 	mw~~l++ 	"
 KKK',,rw|<<lKKCyy~~HJlJJJC Kg&&x{33JCJJJJS//!7>>,'' 	-'L*<FFHH]#### 7<<jAAL*<FFH O 	 	 	 	 %'GLL@V$W$W!+,, H0E#8#=#=#?#?#E#E#G#G H H H H H H H H H H H H H H H# -+,,,]J??* 
  
  

 -w777 	J3c"6777??III	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J !. 	M 	MLw''55HKbgll=(&K&KLLLLls$   'F99F= F=%II
I
)__name__
__module____qualname__descriptionr   r   r   r   r&   r1   rI   r   user_optionsboolean_optionsr   r   propertyr   r   r   wheel_versionr   r   r  r   r   r   r   rd   rd   z   s       /K([
J	*l!;< 
 	Q*l4001	
	
 	LR	

	

	

 	J%%+VDII6L,M,M%N%N		
 ",*,,0	
	
	
g8Lt KJJO( ( (*&R &R &RP $ $ X$4 4 4lU@ U@ U@p )8-(G#(M? ? ? ?4   ) ) X)VF F F F Fr   rd   )TT)9__doc__
__future__r   r[   r   r  r]   r   r%   r/   collectionsr   email.generatorr   r   email.policyr   r-  r   ior	   r
   zipfiler   r   pkg_resourcesr   r   r=   r   rK  macosx_libfiler   r  r   utilr   vendored.packagingr   	wheelfiler   rQ   rU   intget_distributionrV   rH   r
  r   r   r&   r7   rN   rS   rW   rb   rd   r   r   r   <module>rZ     sv    # " " " " " 				 				   



      # # # # # # 5 5 5 5 5 5 5 5 $ $ $ $ $ $                   , , , , , , , ,           * * * * * * 9 9 9 9 9 9 ) ) ) ) ) )       $ $ $ $ $ $            #	)3"M"<008>>sCCAF   " & & &	$ 	$ 	$      B- - -3 3 3  l l l l l' l l l l lr   