Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/ctypes/
Upload File :
Current File : //usr/lib/python2.7/ctypes/util.pyc


|_c@s}ddlZddlZejdkrEdZdZdZnejdkr`dZnejdkrejd	krdd
lmZ	dZnejdkrZddl
Z
ddlZddlZdZ
ejd
krdZn	dZejjds0ejjds0ejjdrEdZdZqZdZdZndZedkryendS(iNtntcCsd}tjj|}|dkr(dS|t|}tj|jdd\}}t|d d}t|dd!d	}|dkrd
}n|dkr||SdS(sReturn 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.iit iiiig$@iN(tsystversiontfindtlentsplittinttNone(tprefixtitstresttmajorVersiontminorVersion((s!/usr/lib/python2.7/ctypes/util.pyt_get_build_version	s	cCswt}|dkrdS|dkr.d}nd|d}ddl}|jdddkro|d	7}n|d
S(s%Return the name of the VC runtime dllitmsvcrtsmsvcr%di
iNis_d.pydtds.dll(RRtimptget_suffixes(RtclibnameR((s!/usr/lib/python2.7/ctypes/util.pytfind_msvcrt s		
cCs|dkrtSxtjdjtjD]l}tjj||}tjj|r^|S|jj	dryq-n|d}tjj|r-|Sq-WdS(NtctmtPATHs.dll(RR(RtostenvironRtpathseptpathtjointisfiletlowertendswithR(tnamet	directorytfname((s!/usr/lib/python2.7/ctypes/util.pytfind_library1s 
tcecCs|S(N((R!((s!/usr/lib/python2.7/ctypes/util.pyR$Gstposixtdarwin(t	dyld_findcCs[d|d|d||fg}x3|D]+}yt|SWq(tk
rRq(q(Xq(WdS(Nslib%s.dylibs%s.dylibs%s.framework/%s(t
_dyld_findt
ValueErrorR(R!tpossible((s!/usr/lib/python2.7/ctypes/util.pyR$Ls

c
Csdtj|}tj\}}tj|d|d|}z3tj|}z|j}Wd|j}XWdytj|Wn+t	k
r}|j
t
jkrqnXX|dkrt	dntj||}	|	sdS|	jdS(Ns[^\(\)\s]*lib%s\.[^\(\)\s]*srif type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit 10; fi;$CC -Wl,-t -o s 2>&1 -li
sgcc or cc command not foundi(tretescapettempfiletmkstempRtclosetpopentreadtunlinktOSErrorterrnotENOENTtsearchRtgroup(
R!texprtfdouttccouttcmdtfttracetrvtetres((s!/usr/lib/python2.7/ctypes/util.pyt_findLib_gcc[s(
tsunos5cCsj|s
dSd|}tj|}z|j}Wd|jXtjd|}|s]dS|jdS(Ns#/usr/ccs/bin/dump -Lpv 2>/dev/null s\[.*\]\sSONAME\s+([^\s]+)i(RRR1R2R0R,R7R8(R=R<tdataRA((s!/usr/lib/python2.7/ctypes/util.pyt_get_sonamews
cCs|s
dSd|}tj|}|j}|j}|dkrStdntj|}z|j}Wd|jXtjd|}|sdS|jdS(NsWif ! type objdump >/dev/null 2>&1; then exit 10; fi;objdump -p -j .dynamic 2>/dev/null i
sobjdump command not founds\sSONAME\s+([^\s]+)i(	RRR1R2R0R4R,R7R8(R=R<tdumpR?RDRA((s!/usr/lib/python2.7/ctypes/util.pyREs"tfreebsdtopenbsdt	dragonflycCsf|jd}g}y-x&|r@|jdt|jqWWntk
rUnX|petjgS(Nt.i(RtinsertRtpopR*Rtmaxint(tlibnametpartstnums((s!/usr/lib/python2.7/ctypes/util.pyt_num_versions	$
cCstj|}d||f}tjd}z|j}Wd|jXtj||}|sttt|S|j	dd|dS(Ns:-l%s\.\S+ => \S*/(lib%s\.\S+)s/sbin/ldconfig -r 2>/dev/nulltcmpcSstt|t|S(N(RRRQ(txty((s!/usr/lib/python2.7/ctypes/util.pyt<lambda>si(
R,R-RR1R2R0tfindallRERBtsort(R!tenameR9R=RDRA((s!/usr/lib/python2.7/ctypes/util.pyR$sc
Csddl}tjd}|jdr4d}n|jddkrV|d}n
|d}idd6d	d
6d	d6d	d6d
d6dd6}|j|d}dtj||f}tjd}z|j	}Wd|j
Xtj||}	|	sdS|	j
dS(Niitarmtls-32s-64slibc6,x86-64s	x86_64-64slibc6,64bitsppc64-64s
sparc64-64ss390x-64slibc6,IA-64sia64-64slibc6(,hard-float)?sarm-32tlibc6s\s+(lib%s\.[^\s]+)\s+\(%ss/sbin/ldconfig -p 2>/dev/nulli(tstructRtunamet
startswithtcalcsizetgetR,R-R1R2R0R7RR8(
R!R\R]tmachinetmach_maptabi_typeR9R=RDRA((s!/usr/lib/python2.7/ctypes/util.pyt_findSoname_ldconfigs0	


cCst|ptt|S(N(RdRERB(R!((s!/usr/lib/python2.7/ctypes/util.pyR$scCsddlm}tjdkrC|jGH|jdGHtdGHntjdkrtdGHtdGHtdGHtjd	kr|j	d
GH|j	dGH|j	dGH|j	d
GHq|j	dGH|j	dGHtdGHndS(Ni(tcdllRRR&RRtbz2R's
libm.dylibslibcrypto.dylibslibSystem.dylibsSystem.framework/Systemslibm.soslibcrypt.sotcrypt(
tctypesReRR!RtloadR$RtplatformtLoadLibrary(Re((s!/usr/lib/python2.7/ctypes/util.pyttests"t__main__(RRR!RRR$Rjtctypes.macholib.dyldR(R)R,R.R5RBRER^RQRdRlt__name__(((s!/usr/lib/python2.7/ctypes/util.pyt<module>s2		$				&