
    sh                     ,   S SK r S SKJr  S SKJr  S SKrS SKrS SKrS SK	r	S SK
r
S SKJr  S SKJr  S SKJr  \ R"                  R$                  R&                  r\ R"                  R$                  R(                  r\ R"                  R*                  R,                  r\ R"                  R.                  rSSS	.rS
 r\R4                  " \S 5      r\R4                  " \S5      r\S 5       r\R<                  " SS9S 5       r " S S\ 5      r! " S S\ 5      r"S r#S r$g)    N)	build_ext)Distribution)mkdtemp)contextmanager)Path)z.dllz.pyd).sor   )windefaultc                 d    [         R                  [        R                  S S [         S   5      U    $ )N   r
   )_configsgetsysplatformargs    g/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/pycc/platform.pyget_configsr      s(    <<Ra((9*=>sCC       c              #     #     [        5       n[        [        R                  R	                  USU -  5      S5      nUv    UR                  5         [        R                  " U5        [        R                  " U5        g !    g = f!  WR                  5         [        R                  " U5        [        R                  " W5        f !    f = f= f7f)Nztemp%swt)r   openospathjoincloseremovermdir)suffixtmpdirntfs      r   _gentmpfiler#   #   s     277<<6(9:DA		IIKIIcN HHV			IIKIIcN HHV	sF   C;B  &A= &C=B?CC
&C,C
CC

C)maxsizec                     [        5       n [        U 5        S H  n [        U5       nSnUR                  U5        UR	                  5         UR                  5         U R                  UR                  /[        UR                  5      R                  S9  SSS5        M     g! , (       d  f       M  = f! [         a       gf = f)zj
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   anchor	Exception)compilerr    r"   simple_cs       r   external_compiler_worksr1   5   s     ~Hx  
	V$9		(#				   #((SXX8M8M N %$ !  %$  		s/   B2A,B B2 
B/	*B2/B22
C ?C c                       \ rS rSr/ rSrg)_DummyExtensionL    N)__name__
__module____qualname____firstlineno__	libraries__static_attributes__r5   r   r   r3   r3   L   s    Ir   r3   c                       \ rS rSrS r\S 5       r\R                  S 5       rS r  SS jr	   SS jr
S	 rS
 rS rS rSrg)	ToolchainP   c                    [        5       (       d  U R                  5         SU l        [        5       U l        [        U R                  5        [        [        5       5      U l        U R                  R                  5         U R                  R                  U l        U R                  R                  U l        S[        R                  " 5       /0n[         R"                  S:X  a  / US'   OS/US'   Xl        g )NFinclude_dirswin32r:   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__Toolchain.__init__R   s    &((//1%4>>*#LN3((* OO88 $ < <)BNN,<+>@<<7"+-OK(,/6OK()r   c                     U R                   $ N)rD   rN   s    r   verboseToolchain.verbosed   s    }}r   c                     Xl         [        R                  U(       a  [        R                  5        g [        R                  5        g rS   )rD   logset_thresholdINFOWARN)rN   values     r   rU   rV   h   s&     	e#((::r   c                    SnSn[         R                  nUR                  S5      (       a9  [         R                  S::  a  SS/nOSS/nU< S	US	R	                  U5      -  < 3nO]UR                  S
5      (       a   SS/nU< S	US	R	                  U5      -  < 3nO'UR                  S5      (       a  SnU< S	U< 3nOSU-  n[        U5      e)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-64rA   zCannot find suitable msvc.zUnknown platform %s)r   r   
startswithr$   r   RuntimeError)rN   basemsg	conda_msgplt	compilersmsgwinmsgs          r   rC   (Toolchain._raise_external_compiler_erroro   s    A@	ll>>'""{{g%+^<	+^<	$i#((92E&EFC^^H%%')9:I$i#((92E&EFC^^G$$1F$f-C'#-C3r   Nc           	      T    U R                   R                  UUUUU=(       d    / US9nU$ )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)rE   r+   )rN   sourcesr&   r@   rk   rl   extra_cflagsobjectss           r   compile_objectsToolchain.compile_objects   s:     ..((4>6B1806"7C ) E r   c                     [         R                  R                  U5      u  pxU R                  R	                  [
        R                  UXX4UUS9  g)z]
Create a shared library *output* linking the given *objects*
and *libraries* (all strings).
)export_symbolsrm   N)r   r   splitrE   link	CCompilerSHARED_OBJECT)	rN   outputrp   r:   rH   rt   extra_ldflagsr&   output_filenames	            r   link_sharedToolchain.link_shared   sF     ')ggmmF&;#
I33W+%+9*7	 	 	9r   c                     U R                   R                  [        5       5      n[        R                  S:X  a  US/-   nXR
                  S   -   $ )z:
Get the library arguments necessary to link with Python.
rA   msvcrtr:   )rF   get_librariesr3   r   r   rM   )rN   libss     r   get_python_librariesToolchain.get_python_libraries   sG     ,,_->?<<7" 8*$Dook222r   c                 ,    [        U R                  5      $ )z<
Get the library directories necessary to link with Python.
)listrI   rT   s    r   get_python_library_dirs!Toolchain.get_python_library_dirs   s     D%%&&r   c                 L    [        U R                  5      U R                  S   -   $ )zW
Get the include directories necessary to compile against the Python
and Numpy C APIs.
r@   )r   rJ   rM   rT   s    r   get_python_include_dirs!Toolchain.get_python_include_dirs   s#    
 D))*T__^-LLLr   c                 8    U R                   R                  U5      $ )zB
Given a C extension's module name, return its intended filename.
)rF   get_ext_filename)rN   ext_names     r   r   Toolchain.get_ext_filename   s     //99r   )rF   rE   rM   rJ   rI   rD   )r5   r5   r5   N)r6   r7   r8   r9   rP   propertyrU   setterrC   rq   r|   r   r   r   r   r;   r5   r   r   r=   r=   P   sj    *$   ^^; ; , =?%), 6846"&9
3'M:r   r=   c                 (    SU ;  a  SU ;   a  SU -  $ U $ )z:
Quote the argument for safe use in a shell command line.
"r_   z"%s"r5   r   s    r   
_quote_argr      s      #~#*|Jr   c                 t    [        U [        [        45      (       a  g [        U 5        g! [         a     gf = f)NFT)
isinstancestrbyteslenr.   r   s    r   _is_sequencer      s7    #U|$$C s   * 
77)%
setuptoolssetuptools.command.build_extr   setuptools.distr   numpyrK   	functoolsr   
subprocessr   tempfiler   
contextlibr   pathlibr   	distutils	ccompilerrw   r'   	sysconfigr(   rX   r   r   partialfind_shared_endingfind_pyext_endingr#   	lru_cacher1   objectr3   r=   r   r   r5   r   r   <module>r      s    2 (   	  
  %  !!++55	$$..;;))33FF 
 D &&{A6 %%k15  " Q  ,f u: u:pr   