Viewing File: /opt/alt/python35/lib64/python3.5/distutils/__pycache__/_msvccompiler.cpython-35.opt-2.pyc



]O@s$ddlZddlZddlZddlZddlmZmZmZmZm	Z	ddl
mZmZddl
mZddlmZddlZddlmZddZd	d
ZdddZd
dddiZddddddiZedgZGdddeZdS)N)DistutilsExecErrorDistutilsPlatformErrorCompileErrorLibError	LinkError)	CCompilergen_lib_options)log)get_platform)countc$Csy)tjtjddtjtjB}Wn#tk
rNtjdd	SYnX|d}d}xtD]}ytj	||\}}}Wntk
rPYnX|rl|tj
krltjj
|rlytt|}Wnttfk
rwlYnX|dkrl||krl||}}qlW|sBtjdd
Stjj|d}	tjj|	s}tjd|	dSd}
tj|}|rtjj||j|}
tjj|
stjd|
d}
|	|
fSWdQRXdS)Nz'Software\Microsoft\VisualStudio\SxS\VC7accesszVisual C++ is not registeredrz$No suitable Visual C++ version foundz
vcvarsall.batz%s cannot be found)NN)NN)NN)winregZ	OpenKeyExHKEY_LOCAL_MACHINEZKEY_READZKEY_WOW64_32KEYOSErrorr	debugrZ	EnumValueZREG_SZospathisdirintfloat
ValueError	TypeErrorjoinisfile _VCVARS_PLAT_TO_VCRUNTIME_REDISTgetformat)	plat_speckeyZbest_versionZbest_dirivZvc_dirZvtversion	vcvarsall	vcruntimeZvcruntime_specr%2/opt/alt/python35/lib64/python3.5/_msvccompiler.py_find_vcvarsallsN

	
'
r'cCstjdr)ddtjjDSt|\}}|sMtdy7tjdj||dtj	j
ddd	}WnPtjk
r}z-tj
|jtd
j|jWYdd}~XnXdddd
|jDD}|r
||d<|S)NZDISTUTILS_USE_SDKcSs%i|]\}}||jqSr%)lower).0rvaluer%r%r&
<dictcomp>Ns	z_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && setstderrzutf-16leerrorsreplacezError executing {}cSs4i|]*\}}}|r|r||jqSr%)r()r)r_r*r%r%r&r+as	css|]}|jdVqdS)=N)	partition)r)liner%r%r&	<genexpr>dsz_get_vc_env.<locals>.<genexpr>py_vcruntime_redist)rgetenvenvironitemsr'r
subprocesscheck_outputrSTDOUTdecodeCalledProcessErrorr	erroroutputcmd
splitlines)rr#r$outexcenvr%r%r&_get_vc_envLs(		"	
rDcCsm|s!tjdjtj}xE|D]=}tjjtjj||}tjj|r(|Sq(W|S)Nr)rr5splitpathseprrabspathr)Zexepathspfnr%r%r&	_find_exels	
!rKwin32Zx86z	win-amd64Z	x86_amd64z1redist\x86\Microsoft.VC{0}0.CRT\vcruntime{0}0.dllamd64z1redist\x64\Microsoft.VC{0}0.CRT\vcruntime{0}0.dllzvcruntime140.dllcsgeZdZdZiZdgZdddgZdgZdgZeeeeZ	dZ
d	Zd
ZdZ
dZZd
ZdddddZdddZddddZdddddddddZdddddZdddddddddddd
ZddZfdd Zd!d"Zd#d$Zd%d&Zdd'd(ZS))MSVCCompilerZmsvcz.cz.ccz.cppz.cxxz.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs,tj||||d|_d|_dS)NF)r__init__	plat_nameinitialized)selfverbosedry_runforcer%r%r&rOs	zMSVCCompiler.__init__NcCs%|dkrt}|tkr<tdjttt|}t|}|sdtd|jdd|_|jjt	j
}td||_td||_
td||_td||_td	||_td
||_|jdd|_x9|jddjt	j
D]}|r.|j|q.Wx9|jd
djt	j
D]}|rj|j|qjWd|_dddddg|_|jj|jrdndddddddg|_dddg}|js|jd$ddddg}|d%|_|d&|_|d'|_|d(|_||_||_t j!df|jt j!d"f|jt j!d#f|jt j"df|jt j"d"f|jt j"d#f|jt j#df|jt j#d"f|jt j#d#f|ji	|_$d#|_%dS))Nz--plat-name must be one of {}z7Unable to find a compatible Visual Studio installation.rzcl.exezlink.exezlib.exezrc.exezmc.exezmt.exer4includelibz/nologoz/Oxz/W3z/GLz/DNDEBUGz/MDz/MTz/Odz/MDdz/Ziz/D_DEBUGz/INCREMENTAL:NOz/LTCG/nodefaultlib:libucrt.libucrt.libz/DEBUG:FULL/MANIFEST:EMBED,ID=1/DLL/MANIFEST:EMBED,ID=2/MANIFESTUAC:NOFT)rYrZ)r[)r[)r\r]r^)r\r]r^)&r
PLAT_TO_VCVARSrrtuplerDr_pathsrErrFrKcclinkerrXrcmcmt_vcruntime_redistZadd_include_dirZadd_library_dirZpreprocess_optionscompile_optionsappendcompile_options_debugextendZldflags_exeZldflags_exe_debugZldflags_sharedZldflags_shared_debugZldflags_staticZldflags_static_debugrZ
EXECUTABLEZ
SHARED_OBJECTZSHARED_LIBRARY_ldflagsrQ)rRrPrZvc_envrHdirldflagsZ
ldflags_debugr%r%r&
initializes`		
%%		
zMSVCCompiler.initializerVcsvfddjDfddjjDpHdfdd}tt||S)Ncsi|]}j|qSr%)
obj_extension)r)ext)rRr%r&r+s	z1MSVCCompiler.object_filenames.<locals>.<dictcomp>csi|]}j|qSr%)
res_extension)r)rq)rRr%r&r+s	rVcstjj|\}}r3tjj|}nItjj|\}}|jtjjtjjfr||dd}ytjj||SWn't	k
rt
dj|YnXdS)NzDon't know how to compile {})rrsplitextbasename
splitdrive
startswithsepaltseprLookupErrorrr)rIbaserqr/)ext_map
output_dir	strip_dirr%r&
make_out_paths!
z4MSVCCompiler.object_filenames.<locals>.make_out_path)src_extensions_rc_extensions_mc_extensionslistmap)rRZsource_filenamesr~r}rr%)r|r}rRr~r&object_filenames
s
&zMSVCCompiler.object_filenamesc	Cs?|js|j|j||||||}	|	\}}
}}}|pOg}
|
jd|rx|
j|jn|
j|jd}x|
D]}y||\}}Wntk
rwYnX|rtj	j
|}||jkrd|}n||jkrd|}d}n||j
kr|}d|}y%|j|jg|||gWqtk
r}zt|WYdd}~XqXqn||jkrtj	j|}tj	j|}y|j|jd|d||gtj	jtj	j|\}}tj	j||d	}|j|jd||gWqtk
r}zt|WYdd}~XqXqntd
j|||jg|
|}|r|jd|j||jd||j|y|j|Wqtk
r6}zt|WYdd}~XqXqW|
S)
Nz/cFz/Tcz/TpTz/foz-hz-rz.rcz"Don't know how to compile {} to {}z/EHscz/Fo)rQroZ_setup_compilerirkrjrhKeyErrorrrrG
_c_extensions_cpp_extensionsrspawnrdrrrdirnamerertrurrrb)rRZsourcesr}ZmacrosZinclude_dirsr
extra_preargsextra_postargsZdependsZcompile_infoobjectsZpp_optsZbuildZcompile_optsZadd_cpp_optsobjsrcrqZ	input_optZ
output_optmsgZh_dirZrc_dirr{r/Zrc_fileargsr%r%r&compile+sn	





	
%"$!	


#zMSVCCompiler.compilec	Cs|js|j|j||\}}|j|d|}|j||r|d|g}|riy:tjd|jdj||j	|jg|Wqt
k
r}zt|WYdd}~XqXntjd|dS)Nr}z/OUT:zExecuting "%s" %s zskipping %s (up-to-date))rQro_fix_object_argslibrary_filename
_need_linkr	rrXrrrr)	rRrZoutput_libnamer}rtarget_langoutput_filenameZlib_argsrr%r%r&create_static_libs	
	"zMSVCCompiler.create_static_libcCsX|js|j|j||\}}|j|||}|\}}}|rl|jdt|t||||}|dk	rtjj	||}|j
||rD|j||	f}dd|pgD}||||d|g}tjj|d}|dk	rrtjj
tjj|\}}tjj	||j|}|jd||
r|
|dd<|r|j|tjjtjj|}|j|yGtjd|jdj	||j|jg||j|WqTtk
r@}zt|WYdd}~XqTXntjd	|dS)
Nz5I don't know what to do with 'runtime_library_dirs': cSsg|]}d|qS)z/EXPORT:r%)r)Zsymr%r%r&
<listcomp>s	z%MSVCCompiler.link.<locals>.<listcomp>z/OUT:rz/IMPLIB:zExecuting "%s" %srzskipping %s (up-to-date))rQrorZ
_fix_lib_argswarnstrrrrrrrlrrtrurrirkrGZmkpathr	rrcr_copy_vcruntimerr)rRZtarget_descrrr}Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrrrZ
build_temprZ
fixed_argsZlib_optsrnZexport_optsZld_argsZdll_nameZdll_extZimplib_filerr%r%r&linksN	
					

"zMSVCCompiler.linkcCs|j}|s#tjj|r'dStjj|jtkrIdStjd|t	j
||}tj|tj
dS)NzCopying "%s")rgrrrrur(
_BUNDLED_DLLSr	rshutilcopychmodstatS_IWRITE)rRr}r$r%r%r&rs	zMSVCCompiler._copy_vcruntimecsHtjd}z$|jtjd<tj|SWd|tjd<XdS)Nr)rr5rar6superr)rRr?Zold_path)	__class__r%r&rs
zMSVCCompiler.spawncCsd|S)Nz	/LIBPATH:r%)rRrmr%r%r&library_dir_optionszMSVCCompiler.library_dir_optioncCstddS)Nz:don't know how to set runtime library search path for MSVC)r)rRrmr%r%r&runtime_library_dir_optionsz'MSVCCompiler.runtime_library_dir_optioncCs
|j|S)N)r)rRrXr%r%r&library_optionszMSVCCompiler.library_optioncCs|r|d|g}n	|g}xW|D]K}xB|D]:}tjj||j|}tjj|r6|Sq6Wq)WdSdS)NZ_d)rrrrr)rRdirsrXrZ	try_namesrmnameZlibfiler%r%r&find_library_files	

zMSVCCompiler.find_library_file)__name__
__module____qualname__Z
compiler_typeZexecutablesrrrrrrrrpZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrOrorrrrrrrrrrr%r%)rr&rNsL			
T[9rN)rrrr8Zdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	Zdistutils.utilr
r	itertoolsrr'rDrKr_r	frozensetrrNr%r%r%r&<module>s&(. 
Back to Directory File Manager