efudZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z ddl m Z mZddlmZddlmZddlZejdeejZejZejZejZejejej ej!fZ"ej#d ko ej$d kZ%e%rd Z&d Z'd Z(ndZ&dZ'dZ(dddZ)GddZ*GddZ+dZ,dZ-dZ.dZ/ddZ0e,Z1Gdde Z2dS) a distutils.msvc9compiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for the Microsoft Visual Studio 2008. The module is compatible with VS 2005 and VS 2008. You can find legacy support for older versions of VS in distutils.msvccompiler. N)DistutilsExecErrorDistutilsPlatformError CompileErrorLibError LinkError) CCompilergen_lib_options)log) get_platformzmsvc9compiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case.win32lz1Software\Wow6432Node\Microsoft\VisualStudio\%0.1fz5Software\Wow6432Node\Microsoft\Microsoft SDKs\Windowsz,Software\Wow6432Node\Microsoft\.NETFrameworkz%Software\Microsoft\VisualStudio\%0.1fz)Software\Microsoft\Microsoft SDKs\Windowsz Software\Microsoft\.NETFrameworkx86amd64r z win-amd64ceZdZdZdZeeZdZeeZdZeeZdZe eZdS)Regz-Helper class to read values from the registryctD](}|||}|r||vr ||cS)t|N)HKEYS read_valuesKeyError)clspathkeybaseds /builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/_distutils/msvc9compiler.py get_valuez Reg.get_valueNsN  Dd++A SAXXv smmc t||}n#t$rYdSwxYwg}d} t||}n#t$rYnwxYw|||dz }=|S)zReturn list of registry keys.NrTr) RegOpenKeyExRegError RegEnumKeyappend)rrrhandleLiks r read_keysz Reg.read_keysWs !$,,FF   44     vq))     HHQKKK FA  s !!; AAc, t||}n#t$rYdSwxYwi}d} t||\}}}n#t$rYnIwxYw|}|||||<|dz }k|S)z`Return dict of registry keys and values. All names are converted to lowercase. NrTr)r!r" RegEnumValuelower convert_mbcs) rrrr%rr'namevaluetypes rrzReg.read_valuesjs  !$,,FF   44     $0$;$;!eTT    ::<> NN-t{M J J J NN?K9O P P P P PAA B B$T1--AAH A&&MM$3(?(?@@56y\ 122 B Bs2BB)8D  DDcp|jD]\}}|||}|Sr)rBitemsreplace)rFr6r(vs rsubzMacroExpander.subs;K%%''  DAq !QAArN)r8r9r:rHrKrEr`r>rrr@r@sV""" @@@BBB>rr@cvd}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 r g$@r)sysrGfindlensplitint)prefixr'r6rest majorVersion minorVersions rget_build_versionrrs F   ABwwq CKKAk!""o##C++GAtq"v;;?Lr q1v;;%Lq ql** 4rcg}|D]:}tj|}||vr||;|S)znReturn a list of normalized paths with duplicates removed. The current order of paths is maintained. )osrnormpathr$)paths reduced_pathsrZnps rnormalize_and_reduce_pathsrysS M %% W  a  ] " "   $ $ $ rc|tj}g}|D]}||vr||tj|}|S)z3Remove duplicate values of an environment variable.)rlrtpathsepr$join)variableoldListnewListr' newVariables rremoveDuplicatesrs`nnRZ((GG  G   NN1   *//'**K rct|z} td|zd}n&#t$rt jdd}YnwxYw|rt j|sd|z}t j |d}|rt j|rt j |t j t j d}t j |}t j|st jd|zdSnt jd|z|st jd dSt j |d }t j|r|St jd dS) zFind the vcvarsall.bat file At first it tries to find the productdir of VS 2008 in the registry. If that fails it falls back to the VS90COMNTOOLS env var. z %s\Setup\VCrNz%Unable to find productdir in registryNzVS%0.f0COMNTOOLSVCz%s is not a valid directoryz Env var %s is not set or invalidzNo productdir foundz vcvarsall.batUnable to find vcvarsall.bat)rCrrrr debugrtrisdirenvirongetr|pardirabspathisfile)rGrDrNtoolskeytoolsdir vcvarsalls rfind_vcvarsallrs w F]]>F#:LII  9:::   ERW]]:66 E%/:>>(D11  E h// Eh 29dKKJ44J7==,,  7*DEEEt  I88C D D D  '(((t Z99I w~~i  I,--- 4s+ A Act|}hd}i}|tdtjd||t jd||tjtj} |\}}| dkr"t| d| d}| d D]}t |}d |vr!|}| d d \} } | } | |vr;| t"jr | dd } t'| || < |j|jn7#|j|jwxYwt/|t/|kr;t1t3t5||S) z?Launch vcvarsall.bat and read the settings from its environment>librincludelibpathNrz'Calling 'vcvarsall.bat %s' (version=%s)z "{}" {} & set)stdoutstderrrr3 =rrb)rrr r subprocessPopenrYPIPE communicatewaitr2rlrr-stripr,endswithrtr{rrcloserrk ValueErrorstrlistkeys) rGarchr interestingresultpopenrrlinerr/s rquery_vcvarsallrs'w''I777K F$%CDDDI7wGGG  y$//   E **,, ::<<1  (v)>)>?? ?v&&LL&& 6 6D##D))D$::<>"*--'!#2#JE.u55s  6       6{{c+&&&&T&++--0011222 Ms =DG4HceZdZdZdZiZdgZgdZdgZdgZ eezeze zZ dZ dZ d Z d Zd xZZd Zdfd ZddZd dZ d!dZ d"dZ d#dZdZdZdZdZdZdZd$dZdZxZ S)% MSVCCompilerztConcrete class that implements an interface to Microsoft Visual C++, as defined by the CCompiler abstract class.msvcz.c)z.ccz.cppz.cxx.rcz.mcz.resz.objz.libz.dllz%s%sz.exerct|||t|_d|_g|_d|_d|_d|_dS)NzSoftware\Microsoft\VisualStudioF) superrHVERSION_MSVCCompiler__version_MSVCCompiler__root_MSVCCompiler__paths plat_name_MSVCCompiler__arch initialized)rFverbosedry_runforce __class__s rrHzMSVCCompiler.__init__^sP '5111 8    rNc>|jr Jd|jdkrtd|jz|t}d}||vr"td|dt jvrHdt jvr:|dr%d|_d |_ d |_ d |_ d |_ nd|td fvrt|}n*ttdzt|z}tt|}|dt j|_|dt jd<|dt jd<t'|jdkrtd|jz|d|_|d |_ |d |_ |d |_ |d |_ t jddD]}|j|n#t,$rYnwxYwt/|j|_d|jt jd<d|_|jdkrgd|_gd|_ngd|_gd|_gd|_|jdkr gd|_dg|_d|_dS)Nzdon't init multiple timesrRz(VC %0.1f is not supported by this modulerz--plat-name must be one of {}DISTUTILS_USE_SDKMSSdkzcl.exezlink.exezlib.exezrc.exezmc.exer _rrrrzxPython was built with %s, and extensions need to be built with the same version of the compiler, but it isn't installed.;r)/nologo/O2/MD/W3/DNDEBUG)r/Od/MDdr/Z7/D_DEBUG)rrrr/GS-r)rrrrrrr)/DLLrz/INCREMENTAL:NO)rrz/INCREMENTAL:noz/DEBUGrT) rrrr rYrtrfind_execclinkerrrcmcPLAT_TO_VCVARSrrrlr{rrk_MSVCCompiler__productr$rryr|preprocess_optionsrcompile_optionscompile_options_debugldflags_sharedldflags_shared_debugldflags_static)rFrok_plats plat_specvc_envrZs r initializezMSVCCompiler.initializeis=#@@%@@@# >C  (:T^K   $I' H $ $(/66x@@  2: - -2:%% h''& DG$DK DHDGDGG \^^W555*95 #<>>2S8>);TT%Wi88F!&>// ;;DL &u BJu $*9$5BJy !4<  A%%,GIMX mmH--DG-- 33DK}}Y//DHmmH--DGmmH--DG  Z'--c22 ' ' ##A&&&& '    D 1$,??  XXdl33 6"& ;%  #O#O#OD ***D & &$X#W#WD ***D &EDD >Q  (X(X(XD %(ks'AI** I76I7c|d}g}|D]s}tj|\}}tj|d}|tj|d}||jvrt d|z|rtj|}||jvr<| tj |||j z||j vr=| tj |||j z8| tj |||j zu|S)NrrzDon't know how to compile %s)rtrsplitext splitdriveisabssrc_extensionsrbasename_rc_extensionsr$r| res_extension_mc_extensions obj_extension)rFsource_filenames strip_dir output_dir obj_namessrc_namerexts robject_filenameszMSVCCompiler.object_filenamessf  J ( V VH'**844KT37%%d++A.D d++--.D$---##AH#LMMM .w''--d)))  j$AS:S!T!TUUUU+++  j$AS:S!T!TUUUU  j$AS:S!T!TUUUUrc |js||||||||} | \}} }} } |pg} | d|r| |jn| |j| D]I} | |\}}n#t$rYwxYw|rtj |}||j vrd|z}n||j vrd|z}n||j vrQ|}d|z} ||jg| z|gz|gzn!#t $r}t#|d}~wwxYw||jvrtj |}tj |} ||jgd|d|gz|gztj tj |\}}tj ||dz}||jgd|zgz|gzn!#t $r}t#|d}~wwxYwt#d||d |z} ||jg| z| z||gz|z*#t $r}t#|d}~wwxYw| S) Nz/cz/Tcz/Tpz/foz-hz-rrz"Don't know how to compile {} to {}z/Fo)rr_setup_compiler$extendrrrrtrr _c_extensions_cpp_extensionsrspawnrrrrdirnamerrrr|rYr)rFsourcesrrB include_dirsr extra_preargsextra_postargsdepends compile_infoobjectspp_optsbuild compile_optsobjsrcr input_opt output_optmsgh_dirrc_dirrrrc_files rcompilezMSVCCompiler.compilesw  OO   **  gw  ;G7%$* D!!!  6    : ; ; ; ;    4 5 5 5A (A (C  :SS     +gooc**d(((!CK ,,,!CK +++ "S[ ,JJy72j\AYKOPPPP),,,&s+++,+++,,-- ,JJyD%v+FF#NOOO g..rw/?/?/D/DEEGD! gll64%<@@GJJyECK=8G9DEEEE),,,&s+++,#8??SIIJ ( WI"#!*-.% %& ( ( ("3''' (s[ B  B-,B-&D)) E3EEB.I I! II!)J:: KKKc|js||||\}}|||}|||rN|d|zgz}|r ||jg|zdS#t$r}t|d}~wwxYwtj d|dS)N)r/OUT:skipping %s (up-to-date)) rr_fix_object_argslibrary_filename _need_linkrrrrr r) rFroutput_libnamerr target_langoutput_filenamelib_argsrs rcreate_static_libzMSVCCompiler.create_static_libIs  OO    $ 5 5gz J J*//:/VV ??7O 4 4 C'O";!<|js||||\}}||||}|\}}}|r%|dt |zt ||||}| tj ||}| ||rD|tj kr"| r|j dd}n!|jdd}n| r|j }n|j}g}|pgD]}|d|z||z|z|zd|zgz}tj|d} |tjtj|\}}tj | ||}|d|z||| || r| |dd<| r|| |tj| ||jg|zn!#t2$r}t5|d}~wwxYw|||}|Y|\}}d||} |dd d ||gdS#t2$r}t5|d}~wwxYwdSt;jd |dS) Nz5I don't know what to do with 'runtime_library_dirs': rz/EXPORT:r rz/IMPLIB:z-outputresource:{};{}zmt.exez-nologoz -manifestr )rrr  _fix_lib_argswarnrr rtrr|rr EXECUTABLErrr$rrrr manifest_setup_ldargsrmkpathrrrrmanifest_get_embed_inforYr r)rF target_descrrr libraries library_dirsruntime_library_dirsexport_symbolsrrr build_tempr fixed_argslib_optsldflags export_optssymld_argsdll_namedll_ext implib_filermfinfo mffilenamemfidout_args rlinkzMSVCCompiler.link\sz   OO    $ 5 5gz J J*'' W=XX 44J)&(g&6&6G$$_55''#7!gll:t7L7LX7V7VWW zK7888  & & G L L L ,+  /~... KK88 9 9 9 % DK=723333% % % %nn$ %11+wGGF!#) D188$OO)JJ)[*gVWWWWW))))#C..() "! I0/ B B B B Bs0I44 J>J  J K%% L/K>>Lctj|tj|dz}|d|zdS)Nz .manifest/MANIFESTFILE:)rtrr|rr$)rFrr r& temp_manifests rrz"MSVCCompiler.manifest_setup_ldargssS ((99KG   '-788888rc|D]5}|dr|ddd}n6dS|tjkrd}nd}||}|dS||fS)Nr0:rrg) startswithrlr r_remove_visual_c_ref)rFrr&argr1r,s rrz$MSVCCompiler.manifest_get_embed_infos   C~~.//  # #q 1 1! 4   4 ). . .DDD 55mDDM  4d""rcz t|} |}|n#|wxYwtjdtj}tj|d|}d}tj|d|}tjdtj}tj||dSt|d} ||||S#|wxYw#t$rYdSwxYw)NzU|)rz*\s*zI|)w) openreadrrerDOTALLr`searchwriteOSError)rF manifest_file manifest_f manifest_bufpatterns rr5z!MSVCCompiler._remove_visual_c_refsP' m,,J #)00   """"   """"jD G 6'2|<D,D))D,, D:9D:c d|zS)Nz /LIBPATH:r>rFdirs rlibrary_dir_optionzMSVCCompiler.library_dir_option s S  rc td)Nz>'**#"NNNNN# # 4rc|jD]b}tjtj||}tj|r|cSctjddD]b}tjtj||}tj|r|cSc|S)aReturn path to an MSVC executable program. Tries to find the program in several places: first, one of the MSVC program search paths from the registry; next, the directories in the PATH environment variable. If any of those work, return an absolute path that is known to exist. If none of them work, just return the original program name, 'exe'. Pathr)rrtrr|rrrrl)rFexerZfns rrzMSVCCompiler.find_exe)s  Abgooa00#66Bw~~b!!   F#))#..  Abgooa00#66Bw~~b!!    r)rrrr)rr)NNNrNNN)NrN) NNNNNrNNNN)r)!r8r9r:r; compiler_type executablesrrrrrrrstatic_lib_extensionshared_lib_extensionstatic_lib_formatshared_lib_format exe_extensionrHrrrrr.rrr5rGrIrKrRr __classcell__)rs@rrrAs33MKFM---OWNWN#_4~EVNMM!!,22)M ! ! ! ! ! !e e e e R8\\\\~NRCCCC0!\C\C\C\C| 9 9 9###0(((\!!!   ***$rr)r)3r;rtrrir;warningserrorsrrrrr ccompilerr r _logr utilr winregrDeprecationWarning OpenKeyExr!EnumKeyr# EnumValuer+errorr" HKEY_USERSHKEY_CURRENT_USERHKEY_LOCAL_MACHINEHKEY_CLASSES_ROOTrplatformmaxsize NATIVE_WIN64rCrXrWrrr@rrryrrrrrr>rrrqsz  21111111  4  ^  <      |w&>3;+>  3CGJK>HH6G>K2H  ?.?.?.?.?.?.?.?.D++++++++\4      F''''V    |||||9|||||r