U
    {h                     @   s   d dl Z d dlZe jdZedkrzd dlm  mZ W nH ek
r   zd dl	m  mZ W n ek
r|   edY nX Y nX e
eddZedkre
eddZedkrd dlmZ G dd deZeZdS )    Nzsetuptools.command.build_extz:'distutils' cannot be imported. Please install setuptools.Z_du_build_ext	build_ext)r   c                
       sz   e Zd Zejddddddej fddd	d
dg	 Zejdddddg Z fddZ fddZdddZ	 fddZ
  ZS )r   )cython-cplusNzgenerate C++ source files)cython-create-listingNzwrite errors to a listing file)cython-line-directivesNzemit source line directiveszcython-include-dirs=Nz path to the Cython include files)cython-c-in-tempNz'put generated C files in temp directory)zcython-gen-pxiNz*generate .pxi file for public declarations)zcython-directives=Nzcompiler directive overrides)
cython-gdbNz$generate debug information for cygdb)zcython-compile-time-envNzcython compile time environmentr   r   r   r   r   c                    sJ   t    d| _d| _d| _d | _d | _d| _d| _d| _	d | _
d | _d S )Nr   F)superinitialize_optionscython_cpluscython_create_listingcython_line_directivescython_include_dirscython_directivescython_c_in_tempcython_gen_pxi
cython_gdbcython_compile_time_envshared_utility_qualified_nameself	__class__ >/tmp/pip-unpacked-wheel-fhl22ezh/Cython/Distutils/build_ext.pyr	   9   s    
zbuild_ext.initialize_optionsc                    sL   t    | jd krg | _nt| jtr8| jtj| _| jd krHi | _d S N)	r   finalize_optionsr   
isinstancestrsplitospathsepr   r   r   r   r   r   F   s    


zbuild_ext.finalize_optionsFc                 C   s   t | |pt |||S r   )getattr)r   	extensionZoption_namedefaultr   r   r   get_extension_attrP   s    zbuild_ext.get_extension_attrc           	         sV  ddl m} t| j}t|dg D ]}||kr"|| q"t|j|_|jt| j D ]}||krV|| qVt| j}t	|dr|
|j | |drd|_t	|dr|j }nd }| |d| |d	||| |d
r| jnd | |d| |d|| j|dd d| j|dd dd
}||f| j| jdkd|d }|j|_t | d S )Nr   )	cythonizer   r   r
   zc++no_c_in_tracebackr   r   r   r   r   r   )r#   r   )
Zuse_listing_fileZemit_linenumsZinclude_pathZcompiler_directives	build_dirZgenerate_pxiZ	gdb_debugc_line_in_tracebackZcompile_time_envr   )forcequiet)ZCython.Build.Dependenciesr%   listr   r!   appendinclude_dirsdictr   hasattrupdater$   languager&   
build_tempr)   verbosesourcesr   build_extension)	r   extr%   ZincludesZinclude_dirZ
directivesr(   optionsZnew_extr   r   r   r5   S   sP    








 zbuild_ext.build_extension)F)__name__
__module____qualname__
_build_extuser_optionsZsep_byboolean_optionsr	   r   r$   r5   __classcell__r   r   r   r   r      s0      

)sysr   modulesgetZ_build_ext_moduleZdistutils.command.build_extcommandr   ImportErrorZsetuptools.command.build_extr!   r;   Znew_build_extr   r   r   r   <module>   s"   n