a
    «ˆcî  ã                   @   s6   d dl Z d dlZdd„ Zd
dd„Zdd„ Zdd	„ ZdS )é    Nc                  C   s”   ddl m}  ddlm} d dgdœ}| |ƒ}| d¡}d|_d|_| ¡  | d¡}| ¡  z|jdd	g|j	d
d�}W n |yŠ   Y dS 0 |S d S )Nr   )ÚDistribution)ÚDistutilsErrorz--build-ext)Úscript_nameÚscript_argsÚconfigÚ	build_extzint main(void) {return 0;}zPython.hÚc)ÚheadersÚinclude_dirsÚlangF)
Údistutils.distr   Údistutils.errorsr   Úget_command_objZdump_sourceZnoisyÚfinalize_optionsZtry_compiler
   )r   r   ZsargsÚdÚcfgr   Úresult© r   úM/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/tvtk/setup.pyÚcan_compile_extensions
   s(    

ü
r   c                 C   s
  ddl m} ddlm} |d| |ƒ}|jddddd� | d¡ | d¡ | d	¡ | d
¡ | d¡ | d¡ | d¡ | d¡ | d¡ | d¡ | d¡ | d¡ | d¡ | d¡ | d¡ tƒ rò|jd|ddƒg|ddƒgd� | 	dddddd ¡}|S )!Nr   )Újoin)ÚConfigurationZtvtkT)Zignore_setup_xxx_pyZassume_default_configurationZdelegate_options_to_subpackagesÚquietZcustomZpipelineZpyfacezpyface.*z
pyface.*.*Úviewzpipeline/imageszpyface/imagesztools/imagesZpluginsz	plugins.*zplugins.*.*ZtoolsÚutilÚtestsZ	array_extÚsrczarray_ext.czarray_ext.pyx)ÚsourcesÚdependszcode_gen.pyzwrapper_gen.pyzspecial_gen.pyztvtk_base.pyzindenter.pyzvtk_parser.py)
Úos.pathr   Znumpy.distutils.misc_utilr   Zset_optionsZadd_subpackageZadd_data_dirr   Úadd_extensionÚpaths)Úparent_packageZtop_pathr   r   r   Ztvtk_classes_zip_dependsr   r   r   Úconfiguration"   sD    ý
















ýþr#   c                  C   sì   t j t¡} tj | ¡ ddlm} t j | d¡}t j |¡}zt  	|¡ W n   Y n0 t
dƒ t j |¡r€t
dƒ t  |¡ t
ddd� tj ¡  t  ¡ }t  |¡ |d	ƒ}| ¡  | d
¡ t  |¡ t
dƒ t
dƒ tj | ¡ d S )Nr   )ÚTVTKGeneratorztvtk_classes.zipzF----------------------------------------------------------------------z"Deleting possibly old TVTK classeszBuilding TVTK classes...ú )ÚendÚ TzDone.)ÚosÚpathÚdirnameÚ__file__ÚsysÚappendZtvtk.code_genr$   r   ÚmkdirÚprintÚexistsÚunlinkÚstdoutÚflushÚgetcwdÚchdirZgenerate_codeZ	build_zipÚremove)ZMY_DIRr$   ÚtargetÚ
output_dirÚcwdÚgenr   r   r   Úgen_tvtk_classes_zipO   s0    




r;   c                 C   s€   d}t j | ¡r|ddl}| ¡  ¡ dd… }tj | ¡ zddlm	} W n t
y^   d}Y n0 ||krnd}nd}tj ¡  |S )z“Checks the ZIP file's VTK build version versus the current
    installed version of VTK and returns `True` if the versions are
    different.

    Tr   Né   )Úvtk_build_versionF)r(   r)   r0   ÚvtkZ
vtkVersionZGetVTKVersionr,   r-   Ztvtk_classes.vtk_versionr=   ÚImportErrorÚpop)Úzipfiler   r>   Zvtk_versionr=   r   r   r   Úvtk_version_changedj   s    

rB   )NN)r(   r,   r   r#   r;   rB   r   r   r   r   Ú<module>   s
   
-