
    h                        S r SrSSKrSSKr\R                  S:  a  SSKJr   " S S5      rOSSKrS%S	 jr\R                  " S
5      r
\" S5      r\" S5      r\" S5      r\" S5      r\\:X  a  SrO!\R                  R!                  \SS 5      S   r\" S\R"                  R%                  SS5      5      r\" S5      S-   \R"                  R%                  SS5      -   r\" S\R"                  R%                  S\5      5      r\" S5      r\" S5      r\" S5      r\R                  " S5      rS rS rS rS&S jrS rS rS'S jr S'S jr!S(S  jr"S! r#S" r$\%S#:X  a  \$" \RL                  S$S 5        gg))z
Compile a Python script into an executable that embeds CPython.
Requires CPython to be built as a shared library ('libpythonX.Y').

Basic usage:

    python -m Cython.Build.BuildExecutable [ARGS] somefile.py
T    N)   	   )	sysconfigc                   H    \ rS rSr\S 5       r\" \R                  5      rSrg)r      c                 <    U S:X  d   e[         R                  " 5       $ )Ninclude)
_sysconfigget_python_inc)names    V/var/www/fran/franai/venv/lib/python3.13/site-packages/Cython/Build/BuildExecutable.pyget_pathsysconfig.get_path   s    9$$$,,..     N)	__name__
__module____qualname____firstlineno__staticmethodr   r
   get_config_var__static_attributes__r   r   r   r   r      s&    		/ 
	/ &j&?&?@r   r    c                 @    [         R                  " U 5      =(       d    U$ N)r   r   )r   defaults     r   r   r      s    ##D)4W4r   r	   LIBDIRLIBPLLIBRARY	LDLIBRARYr   CCCFLAGS LINKCCLINKFORSHAREDLIBSSYSLIBSEXEc                 v    [         (       a.  U(       a  X-  n [        R                  R                  U S-   5        g g )N
)DEBUGsysstderrwrite)msgargss     r   _debugr1   6   s,    u*C

t$ r   c                     [        S[        5        [        S[        5        [        S[        5        [        S[        5        [        S[
        5        [        S[        5        [        S[        5        [        S[        5        [        S	[        5        [        S
[        5        [        S[        5        [        S[        5        g )Nz
INCDIR: %szLIBDIR1: %szLIBDIR2: %sz	PYLIB: %szPYLIB_DYN: %szCC: %sz
CFLAGS: %sz
LINKCC: %szLINKFORSHARED: %szLIBS: %szSYSLIBS: %szEXE_EXT: %s)r1   INCDIRLIBDIR1LIBDIR2PYLIB	PYLIB_DYNr!   r"   r$   r%   r&   r'   EXE_EXTr   r   r   dump_configr9   =   s{    
< 
='"
='"
;
?I&
8R
< 
< 
.
:t
='"
='"r   c                     / nS n[        U 5       HR  u  p4UR                  S5      (       a  UR                  U5        O#US;   a  UR                  U5        OUnXS-   S  n   OUnMT     [        S5      eXQU 4$ )N-)z-Xz--directive   zno input file provided)	enumerate
startswithappend
ValueError)r0   cy_argslast_argiarg
input_files         r   _parse_argsrF   L   s    GHD/>>#NN3..NN3J!:D " 122$$r   c                     U(       a  SR                  U 5      n [        U 5        O[        SR                  U 5      5        SS KnUR                  XS9nU(       a  [        R
                  " U5        g g )Nr#   r   shell)joinr1   
subprocesscallr,   exit)cmdrI   rK   
returncodes       r   runcmdrP   _   sP    hhsmssxx}2J r   c           	      j   [        [        SU [        -   U S-   S[        -   S[        -   /[
        =(       a	    S[
        -   =(       d(    [        R                  R                  [        [        5      /-   [        R                  5       -   [        R                  5       -   [        R                  5       -   5        g )N-o.oz-Lz-l)rP   r$   r8   r4   r5   r7   ospathrJ   r6   r&   splitr'   r%   basenames    r   clinkrY   m   s    
FD(W,htmT'\4PW<X,T)^LWe0LMNZZ\#MMO,.;.A.A.CD Er   c           	      r    [        [        SSU S-   U S-   S[        -   /[        R	                  5       -   5        g )Nz-crR   rS   z.cz-I)rP   r!   r3   r"   rV   rW   s    r   ccompiler[   s   s.    
BdHTM8D=$-H6<<>YZr   c                 
   SSK JnJnJn  UR	                  [        U=(       d    S5      SU /-   5      u  p[        SUR                  U 5        UR                  XQ5      nUR                  S:  a  [        R                  " S5        g g )N   )VersionCmdLineMainr   z--embedzUsing Cython %s to compile %sr   r<   )Compilerr^   r_   r`   parse_command_linelistr1   versioncompile
num_errorsr,   rM   )rE   optionsr^   r_   r`   sourcesresults          r   	cycompilerj   w   sl    1111$w}"2ET^H_2_`G
*GOOZH\\'+F1 r   c                 l    [        [        R                  R                  U 5      /[	        U5      -   SS9  g )NFrH   )rP   rT   rU   abspathrc   )program_namer0   s     r   	exec_filern      s%    
BGGOOL)*T$Z7uEr   c                 |   [         R                  R                  U 5      S   nU[        -   nU(       dK  [         R                  R	                  U5      [         R                  R	                  U 5      :X  a  [        S5      eU(       d  [         R                  R                  U5      (       ar  [         R                  R                  U 5      (       aN  [         R                  R                  U 5      [         R                  R                  U5      ::  a  [        SU5        U$ [        X5        [        U5        [        U5        U$ )z]
Build an executable program from a Cython module.

Returns the name of the executable file.
r   z?Input and output file names are the same, refusing to overwritez'File is up to date, not regenerating %s)rT   rU   splitextr8   rl   r@   existsgetmtimer1   rj   r[   rY   )rE   compiler_argsforcerX   exe_files        r   buildrv      s     ww
+A.H'!HRWW__X."''//*2MMZ[[bggnnX..277>>*3M3M  ,0@0@0JJ8(Cj(X	(OOr   c                 4    [        U 5      u  p[        X5        g)z
Build an executable program from a Cython module and run it.

Arguments after the module name will be passed verbatimly to the program.
N)_buildrn   )r0   rm   s     r   build_and_runry      s      Ll!r   c                 :    [        U 5      u  pn [        X5      nX04$ r   )rF   rv   )r0   rE   rA   rm   s       r   rx   rx      s$     +D 1J-Lr   __main__r<   )r   )T)r   )r   F)'__doc__r+   r,   rT   version_info	distutilsr   r
   r   r   r3   r4   r5   r6   r7   rU   rp   environgetr!   r"   r$   r%   r&   r'   r8   r1   r9   rF   rP   rY   r[   rj   rn   rv   ry   rx   r   argvr   r   r   <module>r      s   	 
 	f1A A 5 
		I	&

"

!y!;'	I  12/2ID"**..r23		!C	'"**..2*F	F	"**..2">	?/f

#

"
"5
)%#%&E[F(" z
388AB< r   