h8ddlZddlZddlZddlZejdkr dZdZdZnejdkrejdkr ddl m Z d Znej d rdd l mZnhejdkr]ddlZddlZd Zd ZejdkrdZndZej drdZdZnejdkrdZddZn dZdZdZdZedkr edSdS)Nntcvd}tj|}|dkrdS|t|z}tj|ddd\}}t |dddz }|dkr|dz }t |d d d z }|dkrd }|dkr||zSdS) zReturn 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. zMSC v.N  g$@r)sysversionfindlensplitint)prefixisrest majorVersion minorVersions "/usr/lib/python3.11/ctypes/util.py_get_build_versionr s K  V $ $ 771 F O+abb/''Q//41SbS6{{Q 2   A L1QqS6{{T) 1  L 1  ,. .tct}|dS|dkrd}n|dkr d|dzz}ndSddl}d|jjvr|d z }|d zS) z%Return the name of the VC runtime dllNrmsvcrtr zmsvcr%d rz_d.pydd.dll)rimportlib.machinery machineryEXTENSION_SUFFIXES)rclibname importlibs r find_msvcrtr&"sy$&& ?4 a<<HH ]] GbL1HH4 #""" y*= = = OHrc|dvrtStjdtjD]}tj||}tj|r|cS| drm|dz}tj|r|cSdS)N)cmPATHr ) r&osenvironrpathseppathjoinisfilelowerendswith)name directoryfnames r find_libraryr67s :  == F+11"*==  IGLLD11Ew~~e$$  {{}}%%f-- FNEw~~e$$   trposixdarwin) dyld_findcrd|zd|z|d|g}|D]#} t|cS#t$rY wxYwdS)Nz lib%s.dylibz%s.dylibz .framework/) _dyld_find ValueError)r3possibles rr6r6Hsv!D(%)-tt46  D !$'''''    ts ' 44aix)r6cd}t|d5}|d|kcdddS#1swxYwYdS)z,Return True if the given file is an ELF filesELFbrN)openread)filename elf_headerthefiles r_is_elfrG`s (D ! ! 1W<<??j0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1s 9==ctjdtj|z}t jd}|st jd}|sdSt j} |dd|jd|zg}ttj }d|d<d|d < tj |tj tj| }n7#t$r*Y |dS#t"$rYdSwxYwwxYw|5|j}dddn #1swxYwY |n:#t"$rYn.wxYw# |w#t"$rYwwxYwxYwtj||}|sdS|D]'} t+| stj| cSdS) N[^\(\)\s]*lib%s\.[^\(\)\s]*gccccz-Wl,-t-oz-lCLC_ALLLANGstdoutstderrenv)r+fsencodereescapeshutilwhichtempfileNamedTemporaryFiler3dictr, subprocessPopenPIPESTDOUTOSErrorcloseFileNotFoundErrorrQrCfindallrGfsdecode) r3expr c_compilertempargsrSproctraceresfiles r _findLib_gccrmfsf {9BIdOOKLL\%((  ,d++J 4*,, $ 4$;GDrz""CCMCK !'/9/9/@,/111     $      + + ((** + + + + + + + + + + + + + + +  $      $    ju%% 4 % %D4== ;t$$ $ $ $  % %s,2E,C E DEC.. C<;C<?DED+ E+D//E2D/3E7E EEFE32F3 F=F?FFsunos5cr|sdS tjdd|ftjtj}n#t$rYdSwxYw|5|j}dddn #1swxYwYtjd|}|sdStj | dS)Nz/usr/ccs/bin/dumpz-LpvrQrRs\[.*\]\sSONAME\s+([^\s]+)r) r\r]r^DEVNULLr`rQrCrUsearchr+rdgroup)fridatarks r _get_sonamervs t !') \S*/(libz\.\S+))/sbin/ldconfigz-rrpr)keyr)rUrVr+rTr\r]r^rqrQrCr`rcrvrmsortrrd)r3enamererirurks rr6r6sOIdOOEE8=uuuED;t$$D .!'(@/9/9/ACCC ..;++--D...............     *T4((C 7"<#5#5666 HHH & & &;s2w'' 's#+B BB  B  B! B!ctjdsdSttj}d|d<|rd}nd}d} t j|t jt j|}n#t$rYdSwxYw|5|j D]W}| }| dr,tj |d}X dddn #1swxYwY|sdS|d D]H}tj|d |z}tj|r|cSIdS) N /usr/bin/crlerMrN)r-64)rrPsDefault Library Path (ELF):rA:zlib%s.so)r+r.existsr[r,r\r]r^rqr`rQstrip startswithrdrr/) r3is64rSrhpathsrilinedirlibfiles r _findLib_crlers7>>/22 trz""CCM */)E !'/9/9/A,/111   tt  = = K==D::<>7>>'**#"NNN#4s% ,A77 BB A C77C;>C;FcZtt||pt|SN)rvrrm)r3rs rr6r6 s'}T488NL,6,>-7-?-7_58#*F*F HHH9LM)E18==??;;C9!{399Q<<8899999999 9 999999999999999999    s=/>>Qjr{3'7'788--D#4==! ;t,,,,, -    MsBD)) D65D6ct|p7tt|ptt|Sr)rrvrmr)r3s rr6r6RsE'--U|D1122U6A+dBSBS6T6T Urcddlm}tjdkrRt |jt |dt tdtjdkrt tdt tdt tdtj d krt | d t | d t | d t | d dStj drddlm }tj dkrt d|dtjt d| dt tdt | dnKt d|dtjt d| dt dtdt d| tdt dtdt d| tddSt | dt | dt tddSdS)Nr)cdllrrr7r)r(bz2r8z libm.dylibzlibcrypto.dylibzlibSystem.dylibzSystem.framework/Systemr>)CDLLlz"Using CDLL(name, os.RTLD_MEMBER): z libc.a(shr.o)zUsing cdll.LoadLibrary(): rpmz librpm.sozlibc.a(shr_64.o)z crypt :: cryptz crypto :: cryptozlibm.soz libcrypt.so)ctypesrr+r3printrloadr6r platform LoadLibraryrrr RTLD_MEMBER)rrs rtestrZs6 w$ dk dii!!""" l8$$%%% w' l3    l3    l5!!""" <8 # # $""<00 1 1 1 $""#455 6 6 6 $""#455 6 6 6 $""#<== > > > > > \ $ $U + + ) # # # # # #{U""b44QSQ_;`;`bbcccV43C3CO3T3TVVWWWl5))***d&&{334444e44@RTVTb;c;ceefffY43C3CDV3W3WYYZZZ 6|G4466 7 7 7 Ht// W0E0EFFHH I I I 8 X 6 688 9 9 9 J 0 0h1G1G H HJJ K K K K K $""9-- . . . $""=11 2 2 2 ,w'' ( ( ( ( (?r__main__)F)r+rWr\r r3rr&r6rctypes.macholib.dyldr9r;r ctypes._aixrUrYrGrmrvrrrrr__name__rrrs7  7d??2*    WCLH44<<<<<<     \U##BU)((((((W111 /%/%/%d |x - - - -" - - -, |BCCTU ) ) ) ( ( ( (*  ! !" " " H P P P P P ' ' ' R   6 U U U&)&)&)P zDFFFFFr