o
    '[hF                     @   s   d Z ddlZddlZddlmZmZmZ ddlmZ ddl	m
Z
 z
ddlmZ dZW n ey5   dZY nw dZi a		dd	d
ZedkrQed ddlmZ dS dS )zBuild a Pyrex file from .pyx source to .so loadable module using
the installed distutils infrastructure. Call:

out_fname = pyx_to_dll("foo.pyx")
    N)DistutilsArgErrorDistutilsErrorCCompilerError)	Extension)grok_environment_error)	build_extTFc           $   	   C   s  t j| sJ dt j|  t jt j| \}}	|sBt j|	\}
}|dv s.J |ts;| dt|  d } t|
| gd}|du rHi }|sQt j	|d}|}|j
dddd	 D ]}t j|\}}||krpd} nq^|d
g }ts}d|v rd}nd}|r|ddg}n|dg}|r|d |r|r|d|g |j
dks|j
drt|dsddi|_n
d|jvrd|jd< | }|d|| d ddlm} ||}|jsg |_|j| trdti|_|d}||_| }|| z| }W n	 ty    w trtd |   |sJ z|d}|!  |" d }|j#r?t j	t j$| t j%|}|r|}t j&|}t'|d\}}}||kr]|}|W S t j%|}|dk r|d7 }t j	|j(|d|  } z)ddl)}!zt j*| rt +|  W n t,y   Y W qcw |!-||  | }W n t.y   Y qcw nt/d| |||ft'|< |W S  t0y   t12d Y dS  t.t j3fy   t14 d }"t5|"}#trt1j67|#d    w )!zUCompile a PYX file to a DLL and return the name of the generated .so
       or .dll .zCould not find %s)z.pyxz.pyNz.c)namesources_pyxbld.script_argsz	--verbosez--quietr   z--cython-c-in-tempz--forcez--build-lib__init__z	.__init__cython_directivesset_initial_path
SOURCEFILE)script_namer   r   )Distributionbuildz%options (after parsing command line):)NNr   d      z	.reload%sz#reload count for %s reached maximum
)8ospathexistsabspathsplitsplitext
HAS_CYTHONlenr   joinr   getDEBUGappendextendendswithhasattrr   copyupdatedistutils.distr   ext_modulesr   cmdclassget_command_obj
build_basefind_config_filesparse_config_filesparse_command_liner   printdump_option_dictsrun_commandsget_outputsinplacedirnamebasenamegetmtime_reloads	build_libshutilisfileunlinkOSErrorcopy2IOErrorImportErrorKeyboardInterruptsysexiterrorexc_infor   stderrwrite)$filenameextforce_rebuildbuild_in_temppyxbuild_dir
setup_argsreload_supportr6   r   r   modname	extensionpackage_base_dirpackage_namepnamer   quietargssargsr   distr   cfgfilesokobj_build_extso_pathorg_path	timestamplast_timestamp	last_pathcountr8   r_pathr<   excrF    re   G/var/www/vscode/pina/lib/python3.10/site-packages/pyximport/pyxbuild.py
pyx_to_dll   s    














rg   __main__z	dummy.pyxr   )test)Nr   FNNFF)__doc__r   rD   distutils.errorsr   r   r   distutils.extensionr   distutils.utilr   Cython.Distutils.build_extr   r   rB   r#   r:   rg   __name__ ri   re   re   re   rf   <module>   s,    
 