Your IP : 18.226.186.153


Current Path : /usr/lib64/python3.6/site-packages/cffi/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/cffi/__pycache__/setuptools_ext.cpython-36.pyc

3

M��Z �@snddlZddlZyeWnek
r0eZYnXdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)�NcCsddlm}||��dS)Nr)�DistutilsSetupError)Zdistutils.errorsr)�msgr�r�&/usr/lib64/python3.6/setuptools_ext.py�error
srcCs@t|��}|j�}WdQRX|d7}t||d�}t|||�dS)N�
�exec)�open�read�compiler)�filenameZglob�f�src�coderrr�execfiles

rc
Cs�ddlm}t|t�s*tdt|�jf�t|�}y|jd�\}}Wn"t	k
rftd|f�YnXt
jj|�s�d}|j
dd�d	}t
jj|�r�d
|d|f}td||f�d|d
�}t||�y||}Wn$tk
r�td||f�YnXt||��s|�}t||��s0td|t|�jf�t|d��sJtd|f�|j\}	}
}}|j�rr|j�}|j|�|
dk�r�t|||	�nt|||	|
||�dS)Nr)�FFIzEargument to 'cffi_modules=...' must be a str or a list of str, not %r�:z3%r must be of the form 'path/build.py:ffi_variable'��.�/z.pyz (rewrite cffi_modules to [%r])z#%r does not name an existing file%sZ__cffi__)�__name__�__file__z!%r: object %r not found in modulez"%r is not an FFI instance (got %r)�_assigned_sourcez*%r: the set_source() method was not called)Zcffi.apir�
isinstance�
basestringr�typer�str�split�
ValueError�os�path�exists�replacer�KeyError�hasattrrZ_windows_unicode�copyZ_apply_windows_unicode�_add_py_module�
_add_c_module)
�distZmod_specrZbuild_file_nameZffi_var_name�extZ	rewrittenZmod_vars�ffi�module_name�source�source_extension�kwdsrrr�add_cffi_modulesL




r/cCspd|krlttd�rltjdkrlddl}y(t|jjd�d�}|dkrLd|d<Wntk
rjd|d<YnX|S)	a�
    Add py_limited_api to kwds if setuptools >= 26 is in use.
    Do not alter the setting if it already exists.
    Setuptools takes care of ignoring the flag on Python 2 and PyPy.

    CPython itself should ignore the flag in a debugging version
    (by not listing .abi3.so in the extensions it supports), but
    it doesn't so far, creating troubles.  That's why we check
    for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent
    of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401)

    On Windows, it's better not to use py_limited_api until issue #355
    can be resolved (by having virtualenv copy PYTHON3.DLL).  See also
    the start of _cffi_include.h.
    Zpy_limited_api�gettotalrefcountZwin32rNr�T)r$�sys�platform�
setuptools�int�__version__�	partitionr)�	Extensionr.r4Zsetuptools_major_versionrrr�_set_py_limited_apiIs
r9c
	s�ddlm}ddlm}ddlm�ddlm�ddlm	�dg}|j
|jdg��t||�}|f�|d	�|���d��������	fd
d�	�|j
dkr�g|_
|j
j��|jjd|��G���fd
d�d��}	|	|jd<dS)Nr)r8)�	build_ext)�mkpath)�log)�
recompilerz$PLACEHOLDER�sources)�namer>cs\tjj|���}�jd|��|�|dk	r:|����j���|�}|sX�jd�|S)Nzgenerating cffi module %rzalready up-to-date)rr �join�infoZ
make_c_source)Ztmpdir�pre_runZc_file�updated)r)r*r<r;r+r=r,r-rr�make_modts

z_add_c_module.<locals>.make_modr:cseZdZ���fdd�ZdS)z)_add_c_module.<locals>.build_ext_make_modcs:�jddkr,t|dd�}�|j|��jd<�j|�dS)Nrz$PLACEHOLDERrB)r>�getattrZ
build_temp�run)�selfrB)�
base_classr)rDrrrF�sz-_add_c_module.<locals>.build_ext_make_mod.runN)r�
__module__�__qualname__rFr)rHr)rDrr�build_ext_make_mod�srK)N)Zdistutils.corer8�setuptools.command.build_extr:�distutils.dir_utilr;�	distutilsr<�cffir=�extend�popr9Zext_modules�append�cmdclass�get)
r(r*r+r,r-r.r8r:Z
allsourcesrKr)
rHr)r*r<rDr;r+r=r,r-rr'gs 

r'cs�ddlm�ddlm}ddlm}ddlm�ddlm	������fdd��|j
jd	|��G���fd
d�d��}||j
d	<|jdkr�g|_|jj
��|j
jd|��G���fd
d�d��}||j
d<dS)Nr)r;)�build_py)r:)r<)r=cs>�jd|��tjj|���j��|�}|s:�jd�dS)Nzgenerating cffi module %rzalready up-to-date)rArr �dirnameZmake_py_source)Zpy_filerC)r*r<r;r+r=rr�generate_mod�s
z$_add_py_module.<locals>.generate_modrUcseZdZ���fdd�ZdS)z)_add_py_module.<locals>.build_py_make_modcs@�j|��jd�}|dd7<�tjj|jf|���dS)Nr�z.py���)rFrrr r@Z	build_lib)rG�module_path)rHrWr+rrrF�s

z-_add_py_module.<locals>.build_py_make_mod.runN)rrIrJrFr)rHrWr+rr�build_py_make_mod�sr[r:cseZdZ���fdd�ZdS)z*_add_py_module.<locals>.build_ext_make_modcsb�j|�|jr^�jd�}dj|dd��}|jd�}|j|�}|dd}�tjj||��dS)NrrXrUz.pyrYrY)rFZinplacerr@Zget_finalized_commandZget_package_dirrr )rGrZ�packagerUZpackage_dir�	file_name)�base_class_2rWr+rrrF�s



z._add_py_module.<locals>.build_ext_make_mod.runN)rrIrJrFr)r^rWr+rrrK�srK)rMr;Zsetuptools.command.build_pyrUrLr:rNr<rOr=rSrTZ
py_modulesrR)r(r*r+rUr:r[rKr)rHr^r*rWr<r;r+r=rr&�s
	
r&cCs8|dkst�t|t�r|g}x|D]}t||�q"WdS)N�cffi_modules)�AssertionErrorrrr/)r(�attr�valueZcffi_modulerrrr_�s


r_)rr2r�	NameErrorrrrr/r9r'r&r_rrrr�<module>s

-.1

?>