
    Ng6                         d Z d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 n# e$ r eZY nw xY w	 ej        Zej        Z G d
 de          Z e            Z G d dej                  ZdS )zCython.Distutils.old_build_ext

Implements a version of the Distutils 'build_ext' command, for
building Cython extension modules.

Note that this module is deprecated.  Use cythonize() instead.
z$Id:$    N)DistutilsPlatformError)newernewer_group)log)	build_ext)	sysconfig)
basestringc                        e Zd Zd Zd Zd ZdS )Optimizationc                 t    d| _         t          j        | j          | _        t          j                    | _        d S )N)OPTCFLAGSCPPFLAGSEXTRA_CFLAGS
BASECFLAGS	PY_CFLAGS)flagsr   get_config_varsstateconfig_varsselfs    Z/var/www/html/ai-engine/env/lib/python3.11/site-packages/Cython/Distutils/old_build_ext.py__init__zOptimization.__init__8   s5    

 .
;
$466    c                     dt          | j        | j                  D ]D\  }}|=fd|                                D             }d                    |          | j        |<   EdS )z.disable optimization for the C or C++ compiler)z-O1z-O2z-O3Nc                     g | ]}|v|	S  r   ).0opt
badoptionss     r   
<listcomp>z5Optimization.disable_optimization.<locals>.<listcomp>K   s#    LLLSc6K6KS6K6K6Kr    )zipr   r   splitjoinr   )r   flagoptionLr!   s       @r   disable_optimizationz!Optimization.disable_optimizationE   sr    *

DJ77 	5 	5LD&!LLLLFLLNNLLL),! &	5 	5r   c                 ^    t          | j        | j                  D ]\  }}|
|| j        |<   dS )zrestore the original stateN)r$   r   r   r   )r   r'   r(   s      r   restore_statezOptimization.restore_stateN   sA    
DJ77 	0 	0LD&!)/ &	0 	0r   N)__name__
__module____qualname__r   r*   r,   r   r   r   r   r   7   sA        
7 
7 
75 5 50 0 0 0 0r   r   c                   ^   e Zd ZdZej        j        Zej        j        dd         Zej        j        dd         Zej        j	        dd         Z	e
                    ddddddez   fdd	d
ddddddddez   fddddg           e
                    g d           d Zd Zd Zd Zd Zd Zd ZdS )old_build_extzCbuild C/C++ and Cython extensions (compile/link to build directory)N)cython-cplusNgenerate C++ source files)cython-create-listingNwrite errors to a listing file)cython-line-directivesNemit source line directiveszcython-include-dirs=z path to the Cython include files)cython-c-in-tempN'put generated C files in temp directory)zcython-gen-pxiN*generate .pxi file for public declarations)zcython-directives=Ncompiler directive overrides)
cython-gdbN$generate debug information for cygdb)zcython-compile-time-envNzcython compile time environment)pyrex-cplusNr3   )pyrex-create-listingNr5   )pyrex-line-directivesNr7   zpyrex-include-dirs=)pyrex-c-in-tempNr9   )zpyrex-gen-pxiNr:   )zpyrex-directives=Nr;   )	pyrex-gdbNr=   )
r2   r4   r6   r8   r<   r>   r?   r@   rA   rB   c                     t           j                            |            d| _        d| _        d| _        d | _        d | _        d| _        d| _	        d| _
        d| _        d | _        d S )Nr   F)
_build_extr   initialize_optionscython_cpluscython_create_listingcython_line_directivescython_include_dirscython_directivescython_c_in_tempcython_gen_pxi
cython_gdbno_c_in_tracebackcython_compile_time_envr   s    r   rE   z old_build_ext.initialize_options   sn    //555%&"&'##' !% !!"'+$$$r   c                     |d d         dk    rt          | d|dd          z             S t          j                            | |          S N   pyrex_cython_)getattrrD   r   __getattr__)r   names     r   rV   zold_build_ext.__getattr__   sK    8x4T!""X!5666'33D$???r   c                 n    |d d         dk    rt          | d|dd          z   |          S || j        |<   d S rQ   )setattr__dict__)r   rW   values      r   __setattr__zold_build_ext.__setattr__   sH    8x4T!""X!5u=== #(DM$r   c                    t           j                            |            | j        g | _        nCt	          | j        t
                    r)| j                            t          j                  | _        | j	        	i | _	        d S d S N)
rD   r   finalize_optionsrI   
isinstancer	   r%   ospathseprJ   r   s    r   r_   zold_build_ext.finalize_options   s    --d333#+')D$$0*== 	;(..rz:: $!)%'D""" *)r   c                     | j         sd | j        D             rt                                           t          j                            |            d S )Nc                 4    g | ]}t          |d d          dS )rM   F   )rU   )r   exts     r   r"   z%old_build_ext.run.<locals>.<listcomp>   s?     K K KS(/\5(I(IKq K K Kr   )rM   
extensionsoptimizationr*   rD   r   runr   s    r   ri   zold_build_ext.run   sd    
 ? 	0 K KDO K K K 	0--///  &&&&&r   c                     t           j                            | |           | j        D ]"}|                     |j        |          |_        #d S r^   )rD   r   check_extensions_listrg   cython_sourcessources)r   rg   rf   s      r   rk   z#old_build_ext.check_extensions_list   sU    224DDD? 	@ 	@C--ck3??CKK	@ 	@r   c                 	   g }g }i }| j         pt          |dd          }| j        pt          |dd          }| j        pt          |dd          }| j        p4t          |dd          p#|j        o|j                                        dk    }	| j        pt          |dd          }
| j        pt          |dd	          }| j	        pt          |d
d          }t          | j                  }	 |j        D ]}||vr|                    |           n# t          $ r Y nw xY wt          |j                  |_        |j        D ]}||vr|                    |           t          | j                  }t#          |d          r|                    |j                   |	rd}nd}| j        s| j        st          |dd          rkt*          j                            | j        d          }|j                            d          dd         D ]"}t*          j                            ||          }#nd}d}|D ]}t*          j                            t*          j                            |                    \  }}|dk    rd}|dk    rx|pt*          j                            |          }|                    t*          j                            |||z                        |                    |           |d         ||<   |dk    s|dk    r|t=          ||          r|}|                    |           |s|S 	 ddlm }m!}m"} ddl#m$} nH# tJ          $ r; tM          j'                    d         }tQ          d|z             tS          d          w xY w|j        }|D ]N}||         }|gt          |j*        pd          z   }|dd                                         dk    r;t*          j        +                    |dd         dz             r||dd         dz   gz  }| j,        pt[          ||d           } | s|t=          ||          } | rt]          j/        d!||           | 0                    t*          j                            |                     | j        rt*          j1        }n| j2        } |||||||	|| |
|||"          }! |||!|#          }"9t]          j/        d$|           P|S )%a  
        Walk the list of source files in 'sources', looking for Cython
        source files (.pyx and .py).  Run Cython on all that are
        found, and return a modified 'sources' list with Cython source
        files replaced by the generated C (or C++) files.
        rG   r   rH   rN   rF   zc++rL   rM   FrO   NrJ   z.cppz.crK   pyrex.z.pyz.pyxz.pxiz.pxd)CompilationOptionsdefault_optionscompile)
PyrexErrorre   zfailed to import Cython: %sz&Cython does not appear to be installedr   pxdr   zcythoning %s to %s)use_listing_fileinclude_pathcompiler_directivesoutput_filecplusemit_linenumsc_line_in_tracebackgenerate_pxi
output_dir	gdb_debugcompile_time_env)optionsfull_module_namez+skipping '%s' Cython extension (up-to-date))3rG   rU   rH   rN   rF   languagelowerrL   rM   rO   listrI   appendAttributeErrorinclude_dirsdictrJ   hasattrupdateinplacerK   ra   pathr&   
build_temprW   r%   splitextbasenamedirnamer   Cython.Compiler.Mainrr   rs   rt   Cython.Compiler.Errorsru   ImportErrorsysexc_infoprintr   dependsisfileforcer   r   infomkpathcurdir	build_lib)#r   rm   	extensionnew_sourcesrl   cython_targetscreate_listingline_directivesrN   r}   rL   rM   rO   includesi
directives
target_ext
target_dirpackage_namenewest_dependencysourcebaserf   r   rr   cython_default_optionscython_compileru   emodule_nametargetr   rebuildr   results#                                      r   rl   zold_build_ext.cython_sources   s    ( 3 ;I6:: 	5 <I7;; 	 2 7I2A66 	! MWY%J%J M#K	(:(@(@(B(Be(K 	,W	CSUV0W0W_O	<(O(O
"&"> #@I8$?? 	  011	2 ' 'H$$OOA&&&'  	 	 	D	
 "&i&<!=!=	' 	# 	#A  """ $011
9122 	;i9:::  	JJJ
 | 	!6 	9&8!<<	dow??J ) 4 4S 9 9#2# > D DW\\*lCC

D J  	+ 	+F'**27+;+;F+C+CDDKT3e||f}}'B27??6+B+B
""27<<
D:<M#N#NOOO%%f---)4Rv&&#--$, ):;; -(.%""6**** 			S1 1 1 1 1 1 1 1 1 1 :999999 	S 	S 	Sq!A/!3444()QRRR	S
  n$ 	P 	PF#F+Fhi&7&=2!>!>>Gbcc{  ""f,,sse@S1T1T,F3B3K%/00jIK$I$IG ;0< 16:: P-vv>>>BGOOF33444< 0!#JJ!%J,,-C'5#+*4"(!$3.?*?#1!+ *'>@ @ @ (9DF F F FOOOOs   (#D 
DD0M AN)r-   r.   r/   descriptionrD   r   sep_byuser_optionsboolean_optionshelp_optionsextendrE   rV   r\   r_   ri   rk   rl   r   r   r   r1   r1   X   s       WK!(F'4QQQ7L *:111=O'4QQQ7L 	&	+	(		+f	4	6	4	:	,	1	/	&	+	(		+f	4	6	4	:	,	1G%
 % % %N       , , ,@ @ @( ( (( ( (	' 	' 	'@ @ @Y Y Y Y Yr   r1   )__doc____revision__r   ra   distutils.errorsr   distutils.dep_utilr   r   	distutilsr   distutils.commandr   rD   r   __builtin__r	   r   strextension_name_reshow_compilersobjectr   rh   r1   r   r   r   <module>r      sV     



 				 3 3 3 3 3 3 1 1 1 1 1 1 1 1       5 5 5 5 5 5      &&&&&&&   JJJ, 0 *0 0 0 0 06 0 0 0< |~~I I I I IJ( I I I I Is   5 ??