Your IP : 18.224.43.98


Current Path : /lib64/python2.7/ctypes/macholib/
Upload File :
Current File : //lib64/python2.7/ctypes/macholib/dyld.pyo

�
{fc@sIdZddlZddlmZddlmZddlTdddd	gZejj	d
�ddd
gZ
ejj	d�dddgZd�Zd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zddd�Zddd�Zd�Zed krEe�ndS(!s
dyld emulation
i����N(tframework_info(t
dylib_info(t*t	dyld_findtframework_findRRs~/Library/Frameworkss/Library/Frameworkss/Network/Library/Frameworkss/System/Library/Frameworkss~/libs/usr/local/libs/libs/usr/libcCs t|t�r|jd�S|S(sCNot all of PyObjC and Python understand unicode paths very well yettutf8(t
isinstancetunicodetencode(ts((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytensure_utf8s
cCsD|dkrtj}n|j|�}|dkr7gS|jd�S(Nt:(tNonetostenvirontgettsplit(tenvtvartrval((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_env%scCs%|dkrtj}n|jd�S(NtDYLD_IMAGE_SUFFIX(RR
RR(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_image_suffix-scCs
t|d�S(NtDYLD_FRAMEWORK_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_framework_path2scCs
t|d�S(NtDYLD_LIBRARY_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_library_path5scCs
t|d�S(NtDYLD_FALLBACK_FRAMEWORK_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_fallback_framework_path8scCs
t|d�S(NtDYLD_FALLBACK_LIBRARY_PATH(R(R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_fallback_library_path;scCs2t|�}|dkr|S||d�}|�S(s>For a potential path iterator, add DYLD_IMAGE_SUFFIX semanticscssMxF|D]>}|jd�r7|td� |dVn	||V|VqWdS(Ns.dylib(tendswithtlen(titeratortsuffixtpath((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyt_injectCs

	N(RR(R!RR"R$((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_image_suffix_search>s
ccs�t|�}|dk	rJx/t|�D]}tjj||d�Vq%Wnx4t|�D]&}tjj|tjj|��VqWWdS(Ntname(RRRR
R#tjoinRtbasename(R&Rt	frameworkR#((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_override_searchLsccs@|jd�r<|dk	r<tjj||td��VndS(Ns@executable_path/(t
startswithRR
R#R'R (R&texecutable_path((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_executable_path_search]sccs|Vt|�}|dk	rUt|�}x)|D]}tjj||d�Vq0Wnt|�}x.|D]&}tjj|tjj|��VqhW|dk	r�|r�x)tD]}tjj||d�Vq�Wn|sx1t	D]&}tjj|tjj|��Vq�WndS(NR&(
RRRR
R#R'RR(tDEFAULT_FRAMEWORK_FALLBACKtDEFAULT_LIBRARY_FALLBACK(R&RR)tfallback_framework_pathR#tfallback_library_path((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pytdyld_default_searchds

$

cCs�t|�}t|�}xTttt||�t||�t||��|�D]}tjj|�rO|SqOWt	d|f��dS(s:
    Find a library or framework using dyld semantics
    sdylib %s could not be foundN(
R
R%tchainR*R-R2R
R#tisfilet
ValueError(R&R,RR#((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyRzs	
cCs�yt|d|d|�SWntk
r/}nX|jd�}|dkrdt|�}|d7}ntjj|tjj|| ��}yt|d|d|�SWntk
r�|�nXdS(s�
    Find a framework using dyld semantics in a very loose manner.

    Will take input such as:
        Python
        Python.framework
        Python.framework/Versions/Current
    R,Rs
.frameworki����N(RR5trfindR R
R#R'R((tfnR,Rtet
fmwk_index((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyR�s	
%
cCs
i}dS(N((R((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyttest_dyld_find�st__main__(t__doc__R
R)RtdylibRt	itertoolst__all__R#t
expanduserR.R/R
RRRRRRRR%R*R-R2RRR:t__name__(((s,/usr/lib64/python2.7/ctypes/macholib/dyld.pyt<module>s<
					

?>