3 ^Ec@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 iN)framework_info) dylib_info)Z* 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)Nz:)osenvirongetZsplit)envZvarZrvalr,/usr/lib64/python3.6/ctypes/macholib/dyld.pydyld_envs  r cCs|dkrtj}|jdS)NZDYLD_IMAGE_SUFFIX)rrrrrrr dyld_image_suffix'sr cC t|dS)NZDYLD_FRAMEWORK_PATHr r rrr dyld_framework_path,rcCr )NZDYLD_LIBRARY_PATHrr rrr dyld_library_path/rrcCr )NZDYLD_FALLBACK_FRAMEWORK_PATHrr rrr dyld_fallback_framework_path2rrcCr )NZDYLD_FALLBACK_LIBRARY_PATHrr rrr dyld_fallback_library_path5rrcCs(t|}|dkr|S||fdd}|S)z>For a potential path iterator, add DYLD_IMAGE_SUFFIX semanticsNcssJxD|D]<}|jdr2|dtd |dVn ||V|VqWdS)Nz.dylib)Zendswithlen)iteratorsuffixpathrrr _inject=s    z)dyld_image_suffix_search.._inject)r )rrrrrrr dyld_image_suffix_search8s rccsdt|}|dk r6x$t|D]}tjj||dVqWx(t|D]}tjj|tjj|Vq@WdSNname)rrrrjoinrbasename)rr frameworkrrrr dyld_override_searchFs rccs2|jdr.|dk r.tjj||tddVdS)Nz@executable_path/)Z startswithrrrr)rexecutable_pathrrr dyld_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|VqWdSr) rrrrrrrDEFAULT_FRAMEWORK_FALLBACKDEFAULT_LIBRARY_FALLBACK)rrrZfallback_framework_pathrZfallback_library_pathrrr dyld_default_search^s    r$cCsPxs: