zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
U
G=®dNã    @sädZddlZddlZddlZe e¡ddlZW5QRXddlmZm    Z    m
Z
m Z m Z ddl mZmZddlmZddlmZddlmZdd    „Zd
d „Zd d dddœZdd„Zdd„Zddd„Zd ddddœZGdd„deƒZdS)adistutils._msvccompiler
 
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for Microsoft Visual Studio 2015.
 
The module is compatible with VS 2015 and later. You can find legacy support
for older versions in distutils.msvc9compiler and distutils.msvccompiler.
éN)ÚDistutilsExecErrorÚDistutilsPlatformErrorÚ CompileErrorÚLibErrorÚ    LinkError)Ú    CCompilerÚgen_lib_options)Úlog)Ú get_platform)Úcountc CsztjtjdtjtjBd}Wn tk
r>t d¡YdSXd}d}|¦tƒD]˜}zt     ||¡\}}}Wntk
rˆYqîYnX|rT|tj
krTt j   |¡rTztt|ƒƒ}Wnttfk
rÐYqTYnX|dkrT||krT||}}qTW5QRX||fS)Nz'Software\Microsoft\VisualStudio\SxS\VC7)ÚaccesszVisual C++ is not registered©NNré)ÚwinregÚ    OpenKeyExÚHKEY_LOCAL_MACHINEÚKEY_READÚKEY_WOW64_32KEYÚOSErrorr    Údebugr Ú    EnumValueÚREG_SZÚosÚpathÚisdirÚintÚfloatÚ
ValueErrorÚ    TypeError)ÚkeyÚ best_versionÚbest_dirÚiÚvZvc_dirZvtÚversion©r%úZD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/_distutils/_msvccompiler.pyÚ _find_vc2015s2
ý
 
 
 
r'c
Cs¢tj d¡ptj d¡}|s dSz8tjtj |ddd¡ddd    d
d d d dg    ddd ¡}Wntjt    t
fk
rvYdSXtj |ddd¡}tj  |¡ržd|fSdS)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)Z ProgramFilesr zMicrosoft Visual StudioZ    Installerz vswhere.exez-latestz -prereleasez    -requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z    -propertyZinstallationPathz    -productsÚ*ÚmbcsÚstrict)ÚencodingÚerrorsZVCZ    AuxiliaryZBuildé) rÚenvironÚgetÚ
subprocessÚ check_outputrÚjoinÚstripÚCalledProcessErrorrÚUnicodeDecodeErrorr)Úrootrr%r%r&Ú _find_vc2017:s0
úù r7Úx86Úx64ÚarmZarm64)r8Ú    x86_amd64Úx86_armÚ    x86_arm64cCs\tƒ\}}|stƒ\}}|s*t d¡dStj |d¡}tj |¡sTt d|¡dS|dfS)Nz$No suitable Visual C++ version foundr z vcvarsall.batz%s cannot be found)r7r'r    rrrr2Úisfile)Ú    plat_specÚ_r!r Ú    vcvarsallr%r%r&Ú_find_vcvarsallas
 
 
  rBc
Cs¾t d¡rdd„tj ¡DƒSt|ƒ\}}|s6tdƒ‚z&tjd ||¡tj    dj
ddd    }Wn@tj k
rœ}z t   |j¡td
 |j¡ƒ‚W5d}~XYnXd d„d d „| ¡DƒDƒ}|S)NZDISTUTILS_USE_SDKcSsi|]\}}| ¡|“qSr%©Úlower)Ú.0rÚvaluer%r%r&Ú
<dictcomp>usÿz_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)Ústderrzutf-16leÚreplace)r,zError executing {}cSs$i|]\}}}|r|r| ¡|“qSr%rC)rErr@rFr%r%r&rGˆs
ýcss|]}| d¡VqdS)ú=N)Ú    partition)rEÚliner%r%r&Ú    <genexpr>‹sz_get_vc_env.<locals>.<genexpr>)rÚgetenvr.ÚitemsrBrr0r1ÚformatÚSTDOUTÚdecoder4r    ÚerrorÚoutputÚcmdÚ
splitlines)r?rAr@ÚoutÚexcÚenvr%r%r&Ú _get_vc_envss0
þ 
þý
 ÿýrZcCsN|st d¡ tj¡}|D].}tj tj |¡|¡}tj |¡r|Sq|S)atReturn 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'.
    r)rrNÚsplitÚpathseprr2Úabspathr>)ZexeÚpathsÚpÚfnr%r%r&Ú    _find_exe‘s     
rar;r<r=)Úwin32z    win-amd64z    win-arm32z    win-arm64c
sÎeZdZdZdZiZdgZdddgZdgZdgZ    eeee    Z
d    Z d
Z d Z d Zd ZZdZd(dd„Zd)dd„Zd*dd„Zd+dd„Zd,dd„Zd-dd„Z‡fdd„Zd d!„Zd"d#„Zd$d%„Zd.d&d'„Z‡ZS)/Ú MSVCCompilerzwConcrete class that implements an interface to Microsoft Visual C++,
       as defined by the CCompiler abstract class.Zmsvcz.cz.ccz.cppz.cxxú.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs t ||||¡d|_d|_dS)NF)rÚ__init__Ú    plat_nameÚ initialized)ÚselfÚverboseÚdry_runÚforcer%r%r&reËszMSVCCompiler.__init__NcCs
|jrtdƒ‚|dkrtƒ}|tkr6td ttƒ¡ƒ‚t|}t|ƒ}|sRtdƒ‚| dd¡|_    |j     
t j ¡}t d|ƒ|_t d|ƒ|_t d|ƒ|_t d    |ƒ|_t d
|ƒ|_t d |ƒ|_| d d¡ 
t j ¡D]}|rÊ| | t j¡¡qÊ| d d¡ 
t j ¡D]}|rú| | t j¡¡qúd|_ddddddg|_ddddddg|_dddg}ddddg}|d!•|_|d"•|_|d#•|_|d$•|_|•|_|•|_ t!j"df|jt!j"df|jt!j"d f|jt!j#df|jt!j#df|jt!j#d f|jt!j$df|jt!j$df|jt!j$d f|j i    |_%d |_dS)%Nzdon't init multiple timesz--plat-name must be one of {}z7Unable to find a compatible Visual Studio installation.rÚzcl.exezlink.exezlib.exezrc.exezmc.exezmt.exeÚincludeÚlibz/nologoz/Oxz/W3z/GLz/DNDEBUGz/MDz/Odz/MDdz/Ziz/D_DEBUGz/INCREMENTAL:NOz/LTCGz /DEBUG:FULLú/MANIFEST:EMBED,ID=1ú/DLLú/MANIFEST:EMBED,ID=2ú/MANIFESTUAC:NOFT)ro)ro)rprqrr)rprqrr)&rgÚAssertionErrorr
ÚPLAT_TO_VCVARSrrPÚtuplerZr/Ú_pathsr[rr\raÚccÚlinkerrnÚrcÚmcÚmtZadd_include_dirÚrstripÚsepZadd_library_dirZpreprocess_optionsÚcompile_optionsÚcompile_options_debugZ ldflags_exeZldflags_exe_debugZldflags_sharedZldflags_shared_debugZldflags_staticZldflags_static_debugrZ
EXECUTABLEZ SHARED_OBJECTZSHARED_LIBRARYÚ_ldflags)rhrfr?Zvc_envr^ÚdirÚldflagsZ ldflags_debugr%r%r&Ú
initializeÑs–ÿ      ÿÿÿÿ
 
 
 
÷ zMSVCCompiler.initializerlcsT‡fdd„ˆjDƒ‡fdd„ˆjˆjDƒ–‰ˆp4d‰‡‡‡fdd„}tt||ƒƒS)Ncsi|] }|ˆj“qSr%)Ú obj_extension©rEÚext©rhr%r&rG$sz1MSVCCompiler.object_filenames.<locals>.<dictcomp>csi|] }|ˆj“qSr%)Ú res_extensionr…r‡r%r&rG%srlcs”tj |¡\}}ˆr"tj |¡}n2tj |¡\}}| tjjtjjf¡rT|dd…}ztj ˆ|ˆ|¡WSt    k
rŽt
d  |¡ƒ‚YnXdS)NézDon't know how to compile {}) rrÚsplitextÚbasenameÚ
splitdriveÚ
startswithr}Úaltsepr2Ú LookupErrorrrP)r_Úbaser†r@)Úext_mapÚ
output_dirÚ    strip_dirr%r&Ú make_out_path*s z4MSVCCompiler.object_filenames.<locals>.make_out_path)Úsrc_extensionsÚ_rc_extensionsÚ_mc_extensionsÚlistÚmap)rhZsource_filenamesr“r’r”r%)r‘r’rhr“r&Úobject_filenamess þzMSVCCompiler.object_filenamesc     Cs†|js| ¡| ||||||¡}    |    \}}
}} } |p6g} |  d¡|rT|  |j¡n |  |j¡d}|
D]}z| |\}}Wntk
r–YqhYnX|r¨tj     
|¡}||j kr¾d|}nD||j krØd|}d}n*||j kr@|}d|}z| |jg| ||g¡Wqhtk
r:}z t|ƒ‚W5d}~XYqhXqhnÂ||jkròtj     |¡}tj     |¡}z\| |jd|d||g¡tj     tj     |¡¡\}}tj     ||d    ¡}| |jd||g¡Wqhtk
rì}z t|ƒ‚W5d}~XYqhXqhntd
 ||¡ƒ‚|jg| | }|r"| d ¡| |¡| d |¡| |¡z| |¡Wqhtk
r~}z t|ƒ‚W5d}~XYqhXqh|
S) Nz/cFz/Tcz/TpTz/foz-hz-rrdz"Don't know how to compile {} to {}z/EHscz/Fo)rgrƒZ_setup_compileÚappendÚextendrr~ÚKeyErrorrrr]Ú _c_extensionsÚ_cpp_extensionsr–Úspawnryrrr—ÚdirnamerzrŠr‹r2rPrw)rhÚsourcesr’ZmacrosÚ include_dirsrÚ extra_preargsÚextra_postargsÚdependsZ compile_infoÚobjectsZpp_optsÚbuildZ compile_optsZ add_cpp_optsÚobjÚsrcr†Z    input_optZ
output_optÚmsgZh_dirZrc_dirrr@Zrc_fileÚargsr%r%r&Úcompile@sx
ÿ
 
 
 
 
   ÿ
 
 
zMSVCCompiler.compilec    
Cs´|js| ¡| ||¡\}}|j||d}| ||¡r¤|d|g}|rJz,t d|jd |¡¡|     |jg|¡Wq°t
k
r }z t |ƒ‚W5d}~XYq°Xn t d|¡dS)N)r’ú/OUT:úExecuting "%s" %sú úskipping %s (up-to-date)) rgrƒÚ_fix_object_argsÚlibrary_filenameÚ
_need_linkr    rrnr2r rr)    rhr§Zoutput_libnamer’rÚ target_langÚoutput_filenameZlib_argsr«r%r%r&Úcreate_static_libšsÿ zMSVCCompiler.create_static_libc
Cs¸|js| ¡| ||¡\}}| |||¡}|\}}}|rL| dt|ƒ¡t||||ƒ}|dk    rptj     ||¡}| 
||¡r¨|j ||    f}dd„|p˜gDƒ}||||d|g}tj  |d¡} |dk    r tj  tj |¡¡\}}tj     | | |¡¡}| d|¡|
r|
|dd…<| r.| | ¡tj  tj |¡¡}| |¡z,t d|jd     |¡¡| |jg|¡Wn,tk
r¤}z t|ƒ‚W5d}~XYnXn t d    |¡dS)
Nz5I don't know what to do with 'runtime_library_dirs': cSsg|] }d|‘qS)z/EXPORT:r%)rEÚsymr%r%r&Ú
<listcomp>×sz%MSVCCompiler.link.<locals>.<listcomp>r®rz/IMPLIB:r¯r°r±)rgrƒr²Z _fix_lib_argsÚwarnÚstrrrrr2r´r€r¡rŠr‹r³r›rœr]Úmkpathr    rrxr rr)rhZ target_descr§r¶r’Ú    librariesÚ library_dirsÚruntime_library_dirsÚexport_symbolsrr¤r¥Ú
build_temprµZ
fixed_argsZlib_optsr‚Z export_optsZld_argsZdll_nameZdll_extZ implib_filer«r%r%r&Úlink´s`ÿ
ÿþ
ÿÿ
 
ÿþ 
 
zMSVCCompiler.linkcs ttj|jd}tƒj||dS)N)ÚPATH)rY)Údictrr.rvÚsuperr )rhrUrY©Ú    __class__r%r&r ùszMSVCCompiler.spawncCsd|S)Nz    /LIBPATH:r%©rhrr%r%r&Úlibrary_dir_optionszMSVCCompiler.library_dir_optioncCs tdƒ‚dS)Nz:don't know how to set runtime library search path for MSVC)rrÈr%r%r&Úruntime_library_dir_optionsÿz'MSVCCompiler.runtime_library_dir_optioncCs
| |¡S)N)r³)rhrnr%r%r&Úlibrary_optionszMSVCCompiler.library_optioncCs\|r|d|g}n|g}|D]:}|D]0}tj || |¡¡}tj |¡r$|Sq$qdS)NZ_d)rrr2r³r>)rhÚdirsrnrZ    try_namesrÚnameZlibfiler%r%r&Úfind_library_file s zMSVCCompiler.find_library_file)rrr)N)rrl)NNNrNNN)NrN)
NNNNNrNNNN)r)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú compiler_typeZ executablesržrŸr–r—r•rˆr„Zstatic_lib_extensionÚshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionrerƒršr­r·rÂr rÉrÊrËrÎÚ __classcell__r%r%rÆr&rc¬sf
ÿÿ
 
Pý
"þ
]û
ó
E rc)N)rÒrr0Ú
contextlibÚsuppressÚ ImportErrorrÚdistutils.errorsrrrrrÚdistutils.ccompilerrrÚ    distutilsr    Údistutils.utilr
Ú    itertoolsr r'r7ZPLAT_SPEC_TO_RUNTIMErBrZrartrcr%r%r%r&Ú<module>s4    !ü
ü