Viewing File: /usr/lib64/python2.7/site-packages/cffi/verifier.pyo

ó
p§Wc@s7ddlZddlZddlZddlZddlZddlmZddlmZejdkrƒddl	Z
d„ZnddlZd„Zejdkr³ej
Zndejfd	„ƒYZd
„Zdefd„ƒYZeZd
„Zdad„Zd„Zded„Zd„Zd„ZdS(iÿÿÿÿNi(t__version_verifier_modules__(tffiplatformicCstjjS(N(t	importlibt	machinerytEXTENSION_SUFFIXES(((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyt_extension_suffixes
scCs5gtjƒD]$\}}}|tjkr
|^q
S(N(timptget_suffixestC_EXTENSION(tsuffixt_ttype((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRstNativeIOcBseZd„ZRS(cCs;t|tƒr!|jdƒ}ntt|ƒj|ƒdS(Ntascii(t
isinstancetunicodetencodetsuperRtwrite(tselfts((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRs(t__name__t
__module__R(((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRscCs:tjdkr6yddl}Wq6tk
r2q6XndS(Ntwin32iÿÿÿÿ(tsystplatformt
setuptoolstImportError(R((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyt_hack_at_distutilss

tVerifierc	Bs›eZddddedddd„Zdd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
dd„Zd
„Zd„ZRS(ts.ccKs|jjr+tjd|jjfƒ‚n||_||_|sUtj|ƒ}nt||ƒ}
|
|ƒ|_|jj	|ƒ|	|_
|j||
ƒ|_|r¿|r¡t
dƒ‚q¡nâdjtjd t||g|jƒ}tjdkr	|jdƒ}nttj|ddd…ƒd@ƒ}|jd	ƒjd
ƒ}ttj|ddd…ƒd@ƒ}|jdƒjd
ƒ}d
||jj||f}tƒd}|pºtƒ|_tjj|j||ƒ|_ tjj|j||ƒ|_!||_"t#|_$t#|_%dS(NsKfeature not supported with ffi.verify(), but only with ffi.set_source(): %ss)can't specify both 'modulename' and 'tag'tisutf-8iiIÿÿÿÿt0xtLit0s_cffi_%s_%s%s%s(i(&t_parsert_uses_new_featureRtVerificationErrortffitpreambletflattent_locate_engine_classt_venginetpatch_extension_kwdstflagstmake_relative_totkwdst	TypeErrortjoinRtversionRt_cdefsourcestversion_infoRthextbinasciitcrc32tlstriptrstript
_class_keyt_get_so_suffixest_caller_dir_pycachettmpdirtostpathtsourcefilenametmodulefilenametext_packagetFalset_has_sourcet_has_module(RR&R'R<t
modulenameRAttagtforce_generic_enginetsource_extensionR,trelative_toR.tflattened_kwdst
vengine_classtkeytk1tk2R	((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyt__init__)sD				
&&

		cCsK|jj9|jr4|dkr4tjdƒ‚n|j|ƒWdQXdS(skWrite the C source code.  It is produced in 'self.sourcefilename',
        which can be tweaked beforehand.ssource code already writtenN(R&t_lockRCtNoneRR%t
_write_source(Rtfile((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pytwrite_sourceQs

cCsR|jj@|jr(tjdƒ‚n|js>|jƒn|jƒWdQXdS(s„Write the C source code (if not done already) and compile it.
        This produces a dynamic link library in 'self.modulefilename'.smodule already compiledN(R&RPRDRR%RCRRt_compile_module(R((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pytcompile_moduleZs
		
cCsc|jjQ|jsO|jƒ|jsO|js?|jƒn|jƒqOn|jƒSWdQXdS(s"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&RPRDt_locate_moduleRCRRRUt
_load_library(R((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pytload_libraryds
	
		
cCsZtjj|jƒ}|jddƒd}|jdƒrVttdƒrV|d }n|S(Nt.iit_dtgettotalrefcountiþÿÿÿ(R=R>tbasenameR@tsplittendswiththasattrR(RR]((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pytget_module_namets

cCsptƒ|js<|jj|js3|jƒnWdQXntj|jƒ}|jƒ}tj	|||j
S(N(RRCR&RPRRRtmaybe_relative_pathR?Rat
get_extensionR.(Rt
sourcenametmodname((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRcs	
	cCs
|jjS(N(R*t_gen_python_module(R((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pytgenerates_python_module‰scCsÇ|rÃtjj|ƒrÃtjj|ƒ}|jƒ}xŠtjD]|}||kr@||}t|ttfƒs‡t	d|fƒ‚ng|D]}tjj
||ƒ^qŽ}|||<q@q@Wn|S(Ns&keyword '%s' should be a list or tuple(R=R>tdirnametcopyRtLIST_OF_FILE_NAMESRtlistttupleR/R0(RR.RIRhRLtlsttfn((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyR-Œs
(cCs»tjj|jƒs¡|jr^yt|jdddgƒ}Wntk
rQdSX|j}nd}|j	j
|jƒ|tƒƒ}|dkr•dS||_n|j	j
ƒt|_dS(Nt__doc__(R=R>tisfileR@RAt
__import__RQRt__path__R*tfind_moduleRaR:t
collect_typestTrueRD(RtpkgR>tfilename((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRWœs	

cCs.||j_z|jjƒWd|j`XdS(N(R*t_ftwrite_source_to_f(RRS((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyt_write_source_to¯scCsÕ|dk	r|j|ƒnµtƒ}|j|ƒ|jƒ}tjj|jƒr„t|jdƒ}|j	ƒ|k}WdQXnt
}|rÈt|jƒt|jdƒ}|j|ƒWdQXnt
|_
dS(Ntrtw(RQRzRtgetvalueR=R>texistsR?topentreadRut_ensure_dirRRC(RRStftsource_datatfpt
needs_written((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRR¶s	

cCs–tjj|jƒ}tj||jƒƒ}ytj||jƒ}Wnt	k
r_t
}nX|s‰t|jƒtj
||jƒnt|_dS(N(R=R>RhR?RtcompileRctsamefileR@tOSErrorRBRtshutiltmoveRuRD(RR<toutputfilenametsame((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRUÏs


cCs3|jdk	r"|jj|jƒS|jjƒSdS(N(R,RQR*RY(R((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyRXÜsN(RRRQRBRORTRVRYRaRcRgR-RWRzRRRURX(((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyR's	&		
			
					
cCsªtrt}n|srdtjkr-t}qryddl}Wntk
rVd}nX|j|k	rrt}qrn|rddlm}|j	Sddlm
}|jSdS(Nt__pypy__iÿÿÿÿt?i(tvengine_gen(tvengine_cpy(t_FORCE_GENERIC_ENGINERuRtbuiltin_module_namest
_cffi_backendRt_backendRRtVGenericEngineRtVCPythonEngine(R&RGR“RR((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyR)çs 		

cCsftr
tStjjdƒ}|r&|Stjdƒjj}tjj	tjj
tjj|ƒdƒƒS(NtCFFI_TMPDIRit__pycache__(t_TMPDIRR=tenvirontgetRt	_getframetf_codetco_filenameR>tabspathR0Rh(tresultRw((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyR;ÿs!cCs
|adS(s:Set the temporary directory to use instead of __pycache__.N(R™(Rh((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyt
set_tmpdir	sc	Csƒ|ptƒ}ytj|ƒ}Wntk
r6dSX|rFd}ntƒdjƒ}x„|D]|}|jƒjdƒr`|jƒj|ƒs¥|jƒjdƒr`y tjtj	j
||ƒƒWqÜtk
rØqÜXq`q`Wtj	j
|dƒg}x„|D]|}ybx[tj|ƒD]J}tj	j
||ƒ}tj	j|ƒrU|j|ƒqtj|ƒqWWqÿtk
rzqÿXqÿWdS(s}Clean up the temporary directory by removing all files in it
    called `_cffi_*.{c,so}` as well as the `build` subdirectory.Ns.cit_cffi_tbuild(
R;R=tlistdirRˆR:tlowert
startswithR_tunlinkR>R0tisdirtappend(R<tkeep_sotfilelistR	Rnt	clean_dirtdir((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pytcleanup_tmpdirs2
	
* 


cCs:tƒ}|s6tjdkr*dg}q6dg}n|S(NRs.pyds.so(RRR(tsuffixes((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyR:-s	cCs5ytjtjj|ƒƒWntk
r0nXdS(N(R=tmakedirsR>RhRˆ(Rw((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyR8s
(ii(i(RR=R5R‰tioRRRR3timportlib.machineryRRRtStringIORtBytesIORtobjectRRBR‘R)RQR™R;R¡R®R:R(((s3/usr/lib64/python2.7/site-packages/cffi/verifier.pyt<module>s(<		¾		
		
Back to Directory File Manager