3
.W                 @   s   d dl Z d dlZG dd deZG dd deZdddd	d
gZf fddZdddZdddZyd dl	m
Z
 W n ek
r   dd Z
Y nX dd ZyeefZd dlZW n  ek
r   eZd dlZY nX dd Zdd ZdS )    Nc               @   s   e Zd ZdZdS )VerificationErrorz- An error raised when verification fails
    N)__name__
__module____qualname____doc__ r   r   P/var/www/html/enquirykeeper_venv/lib/python3.6/site-packages/cffi/ffiplatform.pyr      s   r   c               @   s   e Zd ZdZdS )VerificationMissingzl An error raised when incomplete structures are passed into
    cdef, but no verification has been done
    N)r   r   r   r   r   r   r   r   r	      s   r	   sourcesinclude_dirslibrary_dirsextra_objectsdependsc             K   sF   ddl m} | g}x|D ]}|jtjj| qW |f ||d|S )Nr   )	Extension)namer
   )distutils.corer   appendospathnormpath)Zsrcfilenamemodnamer
   kwdsr   Z
allsourcessrcr   r   r   get_extension   s
    
r   c             C   s`   t jj }zt| |||}t jj|}W dx.|j D ]"\}}t jj||kr4|t j|< q4W X |S )z-Compile a C extension module using distutils.N)r   environcopy_buildr   abspathitemsget)tmpdirextcompiler_verbosedebugZsaved_environZoutputfilenamekeyvaluer   r   r   compile   s    
r&   c             C   s  ddl m} dd l}dd l}|d|gi}|j  |jd}|d krLtjj}d|f|d< d|d< d| f|d	< d| f|d
< yR|j	j
dpd}z.|j	j| |jd |jd}	|	j \}
W d |j	j
| X W nD |jj|jjfk
r } ztd|jj|f W Y d d }~X nX |
S )Nr   )Distributionext_modules	build_extffiplatformr#   Tforce	build_lib
build_tempz%s: %s)r*   T)r   r'   distutils.errorsZdistutils.logparse_config_filesget_option_dictsysflagsr#   logset_thresholdset_verbosityrun_commandget_command_objget_outputserrorsCompileError	LinkErrorr   	__class__r   )r    r!   r"   r#   r'   	distutilsdistoptionsZ	old_levelcmd_objZsonameer   r   r   r   '   s.    


&r   )samefilec             C   s   t jj| t jj|kS )N)r   r   r   )f1f2r   r   r   rB   H   s    rB   c             C   s   t jj| s| S | }g }xn|}t jj|\}}||ks<| r@| S |j| y$t|t jrl|j  t jj| S W q t	k
r   Y qX qW d S )N)
r   r   isabssplitr   rB   curdirreversejoinOSError)r   dirnamesZprevdirr   r   r   r   maybe_relative_pathK   s     
rM   c             C   s   t | tr"|jdt| | f  nt | trrt| j }|jdt|  x|D ]}t|| t| | | qPW ndt | tt	fr|jdt|   xB| D ]}t|| qW n*t | t
r|jd| f  ntd| f d S )Nz%ds%sz%ddz%dlz%diz7the keywords to verify() contains unsupported object %r)
isinstancestrwritelendictsortedkeys_flattenlisttupleint_or_long	TypeError)xfrT   r$   r%   r   r   r   rU   f   s     





rU   c             C   s   t j }t| | |j S )N)	cStringIOStringIOrU   getvalue)rZ   r[   r   r   r   flatteny   s    
r_   )r   N)r   N)r1   r   	Exceptionr   r	   ZLIST_OF_FILE_NAMESr   r&   r   os.pathrB   ImportErrorrM   intlongrX   r\   	NameErroriorU   r_   r   r   r   r   <module>   s(   

