ó 8ÝTec@s°ddlZddlZddlZejdkrQd„Zd„Zd„Znejdkrld„ZnejdkrŚejd krŚdd lm Z d „Znçejdkrddl Z ddl Z ddl Z d „Zejd krýd„Zn d„Zejjdƒs<ejjdƒs<ejjdƒrQd„Zd„Zqejd krxd„Zed„Zqd„Zd„Znd„ZedkrŹeƒndS(i˙˙˙˙NtntcCsŻd}tjj|ƒ}|dkr(dS|t|ƒ}tj|jddƒ\}}t|d ƒd}t|dd!ƒd }|dkr—d }n|dkrŤ||Sd S( sĎReturn the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. sMSC v.i˙˙˙˙it iiţ˙˙˙iig$@iN(tsystversiontfindtlentsplittinttNone(tprefixtitstrestt majorVersiont minorVersion((s#/usr/lib64/python2.7/ctypes/util.pyt_get_build_versions    cCswtƒ}|dkrdS|dkr.d}nd|d}ddl}|jƒdddkro|d 7}n|d S( s%Return the name of the VC runtime dllitmsvcrtsmsvcr%di i˙˙˙˙Nis_d.pydtds.dll(RRtimpt get_suffixes(RtclibnameR((s#/usr/lib64/python2.7/ctypes/util.pyt find_msvcrts      cCsĄ|dkrtƒSx‡tjdjtjƒD]l}tjj||ƒ}tjj|ƒr^|S|jƒj dƒryq-n|d}tjj|ƒr-|Sq-WdS(NtctmtPATHs.dll(RR( RtostenvironRtpathseptpathtjointisfiletlowertendswithR(tnamet directorytfname((s#/usr/lib64/python2.7/ctypes/util.pyt find_library0s   tcecCs|S(N((R!((s#/usr/lib64/python2.7/ctypes/util.pyR$Fstposixtdarwin(t dyld_findcCs[d|d|d||fg}x3|D]+}yt|ƒSWq(tk rRq(q(Xq(WdS(Ns lib%s.dylibs%s.dylibs%s.framework/%s(t _dyld_findt ValueErrorR(R!tpossible((s#/usr/lib64/python2.7/ctypes/util.pyR$Ks   c CsŃdtj|ƒ}d}tjƒ}zCtj|d||jfdtdtjƒ}|j ƒ\}}Wdy|j ƒWn+t k rŚ}|j t j kr§‚q§nXXtj||ƒ}|sÄdS|jdƒS(Ns[^\(\)\s]*lib%s\.[^\(\)\s]*sif type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit; fi;LANG=C LC_ALL=C $CC -Wl,-t -o "$2" 2>&1 -l"$1"t _findLib_gcctshelltstdouti(tretescapettempfiletNamedTemporaryFilet subprocesstPopenR!tTruetPIPEt communicatetclosetOSErrorterrnotENOENTtsearchRtgroup( R!texprtcmdttemptprocttracet_tetres((s#/usr/lib64/python2.7/ctypes/util.pyR,Zs"   tsunos5c Cs¤|s dSttjdƒ}y8|,tjdd|fdtjd|ƒ}WdQXWntk rhdSX|jƒ\}}t j d|ƒ}|s—dS|j dƒS(Ntwbs/usr/ccs/bin/dumps-LpvR.tstderrs\[.*\]\sSONAME\s+([^\s]+)i( RtopenRtdevnullR3R4R6R9R7R/R<R=(tftnullRAtdataRCRE((s#/usr/lib64/python2.7/ctypes/util.pyt _get_sonameys  cCs‘|s dSd}tj|d|fdtdtjƒ}|jƒ\}}|jdkrhtjj |ƒSt j d|ƒ}|s„dS|j dƒS(Ns[if ! type objdump >/dev/null 2>&1; then exit 10; fi;objdump -p -j .dynamic 2>/dev/null "$1"RNR-R.i s\sSONAME\s+([^\s]+)i( RR3R4R5R6R7t returncodeRRtbasenameR/R<R=(RKR?RAtdumpRCRE((s#/usr/lib64/python2.7/ctypes/util.pyRN‹s tfreebsdtopenbsdt dragonflycCsf|jdƒ}g}y-x&|r@|jdt|jƒƒƒqWWntk rUnX|petjgS(Nt.i(RtinsertRtpopR*Rtmaxint(tlibnametpartstnums((s#/usr/lib64/python2.7/ctypes/util.pyt _num_versionĄs $ c CsĚtj|ƒ}d||f}ttjdƒ}y/|#tjd dtjd|ƒ}WdQXWntk ryd}nX|j ƒ\}}tj ||ƒ}|s´t t |ƒƒS|j dtƒ|d S( Ns:-l%s\.\S+ => \S*/(lib%s\.\S+)RGs/sbin/ldconfigs-rR.RHttkeyi˙˙˙˙(s/sbin/ldconfigs-r(R/R0RIRRJR3R4R6R9R7tfindallRNR,tsortR\(R!tenameR>RLRARMRCRE((s#/usr/lib64/python2.7/ctypes/util.pyR$Źs     c Cs^tjjdƒsdSttjƒ}d|d<|r>d }nd}d}ttjdƒ}y5|)tj |dtj d|d|ƒ}WdQXWnt k rĽdSXzFx?|j D]4}|j ƒ}|jd ƒrł|jƒd }qłqłWWd|j jƒ|jƒX|sdSxF|jd ƒD]5}tjj|d |ƒ} tjj| ƒr!| Sq!WdS(Ns /usr/bin/crletCtLC_ALLs-64RGR.RHtenvsDefault Library Path (ELF):it:slib%s.so(s /usr/bin/crles-64(s /usr/bin/crle(RRtexistsRtdictRRIRJR3R4R6R9R.tstript startswithRR8twaitR( R!tis64RdtargstpathsRLRAtlinetdirtlibfile((s#/usr/lib64/python2.7/ctypes/util.pyt _findLib_crleĂs>        cCstt||ƒpt|ƒƒS(N(RNRqR,(R!Rk((s#/usr/lib64/python2.7/ctypes/util.pyR$ěsc Cs`ddl}|jdƒdkr8tjƒdd}ntjƒdd}idd6dd 6dd 6dd 6d d 6}|j|dƒ}dtj|ƒ|f}ttjƒ}d|dRdRLtpRMRCRE((s#/usr/lib64/python2.7/ctypes/util.pyt_findSoname_ldconfigńs:      cCst|ƒptt|ƒƒS(N(R}RNR,(R!((s#/usr/lib64/python2.7/ctypes/util.pyR$scCsëddlm}tjdkrC|jGH|jdƒGHtdƒGHntjdkrçtdƒGHtdƒGHtdƒGHtjd kr˝|j d ƒGH|j d ƒGH|j d ƒGH|j d ƒGHqç|j dƒGH|j dƒGHtdƒGHndS(Ni˙˙˙˙(tcdllRRR&RRtbz2R's libm.dylibslibcrypto.dylibslibSystem.dylibsSystem.framework/Systemslibm.sos libcrypt.sotcrypt( tctypesR~RR!RtloadR$Rtplatformt LoadLibrary(R~((s#/usr/lib64/python2.7/ctypes/util.pyttests"   t__main__(RR3RR!RRR$Rƒtctypes.macholib.dyldR(R)R/R1R:R,RNRiR\RqtFalseR}R…t__name__(((s#/usr/lib64/python2.7/ctypes/util.pyts<        $     ) $