Your IP : 3.139.86.53


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



���]�O�@s$ddlZddlZddlZddlZddlmZmZmZmZm	Z	ddl
mZmZddl
mZddlmZddlZddlmZdd�Zd	d
�Zddd�Zd
dddiZddddddiZedg�ZGdd�de�ZdS)�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError)�	CCompiler�gen_lib_options)�log)�get_platform)�countc$Cs�y)tjtjddtjtjB�}Wn#tk
rNtjd�d	SYnX|��d}d}x�t�D]�}ytj	||�\}}}Wntk
r�PYnX|rl|tj
krltjj
|�rlytt|��}Wnttfk
rwlYnX|dkrl||krl||}}qlW|sBtjd�d
Stjj|d�}	tjj|	�s}tjd|	�dSd}
tj|�}|r�tjj||j|��}
tjj|
�s�tjd|
�d}
|	|
fSWdQRXdS)Nz'Software\Microsoft\VisualStudio\SxS\VC7�accesszVisual C++ is not registeredr�z$No suitable Visual C++ version foundz
vcvarsall.batz%s cannot be found)NN)NN)NN)�winregZ	OpenKeyEx�HKEY_LOCAL_MACHINEZKEY_READZKEY_WOW64_32KEY�OSErrorr	�debugrZ	EnumValueZREG_SZ�os�path�isdir�int�float�
ValueError�	TypeError�join�isfile� _VCVARS_PLAT_TO_VCRUNTIME_REDIST�get�format)�	plat_spec�keyZbest_versionZbest_dir�i�vZvc_dirZvt�version�	vcvarsall�	vcruntimeZvcruntime_spec�r%�2/opt/alt/python35/lib64/python3.5/_msvccompiler.py�_find_vcvarsallsN

	
'
r'cCstjd�r)dd�tjj�D�St|�\}}|sMtd��y7tjdj||�dtj	�j
ddd	�}WnPtjk
r�}z-tj
|j�td
j|j���WYdd}~XnXdd�dd
�|j�D�D�}|r
||d<|S)NZDISTUTILS_USE_SDKcSs%i|]\}}||j��qSr%)�lower)�.0r�valuer%r%r&�
<dictcomp>Ns	z_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set�stderrzutf-16le�errors�replacezError executing {}cSs4i|]*\}}}|r|r||j��qSr%)r()r)r�_r*r%r%r&r+as	css|]}|jd�VqdS)�=N)�	partition)r)�liner%r%r&�	<genexpr>dsz_get_vc_env.<locals>.<genexpr>�py_vcruntime_redist)r�getenv�environ�itemsr'r�
subprocess�check_outputr�STDOUT�decode�CalledProcessErrorr	�error�output�cmd�
splitlines)rr#r$�out�exc�envr%r%r&�_get_vc_envLs(		"	
rDcCsm|s!tjd�jtj�}xE|D]=}tjjtjj|�|�}tjj|�r(|Sq(W|S)Nr)rr5�split�pathseprr�abspathr)Zexe�paths�p�fnr%r%r&�	_find_exels	
!rK�win32Zx86z	win-amd64Z	x86_amd64z1redist\x86\Microsoft.VC{0}0.CRT\vcruntime{0}0.dll�amd64z1redist\x64\Microsoft.VC{0}0.CRT\vcruntime{0}0.dllzvcruntime140.dllcsgeZdZdZiZdgZdddgZdgZdgZeeeeZ	dZ
d	Zd
ZdZ
dZZd
Zddddd�Zddd�Zdddd�Zddddddddd�Zddddd�Zdddddddddddd�
Zdd�Z�fdd �Zd!d"�Zd#d$�Zd%d&�Zdd'd(�Z�S))�MSVCCompilerZmsvcz.cz.ccz.cppz.cxxz.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs,tj||||�d|_d|_dS)NF)r�__init__�	plat_name�initialized)�self�verbose�dry_run�forcer%r%r&rO�s	zMSVCCompiler.__init__NcCs%|dkrt�}|tkr<tdjtt����t|}t|�}|sdtd��|jdd�|_|jjt	j
�}td|�|_td|�|_
td|�|_td|�|_td	|�|_td
|�|_|jdd�|_x9|jdd�jt	j
�D]}|r.|j|�q.Wx9|jd
d�jt	j
�D]}|rj|j|�qjWd|_dddddg|_|jj|jr�dnd�ddddddg|_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.r�zcl.exezlink.exezlib.exezrc.exezmc.exezmt.exer4�include�libz/nologoz/Oxz/W3z/GLz/DNDEBUGz/MDz/MTz/Odz/MDdz/Ziz/D_DEBUGz/INCREMENTAL:NOz/LTCG�/nodefaultlib:libucrt.lib�ucrt.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_VCVARSrr�tuplerDr�_pathsrErrFrK�cc�linkerrX�rc�mc�mt�_vcruntime_redistZadd_include_dirZadd_library_dirZpreprocess_options�compile_options�append�compile_options_debug�extendZldflags_exeZldflags_exe_debugZldflags_sharedZldflags_shared_debugZldflags_staticZldflags_static_debugrZ
EXECUTABLEZ
SHARED_OBJECTZSHARED_LIBRARY�_ldflagsrQ)rRrPrZvc_envrH�dir�ldflagsZ
ldflags_debugr%r%r&�
initialize�s`		
%%		
zMSVCCompiler.initializerVcsv�fdd��jD��fdd��j�jD����pHd����fdd�}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	rVcs�tjj|�\}}�r3tjj|�}nItjj|�\}}|jtjjtjjf�r||dd�}ytjj�|�|�SWn't	k
r�t
dj|���YnXdS)N�zDon't know how to compile {})rr�splitext�basename�
splitdrive�
startswith�sep�altsepr�LookupErrorrr)rI�baserqr/)�ext_map�
output_dir�	strip_dirr%r&�
make_out_paths!
z4MSVCCompiler.object_filenames.<locals>.make_out_path)�src_extensions�_rc_extensions�_mc_extensions�list�map)rRZsource_filenamesr~r}rr%)r|r}rRr~r&�object_filenames
s
&zMSVCCompiler.object_filenamesc	Cs?|js|j�|j||||||�}	|	\}}
}}}|pOg}
|
jd�|rx|
j|j�n|
j|j�d}x�|
D]�}y||\}}Wntk
r�w�YnX|r�tj	j
|�}||jkr�d|}n�||jkrd|}d}n�||j
kr�|}d|}y%|j|jg|||g�Wq�tk
r�}zt|��WYdd}~Xq�Xq�n||jkr�tj	j|�}tj	j|�}y�|j|jd|d||g�tj	jtj	j|��\}}tj	j||d	�}|j|jd||g�Wq�tk
r�}zt|��WYdd}~Xq�Xq�ntd
j||���|jg|
|}|r�|jd�|j|�|jd|�|j|�y|j|�Wq�tk
r6}zt|��WYdd}~Xq�Xq�W|
S)
Nz/cFz/Tcz/TpTz/foz-hz-rz.rcz"Don't know how to compile {} to {}z/EHscz/Fo)rQroZ_setup_compilerirkrjrh�KeyErrorrrrG�
_c_extensions�_cpp_extensionsr��spawnrdrrr��dirnamerertrurrrb)rRZsourcesr}ZmacrosZinclude_dirsr�
extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_optsZadd_cpp_opts�obj�srcrqZ	input_optZ
output_opt�msgZh_dirZrc_dirr{r/Zrc_file�argsr%r%r&�compile+sn	





	
%"$!	


#zMSVCCompiler.compilec	Cs�|js|j�|j||�\}}|j|d|�}|j||�r�|d|g}|riy:tjd|jdj|��|j	|jg|�Wq�t
k
r�}zt|��WYdd}~Xq�Xntjd|�dS)Nr}z/OUT:zExecuting "%s" %s� zskipping %s (up-to-date))rQro�_fix_object_args�library_filename�
_need_linkr	rrXrr�rr)	rRr�Zoutput_libnamer}r�target_lang�output_filenameZlib_argsr�r%r%r&�create_static_lib�s	
	"zMSVCCompiler.create_static_libcCsX|js|j�|j||�\}}|j|||�}|\}}}|rl|jdt|��t||||�}|dk	r�tjj	||�}|j
||�rD|j||	f}dd�|p�gD�}||||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" %sr�zskipping %s (up-to-date))rQror�Z
_fix_lib_args�warn�strrrrrr�rlr�rtrur�rirkrGZmkpathr	rrcr��_copy_vcruntimerr)rRZtarget_descr�r�r}Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrr�r�Z
build_tempr�Z
fixed_argsZlib_optsrnZexport_optsZld_argsZdll_nameZdll_extZimplib_filer�r%r%r&�link�sN	
					

"zMSVCCompiler.linkcCs�|j}|s#tjj|�r'dStjj|�j�tkrIdStjd|�t	j
||�}tj|tj
�dS)NzCopying "%s")rgrrrrur(�
_BUNDLED_DLLSr	r�shutil�copy�chmod�stat�S_IWRITE)rRr}r$r%r%r&r��s	zMSVCCompiler._copy_vcruntimecsHtjd�}z$|jtjd<t�j|�SWd|tjd<XdS)Nr)rr5rar6�superr�)rRr?Zold_path)�	__class__r%r&r��s
zMSVCCompiler.spawncCsd|S)Nz	/LIBPATH:r%)rRrmr%r%r&�library_dir_option�szMSVCCompiler.library_dir_optioncCstd��dS)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)rrrr�r)rR�dirsrXrZ	try_namesrm�nameZlibfiler%r%r&�find_library_files	

zMSVCCompiler.find_library_file)�__name__�
__module__�__qualname__Z
compiler_typeZexecutablesr�r�r�r�r�rrrpZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrOror�r�r�r�r�r�r�r�r�r�r%r%)r�r&rN�sL			
T[9rN)rr�r�r8Zdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	Zdistutils.utilr
r�	itertoolsrr'rDrKr_r�	frozensetr�rNr%r%r%r&�<module>s&(. 

?>