\bg>Q@dZddlZddlZddlZddlmZddlZeje5ddl Z dddn #1swxYwYddl m Z ddl m Z ddlmZmZddlmZmZmZmZmZddlmZmZd Zd Zd d d ddZdZdZddZd dd ddZ dZ!GddeZ"dS)zdistutils._msvccompiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for Microsoft Visual Studio 2015. This module requires VS 2015 or later. N)count)log) CCompilergen_lib_options) CompileErrorDistutilsExecErrorDistutilsPlatformErrorLibError LinkError)get_host_platform get_platformcj tjtjdtjtjz}n%#t $rt jdYdSwxYwd}d}|5tD]} tj ||\}}}n#t $rYn{wxYw|rt|tj krdtj |rE tt|}n#t t"f$rYwxYw|dkr ||kr||}}dddn #1swxYwY||fS)Nz'Software\Microsoft\VisualStudio\SxS\VC7)accesszVisual C++ is not registeredNNr)winreg OpenKeyExHKEY_LOCAL_MACHINEKEY_READKEY_WOW64_32KEYOSErrorrdebugr EnumValueREG_SZospathisdirintfloat ValueError TypeError)key best_versionbest_dirivvc_dirvtversions t/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/_distutils/_msvccompiler.py _find_vc2015r,&s  % 6?V%;;     0111zzLH = = = =A  & 0a 8 8 622     =R6=((RW]]6-B-B(!%((mmGG"I.Hb==W|%;%;-4f(L = = = = = = = = = = = = = = =  !!si8;AA&D&8BD& B D&B  4D&C21D&2DD&DD&&D*-D*c tjdptjd}|sdStdkrdnd}d|df}|D]}t jt jtt5t j tj |d d d d d d|ddddg  dd}tj |ddd}tj |rd|fcdddcS dddn #1swxYwYdS)aJReturns "15, path" based on the result of invoking vswhere.exe If no install is found, returns "None, None" The version is returned to avoid unnecessarily changing the function result. It may be ignored when the path is not None. If vswhere.exe is not available, by definition, VS 2017 is not installed. zProgramFiles(x86) ProgramFilesr win-arm64arm64zx86.x64z*Microsoft.VisualStudio.Component.VC.Tools.z)Microsoft.VisualStudio.Workload.WDExpresszMicrosoft Visual Studio Installerz vswhere.exez-latestz -prereleasez -requiresz -propertyinstallationPathz -products*mbcsstrict)encodingerrorsVC AuxiliaryBuildN)renvirongetr contextlibsuppress subprocessCalledProcessErrorrUnicodeDecodeError check_outputrjoindecodestripr)rootvariantsuitable_components componentrs r+ _find_vc2017rKCs :>>- . . P"*..2P2PD z%;66ggIG>W>>3 )    )74F    'GLL7m!& )  99 $7<<dKAADw}}T"" 4x/          , -               2 :sB)EE E x86x64armr0)rL x86_amd64x86_arm x86_arm64c.t\}}|st\}}|stjddStj|d}tj|stjd|dS|dfS)Nz$No suitable Visual C++ version foundrz vcvarsall.batz%s cannot be found)rKr,rrrrrDisfile) plat_spec_r%r$ vcvarsalls r+_find_vcvarsallrW}s..KAx 0!- h  8999z X77I 7>>) $ $ & 222z d?ctjdr(dtjDSt |\}}|st d t jd|d|dt j dd }nG#t j $r5}tj |j t d |jd}~wwxYwd d |DD}|S)NDISTUTILS_USE_SDKc>i|]\}}||Slower).0r#values r+ z_get_vc_env..s&HHHzsE UHHHrXzMicrosoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/z cmd /u /c "z" z && set)stderrzutf-16lereplace)r7zError executing cHi|]\}}}|| || Sr\r])r_r#rUr`s r+raz_get_vc_env..sH    CE    U   rXc3@K|]}|dVdS)=N) partition)r_lines r+ z_get_vc_env..s.OOddnnS11OOOOOOrX)rgetenvr<itemsrWr r@rCSTDOUTrErArerroroutputcmd splitlines)rTrVrUoutexcenvs r+ _get_vc_envrtsJ y$%%IHHRZ5E5E5G5GHHHH"9--LIq  $ I   C% 9) 9 9y 9 9 9$    &I& . .   (CCC #*$%A%A%ABBBC  OOcnn>N>NOOO   C Js!>"   III  JrXamd64)win32z win-amd64z win-arm32r/cd|dkrd}t|}t|}||kr|n|d|S)aw Given a host platform and platform, determine the spec for vcvarsall. Uses the native MSVC host if the host platform would need expensive emulation for x86. >>> _get_vcvars_spec('win-arm64', 'win32') 'arm64_x86' >>> _get_vcvars_spec('win-arm64', 'win-amd64') 'arm64_amd64' Otherwise, always cross-compile from x86 to work with the lighter-weight MSVC installs that do not include native 64-bit tools. >>> _get_vcvars_spec('win32', 'win32') 'x86' >>> _get_vcvars_spec('win-arm32', 'win-arm32') 'x86_arm' >>> _get_vcvars_spec('win-amd64', 'win-arm64') 'x86_arm64' r/rrU) _vcvars_names) host_platformplatformvc_hpvc_plats r+_get_vcvars_specrsJ, ## - (EH%GW$$55U*>*>W*>*>>rXcJeZdZdZdZiZdgZgdZdgZdgZ eezeze zZ dZ dZ d Z d Zd xZZd Zdfd ZedZedZddZefdZ ddZ d dZ d!dZfdZejfdZ dZ!dZ"dZ#d"dZ$xZ%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.exeFcjt|||d|_d|_dS)NF)super__init__ plat_name initialized)selfverbosedry_runforce __class__s r+rzMSVCCompiler.__init__s4 '5111 rXc||dd|_||dd|_dS)z3 Set class-level include/lib dirs. includelibN) _parse_pathr= include_dirs library_dirs)clsvc_envs r+ _configurezMSVCCompiler._configuresN ??6::i+D+DEE??6::eR+@+@AArXcTd|tjDS)NcPg|]#}||tj$Sr\)rstriprsep)r_dirs r+ z,MSVCCompiler._parse_path..s+KKKssK 26""KKKrX)rvrrw)vals r+rzMSVCCompiler._parse_paths$KKcii .C.CKKKKrXNc|jr Jd|t}|tvr$tdt tt t |}t|}|std||| dd|_ |j tj }td||_td||_td||_td ||_td ||_td ||_d|_gd |_gd |_gd}gd}g|d|_g|d|_g|ddd|_g|ddd|_g||_g||_t<jdf|jt<jdf|jt<jdf|jt<j df|jt<j df|jt<j df|jt<j!df|jt<j!df|jt<j!df|ji |_"d|_dS)Nzdon't init multiple timesz--plat-name must be one of z7Unable to find a compatible Visual Studio installation.rrzcl.exezlink.exezlib.exezrc.exezmc.exezmt.exe)/nologoz/O2/W3z/GLz/DNDEBUGz/MD)rz/Odz/MDdz/Zirz/D_DEBUG)r/INCREMENTAL:NO/LTCG)rrrz /DEBUG:FULLz/MANIFEST:EMBED,ID=1z/DLLz/MANIFEST:EMBED,ID=2z/MANIFESTUAC:NOFT)#rrrr tuplerr rtrr=_pathsrvrrwr}cclinkerrrcmcmtpreprocess_optionscompile_optionscompile_options_debug ldflags_exeldflags_exe_debugldflags_sharedldflags_shared_debugldflags_staticldflags_static_debugr EXECUTABLE SHARED_OBJECTSHARED_LIBRARY_ldflags)rrrTrrzldflags ldflags_debugs r+ initializezMSVCCompiler.initializes#@@%@@@#  $I M ) )(DeM.B.BDD %%6%8%8)DD Y'' (I  jj,,  !!"*--He,, E22 Y..He,,He,,He,,"& SRR& & & ":99NNN =W=&<=!I=!I2H!I    #     % % %  #%   % ! )j$4m$4! !4 ($*:  !5 )4+;  !4 ($*@  $d +T-@  $e ,d.A  $d +T-F  %t ,d.A  %u -t/B  %t ,d.G    rXcfitjfdjjzDS)Nc i|] }|j Sr\) res_extension)r_extrs r+raz/MSVCCompiler.out_extensions..is.T'rX)rout_extensions_rc_extensions_mc_extensions)rrs`r+rzMSVCCompiler.out_extensionsesS gg$ .1DD  rXc |js||||||||} | \}} }} } |pg} | d|r| |jn| |jd}| D]i} | |\}}n#t$rYwxYw|rtj |}||j vrd|z}n||j vr d|z}d}n{||j vrN|}d|z} ||jg| z||gzn!#t $r}t#|d}~wwxYw||jvrtj |}tj |} ||jd|d||gtj tj |\}}tj ||d z}||jd|z|gn!#t $r}t#|d}~wwxYwt#d |d ||jg| z| z}|r|d ||d |zf|| ||J#t $r}t#|d}~wwxYw| S)Nz/cFz/Tcz/TpTz/foz-hz-rrzDon't know how to compile z to z/EHscz/Fo)rr_setup_compileappendextendrrKeyErrorrrrx _c_extensions_cpp_extensionsrspawnrr rrdirnamersplitextbasenamerDr)rsources output_dirmacrosrr extra_preargsextra_postargsdepends compile_infoobjectspp_optsbuild compile_opts add_cpp_optsobjsrcr input_opt output_optmsgh_dirrc_dirbaserUrc_fileargss r+compilezMSVCCompiler.compileosy  OO   **  gw  ;G7%$* D!!!  6    : ; ; ; ;    4 5 5 5 ? (? (C  :SS     +gooc**d(((!CK ,,,!CK # +++ "S[ ,JJy72j)5LLMMMM),,,&s+++,+++,,-- ,JJudFCHIII g..rw/?/?/D/DEEGD! gll64%<@@GJJg>????),,,&s+++,##N#N#N#N#NOOOG9|+g5D % G$$$ KKECK0 1 1 1 KK ' ' ' ( 4    % ( ( ("3''' (s[ B"" B/.B/#D** E4EEB"H88 IIIK K:&K55K:c|js||||\}}|||}|||r||d|zgz}|r t jd|jd|| |jg|zdS#t$r}t|d}~wwxYwt jd|dS)N)r/OUT:Executing "%s" %s skipping %s (up-to-date)) rr_fix_object_argslibrary_filename _need_linkrrrrDrr r ) rroutput_libnamerr target_langoutput_filenamelib_argsrs r+create_static_libzMSVCCompiler.create_static_libs  OO   "33GZHH//:/VV ??7O 4 4 C'O";!<.sNNN:+NNNrXrrz/IMPLIB:rrr)rrr _fix_lib_argswarnstrrrrrDrrrrrrrrrxmkpathrrrrr r )r target_descrrr librariesrruntime_library_dirsexport_symbolsrrr build_tempr fixed_argslib_optsr export_optsld_argsdll_namedll_ext implib_filers r+linkzMSVCCompiler.links   OO   "33GZHH'' W=XX 44J)&(g&6&6G$$_55''#7!gll:t7L7LX7V7VWW zK7888 ,+  /~...)I)IJJJ KK # # # % -t{CHHWFallback spawn triggered. Please update distutils monkeypatch.z os.environ) typer"rwarningsrmockpatchrrrr`)rrorsbagrrrs r+rzMSVCCompiler._fallback_spawn,s""d5"b!!## III F    2#c((BBCBBBB   VWWW Z__\3 / / + + c**CI + + + + + + + + + + + + + + + + + +s&$ A AA 'B55B9<B9c d|zS)Nz /LIBPATH:r\rrs r+library_dir_optionzMSVCCompiler.library_dir_optionCs S  rXc td)Nz:don't know how to set runtime library search path for MSVC)r rs r+runtime_library_dir_optionz'MSVCCompiler.runtime_library_dir_optionFs$ H   rXc,||SN)r)rrs r+library_optionzMSVCCompiler.library_optionKs$$S)))rXc|r|dz|g}n|g}|D]_}|D]Z}tj|||}tj|r|ccS[`dS)N_d)rrrDrrS)rdirsrr try_namesrnamelibfiles r+find_library_filezMSVCCompiler.find_library_fileNs  tS)III  C! # #',,sD,A,A$,G,GHH7>>'**#"NNNNN# # 4rX)FFFr)NNNFNNN)NFN) NNNNNFNNNN)F)&__name__ __module__ __qualname____doc__ compiler_type executablesrrrrsrc_extensionsr obj_extensionstatic_lib_extensionshared_lib_extensionstatic_lib_formatshared_lib_format exe_extensionr classmethodr staticmethodrrpropertyrrrr rr>contextmanagerrrrrr& __classcell__)rs@r+rrs=33MKFM---OWNWN#_4~EVNMM!!,22)M!!!!!! BB[BLL\LM M M M b    X \\\\~RVCCCC2!CCCCCCCCJ +++++,!!!   ***rXrr)#r*r>rr@ unittest.mockrrr? ImportErrorr itertoolsr_logr ccompilerrrr7rr r r r utilr rr,rKPLAT_SPEC_TO_RUNTIMErWrtr}rrrr\rXr+r@s/ Z%%MMM1111111121111111""":///f  &<&  ???:wwwww9wwwwws :>>