Ë
    èÿæi  ã                   ó2  — d dl Z d dlm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mZ d dlmZ d dlmZ e j"                  j$                  j&                  Ze j"                  j$                  j(                  Ze j"                  j*                  j,                  Ze j"                  j.                  Zddd	œZd
„ Z ej4                  ed «      Z ej4                  ed«      Zed„ «       Z ej<                  d¬«      d„ «       Z G d„ de «      Z! G d„ de «      Z"d„ Z#d„ Z$y)é    N)Ú	build_ext)ÚDistribution)Úmkdtemp)Úcontextmanager)ÚPath)z.dllz.pyd)ú.sor   )ÚwinÚdefaultc                 ód   — t         j                  t        j                  d d t         d   «      |    S )Né   r
   )Ú_configsÚgetÚsysÚplatform©Úargs    úh/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/numba/pycc/platform.pyÚget_configsr      s(   € Ü�<‰<œŸ™ R aÐ(¬(°9Ñ*=Ó>¸sÑCÐCó    é   c              #   ó¶  K  — 	 t        «       }t        t        j                  j	                  |d| z  «      d«      }|–— 	 |j                  «        t        j                  |«       t        j                  |«       y # t        $ r Y y w xY w# 	 j                  «        t        j                  |«       t        j                  «       w # t        $ r Y w w xY wxY w­w)Nztemp%sÚwt)	r   ÚopenÚosÚpathÚjoinÚcloseÚremoveÚrmdirÚ	Exception)ÚsuffixÚtmpdirÚntfs      r   Ú_gentmpfiler$   #   s¬   è ø€ ðÜ“ˆÜ”2—7‘7—<‘< ¨°6Ñ(9Ó:¸DÓAˆØŠ	ð	Ø�I‰IŒKÜ�I‰I�cŒNô �H‰H�VÕøô ò 	Ùð	ûð	Ø�I‰IŒKÜ�I‰I�cŒNô �H‰H�VÕøô ò 	Ùð	ÿs^   ‚C„;B
 Á %A; Á%CÁ;	BÂCÂBÂCÂ
CÂ%CÂ1CÃ	CÃCÃCÃCÃC)Úmaxsizec                  óz  — t        «       } t        | «       dD ]…  }	 t        |«      5 }d}|j                  |«       |j	                  «        |j                  «        | j                  |j                  gt        |j                  «      j                  ¬«       ddd«       Œ‡ y# 1 sw Y   ŒxY w# t        $ r Y  yw xY w)zv
    Returns True if the "external compiler" bound in numpy.distutil is present
    and working, False otherwise.
    )z.cz.cxxzint main(void) { return 0; })Ú
output_dirNFT)Únew_compilerÚcustomize_compilerr$   ÚwriteÚflushr   ÚcompileÚnamer   Úanchorr    )Úcompilerr!   r#   Úsimple_cs       r   Úexternal_compiler_worksr1   5   sŸ   € ô ‹~€HÜ�xÔ Û ˆð
	Ü˜VÔ$¨Ø9�Ø—	‘	˜(Ô#Ø—	‘	”Ø—	‘	”ð × Ñ  #§(¡( ¼¸S¿X¹X»×8MÑ8MÐ ÔN÷ %øð !ð ÷ %Ð$ûô ò 	Úð	ús)   œB-§A/B!ÂB-Â!B*	Â&B-Â-	B:Â9B:c                   ó   — e Zd Zg Zy)Ú_DummyExtensionN)Ú__name__Ú
__module__Ú__qualname__Ú	libraries© r   r   r3   r3   L   s   „ Ø�Ir   r3   c                   ó~   — e Zd Zd„ Zed„ «       Zej                  d„ «       Zd„ Z	 	 dd„Z	 	 	 dd„Z	d„ Z
d	„ Zd
„ Zd„ Zy)Ú	Toolchainc                 óæ  — t        «       s| j                  «        d| _        t        «       | _        t        | j                  «       t        t        «       «      | _        | j                  j                  «        | j                  j                  | _        | j                  j                  | _        dt        j                  «       gi}t         j"                  dk(  rg |d<   || _        y dg|d<   || _        y )NFÚinclude_dirsÚwin32r7   Úm)r1   Ú_raise_external_compiler_errorÚ_verboser(   Ú	_compilerr)   r   r   Ú
_build_extÚfinalize_optionsÚlibrary_dirsÚ_py_lib_dirsr<   Ú_py_include_dirsÚnpÚget_includer   r   Ú
_math_info)ÚselfÚnp_compile_argss     r   Ú__init__zToolchain.__init__R   sº   € Ü&Ô(Ø×/Ñ/Ô1àˆŒÜ%›ˆŒÜ˜4Ÿ>™>Ô*Ü#¤L£NÓ3ˆŒØ�‰×(Ñ(Ô*Ø ŸO™O×8Ñ8ˆÔØ $§¡× <Ñ <ˆÔØ)¬B¯N©NÓ,<Ð+>Ð@ˆÜ�<‰<˜7Ò"Ø+-ˆO˜KÑ(ð *ˆ�ð -0¨6ˆO˜KÑ(Ø)ˆ�r   c                 ó   — | j                   S ©N)r@   ©rJ   s    r   ÚverbosezToolchain.verbosed   s   € à�}‰}Ðr   c                 ó†   — || _         t        j                  |rt        j                  «       y t        j                  «       y rN   )r@   ÚlogÚset_thresholdÚINFOÚWARN)rJ   Úvalues     r   rP   zToolchain.verboseh   s(   € àˆŒô 	×Ñ¡eœ#Ÿ(™(Õ:´·±Õ:r   c                 ó¨  — d}d}t         j                  }|j                  d«      r@t         j                  dk  rddg}nddg}|›d	|d	j	                  |«      z  ›�}t        |«      ‚|j                  d
«      r(ddg}|›d	|d	j	                  |«      z  ›�}t        |«      ‚|j                  d«      rd}|›d	|›�}t        |«      ‚d|z  }t        |«      ‚)NzYAttempted to compile AOT function without the compiler used by `numpy.distutils` present.z(If using conda try:

#> conda install %sÚlinuxl        zgcc_linux-32zgxx_linux-32zgcc_linux-64zgxx_linux-64Ú Údarwinzclang_osx-64zclangxx_osx-64r=   zCannot find suitable msvc.zUnknown platform %s)r   r   Ú
startswithr%   r   ÚRuntimeError)rJ   ÚbasemsgÚ	conda_msgÚpltÚ	compilersÚmsgÚwinmsgs          r   r?   z(Toolchain._raise_external_compiler_erroro   sè   € ðAˆà@ˆ	Ü�l‰lˆØ�>‰>˜'Ô"Ü�{‰{˜gÒ%Ø+¨^Ð<‘	à+¨^Ð<�	Ú$ i°#·(±(¸9Ó2EÒ&EÐFˆCô ˜3ÓÐð �^‰^˜HÔ%Ø'Ð)9Ð:ˆIÚ$ i°#·(±(¸9Ó2EÒ&EÐFˆCô ˜3ÓÐð �^‰^˜GÔ$Ø1ˆFÚ$¡fÐ-ˆCô ˜3ÓÐð (¨#Ñ-ˆCÜ˜3ÓÐr   Nc                 óP   — | j                   j                  |||||xs g |¬«      }|S )aÖ  
        Compile the given source files into a separate object file each,
        all beneath the *output_dir*.  A list of paths to object files
        is returned.

        *macros* has the same format as in distutils: a list of 1- or 2-tuples.
        If a 1-tuple (name,), the given name is considered undefined by
        the C preprocessor.
        If a 2-tuple (name, value), the given name is expanded into the
        given value by the C preprocessor.
        )r'   r<   ÚdependsÚmacrosÚextra_preargs)rA   r,   )rJ   Úsourcesr'   r<   rd   re   Úextra_cflagsÚobjectss           r   Úcompile_objectszToolchain.compile_objects„   s:   € ð —.‘.×(Ñ(¨Ø4>Ø6BØ18Ø06²¸"Ø7Cð )ó Eˆð ˆr   c           
      óª   — t         j                  j                  |«      \  }}| j                  j	                  t
        j                  |||||||¬«       y)zu
        Create a shared library *output* linking the given *objects*
        and *libraries* (all strings).
        )Úexport_symbolsrf   N)r   r   ÚsplitrA   ÚlinkÚ	CCompilerÚSHARED_OBJECT)	rJ   Úoutputri   r7   rD   rl   Úextra_ldflagsr'   Úoutput_filenames	            r   Úlink_sharedzToolchain.link_sharedš   sL   € ô ')§g¡g§m¡m°FÓ&;Ñ#ˆ
�OØ�‰×ÑœI×3Ñ3°WØ+¨ZØ% |Ø+9Ø*7ð	 	õ 	9r   c                 óž   — | j                   j                  t        «       «      }t        j                  dk(  r|dgz   }|| j
                  d   z   S )zJ
        Get the library arguments necessary to link with Python.
        r=   Úmsvcrtr7   )rB   Úget_librariesr3   r   r   rI   )rJ   Úlibss     r   Úget_python_librarieszToolchain.get_python_libraries¨   sI   € ð �‰×,Ñ,¬_Ó->Ó?ˆÜ�<‰<˜7Ò"ð ˜8˜*Ñ$ˆDØ�d—o‘o kÑ2Ñ2Ð2r   c                 ó,   — t        | j                  «      S )zL
        Get the library directories necessary to link with Python.
        )ÚlistrE   rO   s    r   Úget_python_library_dirsz!Toolchain.get_python_library_dirs´   s   € ô �D×%Ñ%Ó&Ð&r   c                 óL   — t        | j                  «      | j                  d   z   S )zo
        Get the include directories necessary to compile against the Python
        and Numpy C APIs.
        r<   )r{   rF   rI   rO   s    r   Úget_python_include_dirsz!Toolchain.get_python_include_dirsº   s#   € ô
 �D×)Ñ)Ó*¨T¯_©_¸^Ñ-LÑLÐLr   c                 ó8   — | j                   j                  |«      S )zR
        Given a C extension's module name, return its intended filename.
        )rB   Úget_ext_filename)rJ   Úext_names     r   r€   zToolchain.get_ext_filenameÁ   s   € ð �‰×/Ñ/°Ó9Ð9r   )r8   r8   r8   N)r4   r5   r6   rL   ÚpropertyrP   Úsetterr?   rj   rt   ry   r|   r~   r€   r8   r   r   r:   r:   P   sj   „ ò*ð$ ñó ðð ‡^�^ñ;ó ð;ò ð, =?Ø%)óð, 68Ø46Ø"&ó9ò
3ò'òMó:r   r:   c                 ó    — d| vr	d| v rd| z  S | S )zB
    Quote the argument for safe use in a shell command line.
    Ú"rY   z"%s"r8   r   s    r   Ú
_quote_argr†   È   s    € ð �#�~˜# ™*Ø˜‰|ÐØ€Jr   c                 óh   — t        | t        t        f«      ry	 t        | «       y# t        $ r Y yw xY w)NFT)Ú
isinstanceÚstrÚbytesÚlenr    r   s    r   Ú_is_sequencerŒ   Ó   s4   € Ü�#œœU�|Ô$ØðÜˆCŒØøÜò Ùðús   ™% ¥	1°1)%Ú
setuptoolsÚsetuptools.command.build_extr   Úsetuptools.distr   ÚnumpyrG   Ú	functoolsr   Ú
subprocessr   Útempfiler   Ú
contextlibr   Úpathlibr   Ú	distutilsÚ	ccompilerro   r(   Ú	sysconfigr)   rR   r   r   ÚpartialÚfind_shared_endingÚfind_pyext_endingr$   Ú	lru_cacher1   Úobjectr3   r:   r†   rŒ   r8   r   r   Ú<module>rž      s  ðÛ Ý 2Ý (Û ã Û 	Û Û 
Ý Ý %Ý ð ×!Ñ!×+Ñ+×5Ñ5€	Ø×$Ñ$×.Ñ.×;Ñ;€Ø×)Ñ)×3Ñ3×FÑFÐ Ø×Ñ×Ñ€ð
 Øñ€òDð '�Y×&Ñ& {°AÓ6Ð Ø%�I×%Ñ% k°1Ó5Ð àñó ðð" €×Ñ˜QÔñó  ðô,�fô ôu:�ô u:òpór   