3 \E@sdZddlZddlmZddlmZddlTdddd gZejj d d d d gZ ejj ddddgZ ddZ d+ddZ d,ddZd-ddZd.ddZd/ddZd0ddZd1d d!Zd2d"d#Zd3d$d%Zd4d&dZd5d'dZd(d)Zed*kredS)6z dyld emulation N)framework_info) dylib_info)* dyld_findframework_findrrz~/Library/Frameworksz/Library/Frameworksz/Network/Library/Frameworksz/System/Library/Frameworksz~/libz/usr/local/libz/libz/usr/libcCs.|dkrtj}|j|}|dkr$gS|jdS)N:)osenvirongetsplit)envvarZrvalr,/usr/lib64/python3.6/ctypes/macholib/dyld.pydyld_envs  rcCs|dkrtj}|jdS)NZDYLD_IMAGE_SUFFIX)rr r )r rrrdyld_image_suffix'srcCs t|dS)NZDYLD_FRAMEWORK_PATH)r)r rrrdyld_framework_path,srcCs t|dS)NZDYLD_LIBRARY_PATH)r)r rrrdyld_library_path/srcCs t|dS)NZDYLD_FALLBACK_FRAMEWORK_PATH)r)r rrrdyld_fallback_framework_path2srcCs t|dS)NZDYLD_FALLBACK_LIBRARY_PATH)r)r rrrdyld_fallback_library_path5srcCs(t|}|dkr|S||fdd}|S)z>For a potential path iterator, add DYLD_IMAGE_SUFFIX semanticsNcssJxD|D]<}|jdr2|dtd |dVn ||V|VqWdS)Nz.dylib)endswithlen)iteratorsuffixpathrrr_inject=s    z)dyld_image_suffix_search.._inject)r)rr rrrrrdyld_image_suffix_search8s rccsdt|}|dk r6x$t|D]}tjj||dVqWx(t|D]}tjj|tjj|Vq@WdS)Nname)rrrrjoinrbasename)rr frameworkrrrrdyld_override_searchFs r!ccs2|jdr.|dk r.tjj||tddVdS)Nz@executable_path/) startswithrrrr)rexecutable_pathrrrdyld_executable_path_searchWsr$ccs|Vt|}|dk r@t|}x |D]}tjj||dVq$Wt|}x$|D]}tjj|tjj|VqNW|dk r| rx tD]}tjj||dVqW|sx$tD]}tjj|tjj|VqWdS)Nr) rrrrrrrDEFAULT_FRAMEWORK_FALLBACKDEFAULT_LIBRARY_FALLBACK)rr r Zfallback_framework_pathrZfallback_library_pathrrrdyld_default_search^s    r'cCsPxs: