ó {fc@sIdZddlZddlmZddlmZddlTdddd gZejj d ƒd d d gZ ejj dƒdddgZ d„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.pyt ensure_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|s x1t 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.pyts<