ok

Mini Shell

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



M�Ma�O�@s*dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlZddlmZdd	�Zd
d�Zddd
�ZddddiZddddddiZedg�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$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%�</opt/alt/python35/lib64/python3.5/distutils/_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�
subprocessZcheck_outputrZSTDOUT�decodeZCalledProcessErrorr	�error�output�cmd�
splitlines)rr#r$�out�exc�envr%r%r&�_get_vc_envLs(		"	
rAcCsm|s!tjd�jtj�}xE|D]=}tjjtjj|�|�}tjj|�r(|Sq(W|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)rr5�split�pathseprr�abspathr)Zexe�paths�p�fnr%r%r&�	_find_exels	
!rH�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smeZdZdZdZiZdgZdddgZdgZdgZ	eeee	Z
d	Zd
ZdZ
dZd
ZZdZddddd�Zddd�Zdddd�Zddddddddd�Zddddd�Zdddddddddddd�
Zdd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zdd(d)�Z�S)*�MSVCCompilerzwConcrete class that implements an interface to Microsoft Visual C++,
       as defined by the CCompiler abstract class.Zmsvcz.cz.ccz.cppz.cxxz.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs,tj||||�d|_d|_dS)NF)r�__init__�	plat_name�initialized)�self�verboseZdry_runZforcer%r%r&rL�s	zMSVCCompiler.__init__NcCs;|jstd��|dkr+t�}|tkrRtdjtt����t|}t|�}|sztd��|jdd�|_	|j	j
tj�}t
d|�|_t
d|�|_t
d|�|_t
d	|�|_t
d
|�|_t
d|�|_|jdd�|_x9|jd
d�j
tj�D]}|rD|j|�qDWx9|jdd�j
tj�D]}|r�|j|�q�Wd|_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|j t"j%d#f|j t"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.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)rTrU)rV)rV)rWrXrY)rWrXrY)'rN�AssertionErrorr
�PLAT_TO_VCVARSrr�tuplerAr�_pathsrBrrCrH�cc�linkerrS�rc�mcZmt�_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�_ldflags)rOrMrZvc_envrE�dir�ldflagsZ
ldflags_debugr%r%r&�
initialize�sb		
%%		
zMSVCCompiler.initializerQcsv�fdd��jD��fdd��j�jD����pHd����fdd�}tt||��S)Ncsi|]}�j|�qSr%)�
obj_extension)r)�ext)rOr%r&r+s	z1MSVCCompiler.object_filenames.<locals>.<dictcomp>csi|]}�j|�qSr%)�
res_extension)r)rl)rOr%r&r+s	rQcs�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)rF�baserlr/)�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)rOZsource_filenamesryrxrzr%)rwrxrOryr&�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)rNrjZ_setup_compilerdrfrerc�KeyErrorrrrD�
_c_extensions�_cpp_extensionsr|�spawnr`rrr}�dirnamerarorprrr^)rOZsourcesrxZmacrosZinclude_dirsr�
extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_optsZadd_cpp_opts�obj�srcrlZ	input_optZ
output_opt�msgZh_dirZrc_dirrvr/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)Nrxz/OUT:zExecuting "%s" %s� zskipping %s (up-to-date))rNrj�_fix_object_args�library_filename�
_need_linkr	rrSrr�rr)	rOr�Zoutput_libnamerxr�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))rNrjr�Z
_fix_lib_args�warn�strrrrrr�rgr�rorpr�rdrfrDZmkpathr	rr_r��_copy_vcruntimerr)rOZtarget_descr�r�rxZ	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrr�r�Z
build_tempr�Z
fixed_argsZlib_optsriZexport_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")rbrrrrpr(�
_BUNDLED_DLLSr	r�shutil�copy�chmod�stat�S_IWRITE)rOrxr$r%r%r&r��s	zMSVCCompiler._copy_vcruntimecsHtjd�}z$|jtjd<t�j|�SWd|tjd<XdS)Nr)rr5r]r6�superr�)rOr<Zold_path)�	__class__r%r&r��s
zMSVCCompiler.spawncCsd|S)Nz	/LIBPATH:r%)rOrhr%r%r&�library_dir_option�szMSVCCompiler.library_dir_optioncCstd��dS)Nz:don't know how to set runtime library search path for MSVC)r)rOrhr%r%r&�runtime_library_dir_optionsz'MSVCCompiler.runtime_library_dir_optioncCs
|j|�S)N)r�)rOrSr%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)rO�dirsrSrZ	try_namesrh�nameZlibfiler%r%r&�find_library_files	

zMSVCCompiler.find_library_file)�__name__�
__module__�__qualname__�__doc__Z
compiler_typeZexecutablesr�r�r|r}r{rmrkZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrLrjr�r�r�r�r�r�r�r�r�r�r%r%)r�r&rK�sN			
T[9rK)r�rr�r�r8Zdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	Zdistutils.utilr
r�	itertoolsrr'rArHr[r�	frozensetr�rKr%r%r%r&�<module>s((. 

Zerion Mini Shell 1.0