ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/cffi/__pycache__/verifier.cpython-38.pyc

U

ل=^�+�@s�ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ej
dkrhddlZdd�Z
nddlZd	d�Z
ej
d
kr�ejZnGdd�dej�ZGd
d�de�ZdZdd�Zdadd�Zdd�Zddd�Zdd�Zdd�ZdS)�N�)�__version_verifier_modules__)�ffiplatform)�VerificationError)�rcCstjjdd�S�N)�	importlib�	machinery�EXTENSION_SUFFIXES�rr�/verifier.py�_extension_suffixessr
cCsdd�t��D�S)NcSs g|]\}}}|tjkr|�qSr)�impZC_EXTENSION)�.0�suffix�_�typerrr�
<listcomp>s
�z'_extension_suffixes.<locals>.<listcomp>)rZget_suffixesrrrrr
s�rcseZdZ�fdd�Z�ZS)�NativeIOcs(t|t�r|�d�}tt|��|�dS)N�ascii)�
isinstanceZunicode�encode�superr�write)�self�s��	__class__rrrs

zNativeIO.write)�__name__�
__module__�__qualname__r�
__classcell__rrrrrsrc@szeZdZddd�Zd dd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zd!dd�Z
dd�Zdd�ZdS)"�VerifierN�F�.ccKsv|jjrtd|jjf��||_||_|s4t�|�}t||�}
|
|�|_|j�	|�|	|_
|�||
�|_|rz|rxt
d��n�d�tjdd�t||g|j�}tjdkr�|�d�}tt�|ddd��d	@�}|�d
��d�}tt�|ddd��d	@�}|�d
��d�}d||jj||f}t�d}|�p0t�|_tj�|j||�|_ tj�|j||�|_!||_"d|_#d|_$dS)NzKfeature not supported with ffi.verify(), but only with ffi.set_source(): %sz)can't specify both 'modulename' and 'tag'�rrzutf-8r�l��Z0x�Lr�0z_cffi_%s_%s%s%sF)%Z_parserZ_uses_new_featurer�ffi�preamblerZflatten�_locate_engine_class�_vengineZpatch_extension_kwds�flags�make_relative_to�kwds�	TypeError�join�sys�versionrZ_cdefsources�version_infor�hex�binasciiZcrc32�lstrip�rstripZ
_class_key�_get_so_suffixes�_caller_dir_pycache�tmpdir�os�path�sourcefilename�modulefilename�ext_package�_has_source�_has_module)rr*r+r<Z
modulenamerA�tag�force_generic_engineZsource_extensionr.�relative_tor0Zflattened_kwdsZ
vengine_class�keyZk1Zk2rrrr�__init__ sR��



��


�
zVerifier.__init__c	Cs8|jj�&|jr |dkr td��|�|�W5QRXdS)zkWrite the C source code.  It is produced in 'self.sourcefilename',
        which can be tweaked beforehand.Nzsource code already written)r*�_lockrBr�
_write_source�r�filerrr�write_sourceHs
�zVerifier.write_sourcec	Cs<|jj�*|jrtd��|js&|��|��W5QRXdS)z�Write the C source code (if not done already) and compile it.
        This produces a dynamic link library in 'self.modulefilename'.zmodule already compiledN)r*rIrCrrBrJ�_compile_module�rrrr�compile_moduleQs
zVerifier.compile_modulec
CsR|jj�@|js4|��|js4|js,|��|��|��W5QR�SQRXdS)a"Get a C module from this Verifier instance.
        Returns an instance of a FFILibrary class that behaves like the
        objects returned by ffi.dlopen(), but that delegates all
        operations to the C module.  If necessary, the C code is written
        and compiled first.
        N)r*rIrC�_locate_modulerBrJrN�
_load_libraryrOrrr�load_library[s
zVerifier.load_librarycCsBtj�|j�}|�dd�d}|�d�r>ttd�r>|dd�}|S)N�.rrZ_dZgettotalrefcount���)r=r>�basenamer@�split�endswith�hasattrr3)rrVrrr�get_module_nameks
zVerifier.get_module_namec	CsVt��|js0|jj�|js&|��W5QRXt�|j�}|��}tj	||f|j
�Sr)rZ_hack_at_distutilsrBr*rIrJZmaybe_relative_pathr?rZ�
get_extensionr0)rZ
sourcename�modnamerrrr[vs
zVerifier.get_extensioncCs|jjSr)r-Z_gen_python_modulerOrrr�generates_python_module�sz Verifier.generates_python_modulecsz|rvtj�|�rvtj�|��|��}tjD]J}||kr*||}t|ttf�sZt	d|f���fdd�|D�}|||<q*|S)Nz&keyword '%s' should be a list or tuplecsg|]}tj��|��qSr)r=r>r2)r�fn��dirnamerrr�sz-Verifier.make_relative_to.<locals>.<listcomp>)
r=r>r`�copyrZLIST_OF_FILE_NAMESr�list�tupler1)rr0rFrGZlstrr_rr/�s
�
zVerifier.make_relative_tocCs�tj�|j�sv|jrJzt|jdddg�}Wntk
r@YdSX|j}nd}|j�	|�
�|t��}|dkrpdS||_|j��d|_
dS)N�__doc__T)r=r>�isfiler@rA�
__import__�ImportError�__path__r-�find_modulerZr:Z
collect_typesrC)rZpkgr>�filenamerrrrQ�s �
zVerifier._locate_modulecCs$||j_z|j��W5|j`XdSr)r-Z_fZwrite_source_to_frKrrr�_write_source_to�szVerifier._write_source_toc	Cs�|dk	r|�|�n�t�}|�|�|��}tj�|j�rbt|jd��}|��|k}W5QRXnd}|r�t	|j�t|jd��}|�
|�W5QRXd|_dS)N�rT�w)rkr�getvaluer=r>�existsr?�open�read�_ensure_dirrrB)rrL�fZsource_data�fpZ
needs_writtenrrrrJ�s

zVerifier._write_sourcecCsptj�|j�}t�||���}zt�||j�}Wnt	k
rHd}YnX|sft
|j�t�||j�d|_
dS)NFT)r=r>r`r?r�compiler[�samefiler@�OSErrorrr�shutilZmoverC)rr<ZoutputfilenameZsamerrrrN�s

zVerifier._compile_modulecCs0|js
t�|jdk	r"|j�|j�S|j��SdSr)rC�AssertionErrorr.r-rSrOrrrrR�s

zVerifier._load_library)NNNr$Fr%NN)N)N)rr r!rHrMrPrSrZr[r]r/rQrkrJrNrRrrrrr#s(�
(
	



r#FcCs|trd}|sPdtjkrd}n4zddl}Wntk
r@d}YnX|j|k	rPd}|rfddlm}|jSddlm	}|j
SdS)NTZ__pypy__r�?r)�vengine_gen)�vengine_cpy)�_FORCE_GENERIC_ENGINEr3�builtin_module_names�
_cffi_backendrgZ_backendr$r{ZVGenericEnginer|ZVCPythonEngine)r*rErr{r|rrrr,�s 


r,cCsHtrtStj�d�}|r|St�d�jj}tj�	tj�
tj�|�d��S)NZCFFI_TMPDIRr'�__pycache__)�_TMPDIRr=�environ�getr3�	_getframe�f_code�co_filenamer>�abspathr2r`)�resultrjrrrr;�s�r;cCs|adS)z:Set the temporary directory to use instead of __pycache__.N)r�r_rrr�
set_tmpdirsr�c	Cs$|pt�}zt�|�}Wntk
r.YdSX|r:d}nt�d��}|D]\}|���d�rL|���|�sz|���d�rLzt�tj	�
||��WqLtk
r�YqLXqLtj	�
|d�g}|D]`}zDt�|�D]4}tj	�
||�}tj	�|�r�|�|�q�t�|�q�Wq�tk
�rYq�Xq�dS)z}Clean up the temporary directory by removing all files in it
    called `_cffi_*.{c,so}` as well as the `build` subdirectory.Nr%rZ_cffi_Zbuild)
r;r=�listdirrwr:�lower�
startswithrX�unlinkr>r2�isdir�append)r<Zkeep_soZfilelistrr^Z	clean_dir�dirrrr�cleanup_tmpdirs8
��r�cCs&t�}|s"tjdkrdg}ndg}|S)NZwin32z.pydz.so)r
r3�platform)�suffixesrrrr:$s
r:cCs*tj�|�}|r&tj�|�s&t�|�dSr)r=r>r`r��makedirs)rjr`rrrrr/srr)NF)r3r=r7rx�ior$rr�errorrr5Zimportlib.machineryrr
r�StringIOr�BytesIO�objectr#r}r,r�r;r�r�r:rrrrrr�<module>s*(


?



Zerion Mini Shell 1.0