ok

Mini Shell

Direktori : /usr/lib64/python3.6/distutils/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/distutils/__pycache__/_msvccompiler.cpython-36.pyc

3


 \KT�@s�dZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZddlm
Z
mZddlmZddlmZddlmZdd	�Zd
d�Zdd
�Zdd�Zddd�Zddd�Zedg�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�ytjtjdtjtjBd�}Wntk
r<tjd�dSXd}d}|��x�t�D]�}ytj	||�\}}}Wntk
r�PYnX|rT|tj
krTtjj
|�rTytt|��}Wnttfk
r�wTYnX|dkrT||krT||}}qTWWdQRX||fS)Nz'Software\Microsoft\VisualStudio\SxS\VC7)�accesszVisual C++ is not registeredr�)NN)�winregZ	OpenKeyEx�HKEY_LOCAL_MACHINEZKEY_READZKEY_WOW64_32KEY�OSErrorr	�debugrZ	EnumValueZREG_SZ�os�path�isdir�int�float�
ValueError�	TypeError)�key�best_version�best_dir�i�v�vc_dirZvt�version�r �%/usr/lib64/python3.6/_msvccompiler.py�_find_vc2015s0
r"c
s�ddl�ddl}d}d}g���fdd�}|j|d�}|j�|j�x��D]~\}}}}d|krLtjj|ddd�}	tjj|	�s�qLytd	d
�|j	d�D��}
Wnt
tfk
r�wLYnX|
|krL|
|	}}qLWy|d}Wntk
r�d}YnX||fS)
Nrcs�j�j��dS)N)�extend�findallr )�_distutils_findvs�all_packagesr r!�_getallDsz_find_vc2017.<locals>._getall)�targetz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64ZVCZ	AuxiliaryZBuildcss|]}t|�VqdS)N)r)�.0rr r r!�	<genexpr>Psz_find_vc2017.<locals>.<genexpr>�.)r)
r%�	threadingZThread�start�joinrrr�tuple�splitrr�
IndexError)r,rrr'�t�nameZversion_strrZpackagesrrr )r%r&r!�_find_vc2017:s2
r4cCs
t�\}}d}d|krdnd}|rztjj|ddddddd	�}yd
dl}|j|dd�d}Wntttfk
rxd}YnX|s�t�\}}|r�tjj|d|dd	�}|s�t	j
d�dStjj|d�}tjj|�s�t	j
d|�dS|p�tjj|��rt	j
d|�d}||fS)N�amd64Zx64�x86z..ZredistZMSVCz**zMicrosoft.VC141.CRTzvcruntime140.dllrT)�	recursive�zMicrosoft.VC140.CRTz$No suitable Visual C++ version foundz
vcvarsall.batz%s cannot be found���)NN)NN)r4rrr.�glob�ImportErrorr�LookupErrorr"r	r�isfile)�	plat_specrr�	vcruntimeZvcruntime_platZvcredistr:�	vcvarsallr r r!�_find_vcvarsall[s6



rAcCs�tjd�rdd�tjj�D�St|�\}}|s6td��y&tjdj||�tj	d�j
ddd	�}Wn@tjk
r�}z"tj
|j�td
j|j���WYdd}~XnXdd�dd
�|j�D�D�}|r�||d<|S)NZDISTUTILS_USE_SDKcSsi|]\}}||j��qSr )�lower)r)r�valuer r r!�
<dictcomp>sz_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)�stderrzutf-16le�replace)�errorszError executing {}cSs$i|]\}}}|r|r||j��qSr )rB)r)r�_rCr r r!rD�scss|]}|jd�VqdS)�=N)�	partition)r)�liner r r!r*�sz_get_vc_env.<locals>.<genexpr>�py_vcruntime_redist)r�getenv�environ�itemsrAr�
subprocessZcheck_output�formatZSTDOUT�decodeZCalledProcessErrorr	�error�output�cmd�
splitlines)r>r@r?�out�exc�envr r r!�_get_vc_env}s(


rZcCsN|stjd�jtj�}x2|D]*}tjjtjj|�|�}tjj|�r|SqW|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)rrMr0�pathseprr.�abspathr=)Zexe�paths�p�fnr r r!�	_find_exe�s	
r`r6Z	x86_amd64)Zwin32z	win-amd64zvcruntime140.dllc
s�eZdZdZdZiZdgZdddgZdgZdgZ	eeee	Z
d	Zd
ZdZ
dZd
ZZdZd*dd�Zd+dd�Zd,dd�Zd-dd�Zd.dd�Zd/dd�Zdd�Z�fd d!�Zd"d#�Zd$d%�Zd&d'�Zd0d(d)�Z�ZS)1�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_run�forcer r r!rb�szMSVCCompiler.__init__NcCsN|jstd��|dkrt�}|tkr8tdjtt����t|}t|�}|sTtd��|jdd�|_	|j	j
tj�}t
d|�|_t
d|�|_t
d|�|_t
d	|�|_t
d
|�|_t
d|�|_|jdd�|_x2|jd
d�j
tj�D]}|r�|j|jtj��q�Wx6|jdd�j
tj�D]}|�r|j|jtj���qWd|_dddddg|_|jj|j�rZdnd�ddddddg|_dddg}|j�s�|jd%�ddddg}|d&�|_|d'�|_|d(�|_ |d)�|_!|�|_"|�|_#t$j%df|jt$j%d#f|jt$j%d$f|jt$j&df|j t$j&d#f|j t$j&d$f|j!t$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.exerL�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)rkrl)rm)rm)rnrorp)rnrorp))rd�AssertionErrorr
�PLAT_TO_VCVARSrrQr/rZ�get�_pathsr0rr[r`�cc�linkerrj�rc�mcZmt�_vcruntime_redistZadd_include_dir�rstrip�sepZadd_library_dirZpreprocess_options�compile_options�append�compile_options_debugr#Zldflags_exeZldflags_exe_debugZldflags_sharedZldflags_shared_debugZldflags_staticZldflags_static_debugrZ
EXECUTABLEZ
SHARED_OBJECTZSHARED_LIBRARY�_ldflags)rercr>Zvc_envr]�dir�ldflagsZ
ldflags_debugr r r!�
initialize�sb





zMSVCCompiler.initializerhcsT�fdd��jD��fdd��j�jD����p4d����fdd�}tt||��S)Ncsi|]}�j|�qSr )�
obj_extension)r)�ext)rer r!rD8sz1MSVCCompiler.object_filenames.<locals>.<dictcomp>csi|]}�j|�qSr )�
res_extension)r)r�)rer r!rD9srhcs�tjj|�\}}�r"tjj|�}n2tjj|�\}}|jtjjtjjf�rT|dd�}ytjj�|�|�St	k
r�t
dj|���YnXdS)Nr8zDon't know how to compile {})rr�splitext�basename�
splitdrive�
startswithr{�altsepr.r<rrQ)r^�baser�rH)�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)reZsource_filenamesr�r�r�r )r�r�rer�r!�object_filenames3s
zMSVCCompiler.object_filenamesc	Cs�|js|j�|j||||||�}	|	\}}
}}}|p6g}
|
jd�|rT|
j|j�n|
j|j�d}�x|
D�]}y||\}}Wntk
r�wlYnX|r�tj	j
|�}||jkr�d|}�nD||jkr�d|}d}�n*||j
k�rB|}d|}y|j|jg|||g�Wqltk
�r<}zt|��WYdd}~XqlXqln�||jk�r�tj	j|�}tj	j|�}y\|j|jd|d||g�tj	jtj	j|��\}}tj	j||d	�}|j|jd||g�Wqltk
�r�}zt|��WYdd}~XqlXqlntd
j||���|jg|
|}|�r$|jd�|j|�|jd|�|j|�y|j|�Wqltk
�r�}zt|��WYdd}~XqlXqlW|
S)
Nz/cFz/Tcz/TpTz/foz-hz-rz.rcz"Don't know how to compile {} to {}z/EHscz/Fo)rdr�Z_setup_compiler}r#r~r|�KeyErrorrrr\�
_c_extensions�_cpp_extensionsr��spawnrwrrr��dirnamerxr�r�r.rQru)reZsourcesr�ZmacrosZinclude_dirsr�
extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_optsZadd_cpp_opts�obj�srcr�Z	input_optZ
output_opt�msgZh_dirZrc_dirr�rHZrc_file�argsr r r!�compileTsn








zMSVCCompiler.compilec	Cs�|js|j�|j||�\}}|j||d�}|j||�r�|d|g}|rJy,tjd|jdj|��|j	|jg|�Wq�t
k
r�}zt|��WYdd}~Xq�Xntjd|�dS)N)r�z/OUT:zExecuting "%s" %s� zskipping %s (up-to-date))rdr��_fix_object_args�library_filename�
_need_linkr	rrjr.r�rr)	rer�Zoutput_libnamer�r�target_lang�output_filenameZlib_argsr�r r r!�create_static_lib�szMSVCCompiler.create_static_libcCs�|js|j�|j||�\}}|j|||�}|\}}}|rL|jdt|��t||||�}|dk	rptjj	||�}|j
||��r�|j||	f}dd�|p�gD�}||||d|g}tjj|d�}|dk	�rtjj
tjj|��\}}tjj	||j|��}|jd|�|
�r|
|dd�<|�r.|j|�tjjtjj|��}|j|�y6tjd|jdj	|��|j|jg|�|j|�Wn,tk
�r�}zt|��WYdd}~XnXntjd	|�dS)
Nz5I don't know what to do with 'runtime_library_dirs': cSsg|]}d|�qS)z/EXPORT:r )r)Zsymr r r!�
<listcomp>�sz%MSVCCompiler.link.<locals>.<listcomp>z/OUT:rz/IMPLIB:zExecuting "%s" %sr�zskipping %s (up-to-date))rdr�r�Z
_fix_lib_args�warn�strrrrr.r�rr�r�r�r�r}r#r\Zmkpathr	rrvr��_copy_vcruntimerr)reZtarget_descr�r�r�Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrr�r�Z
build_tempr�Z
fixed_argsZlib_optsr�Zexport_optsZld_argsZdll_nameZdll_extZimplib_filer�r r r!�link�sN



zMSVCCompiler.linkcCs`|j}|stjj|�rdStjj|�j�tkr6dStjd|�t	j
||�}tj|tj
�dS)NzCopying "%s")ryrrr=r�rB�
_BUNDLED_DLLSr	r�shutil�copy�chmod�stat�S_IWRITE)rer�r?r r r!r�szMSVCCompiler._copy_vcruntimecs4tjd�}z|jtjd<t�j|�S|tjd<XdS)Nr)rrMrtrN�superr�)rerUZold_path)�	__class__r r!r�s

zMSVCCompiler.spawncCsd|S)Nz	/LIBPATH:r )rer�r r r!�library_dir_option&szMSVCCompiler.library_dir_optioncCstd��dS)Nz:don't know how to set runtime library search path for MSVC)r)rer�r r r!�runtime_library_dir_option)sz'MSVCCompiler.runtime_library_dir_optioncCs
|j|�S)N)r�)rerjr r r!�library_option-szMSVCCompiler.library_optioncCs`|r|d|g}n|g}xB|D]6}x0|D](}tjj||j|��}tjj|�r(|Sq(WqWdSdS)NZ_d)rrr.r�r=)re�dirsrjrZ	try_namesr�r3Zlibfiler r r!�find_library_file0s

zMSVCCompiler.find_library_file)rrr)N)rrh)NNNrNNN)NrN)
NNNNNrNNNN)r)�__name__�
__module__�__qualname__�__doc__Z
compiler_typeZexecutablesr�r�r�r�r�r�r�Zstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrbr�r�r�r�r�r�r�r�r�r�r��
__classcell__r r )r�r!ra�sN


T

[

9ra)N)r�rr�r�rPrZdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	Zdistutils.utilr
�	itertoolsrr"r4rArZr`rr�	frozensetr�rar r r r!�<module>s&!" 



Zerion Mini Shell 1.0