
    -Ph5                         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 	 ej        Zej        Z G d	 d
          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)	sysconfigc                        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    ^/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/Cython/Distutils/old_build_ext.py__init__zOptimization.__init__2   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>E   s#    LLLSc6K6KS6K6K6Kr    )zipr   r   splitjoinr   )r   flagoptionLr    s       @r   disable_optimizationz!Optimization.disable_optimization?   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_stateH   sA    
DJ77 	0 	0LD&!)/ &	0 	0r   N)__name__
__module____qualname__r   r)   r+   r   r   r   r
   r
   1   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-cplusNr2   )pyrex-create-listingNr4   )pyrex-line-directivesNr6   zpyrex-include-dirs=)pyrex-c-in-tempNr8   )zpyrex-gen-pxiNr9   )zpyrex-directives=Nr:   )	pyrex-gdbNr<   )
r1   r3   r5   r7   r;   r=   r>   r?   r@   rA   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   rD   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_)getattrrC   r   __getattr__)r   names     r   rU   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 rP   )setattr__dict__)r   rV   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)
rC   r   finalize_optionsrH   
isinstancestrr$   ospathseprI   r   s    r   r^   zold_build_ext.finalize_options   s    --d333#+')D$$0#66 	;(..rz:: $!)%'D""" *)r   c                     | j         sd | j        D             rt                                           t          j                            |            d S )Nc                 4    g | ]}t          |d d          dS )rL   F   )rT   )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   )rL   
extensionsoptimizationr)   rC   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]   )rC   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.
        rF   r   rG   rM   rE   zc++rK   rL   FrN   NrI   z.cppz.crJ   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))3rF   rT   rG   rM   rE   languagelowerrK   rL   rN   listrH   appendAttributeErrorinclude_dirsdictrI   hasattrupdateinplacerJ   ra   pathr%   
build_temprV   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_directivesrM   r}   rK   rL   rN   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.   descriptionrC   r   sep_byuser_optionsboolean_optionshelp_optionsextendrD   rU   r[   r^   ri   rk   rl   r   r   r   r0   r0   R   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   r0   )__doc____revision__r   ra   distutils.errorsr   distutils.dep_utilr   r   	distutilsr   distutils.commandr   rC   r   extension_name_reshow_compilersr
   rh   r0   r   r   r   <module>r      s     



 				 3 3 3 3 3 3 1 1 1 1 1 1 1 1       5 5 5 5 5 5      , 0 *0 0 0 0 0 0 0 0< |~~I I I I IJ( I I I I Ir   