Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/distutils/__pycache__/_msvccompiler.cpython-37.opt-2.pyc

B

YI~d�M�@s�ddlZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlmZdd�Zd	d
�Zdd�Zd
d�Zddd�Zddd�ZGdd�de�ZdS)�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError)�	CCompiler�gen_lib_options)�log)�get_platform)�countcCs�ytjtjdtjtjBd�}Wntk
r<t�d�dSXd}d}|��x�t�D]�}yt�	||�\}}}Wntk
r�PYnX|rT|tj
krTtj�
|�rTytt|��}Wnttfk
r�wTYnX|dkrT||krT||}}qTWWdQRX||fS)Nz'Software\Microsoft\VisualStudio\SxS\VC7)�accesszVisual C++ is not registered)NNr�)�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�vZvc_dirZvt�version�r�</opt/alt/python37/lib64/python3.7/distutils/_msvccompiler.py�_find_vc2015s0
r!c
Cs�ddl}tj�d�ptj�d�}|s(dSy8tjtj�|ddd�dd	d
ddd
ddg	ddd���}Wntj	t
tfk
r|dSXtj�|ddd�}tj�|�r�d|fSdS)NrzProgramFiles(x86)ZProgramFiles)NNzMicrosoft Visual StudioZ	Installerzvswhere.exez-latestz-prereleasez	-requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z	-propertyZinstallationPathz	-products�*�mbcs�strict)�encoding�errorsZVCZ	AuxiliaryZBuild�)
�jsonr�environ�get�
subprocess�check_outputr�join�strip�CalledProcessErrorr�UnicodeDecodeErrorr)r(�rootrrrr �_find_vc2017:s&
r2cCs\t�\}}|st�\}}|s*t�d�dStj�|d�}tj�|�sTt�d|�dS|dfS)Nz$No suitable Visual C++ version found)NNz
vcvarsall.batz%s cannot be found)r2r!r	rrrr-�isfile)�	plat_spec�_rr�	vcvarsallrrr �_find_vcvarsall\s


r7c
Cs�t�d�rdd�tj��D�St|�\}}|s6td��y&tjd�||�tj	d�j
ddd	�}Wn@tjk
r�}z t�
|j�td
�|j���Wdd}~XYnXdd�dd
�|��D�D�}|S)NZDISTUTILS_USE_SDKcSsi|]\}}||���qSr)�lower)�.0r�valuerrr �
<dictcomp>psz_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)�stderrzutf-16le�replace)r&zError executing {}cSs$i|]\}}}|r|r||���qSr)r8)r9rr5r:rrr r;�scss|]}|�d�VqdS)�=N)�	partition)r9�linerrr �	<genexpr>�sz_get_vc_env.<locals>.<genexpr>)r�getenvr)�itemsr7rr+r,�formatZSTDOUT�decoder/r	�error�output�cmd�
splitlines)r4r6r5�out�exc�envrrr �_get_vc_envns$


rMcCsN|st�d��tj�}x2|D]*}tj�tj�|�|�}tj�|�r|SqW|S)Nr)rrB�split�pathseprr-�abspathr3)Zexe�paths�p�fnrrr �	_find_exe�s	
rTZx86Z	x86_amd64)�win32z	win-amd64c
s�eZdZdZiZdgZdddgZdgZdgZeeeeZ	dZ
d	Zd
ZdZ
dZZd
Zd'dd�Zd(dd�Zd)dd�Zd*dd�Zd+dd�Zd,dd�Z�fdd�Zdd �Zd!d"�Zd#d$�Zd-d%d&�Z�ZS).�MSVCCompilerZmsvcz.cz.ccz.cppz.cxxz.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs t�||||�d|_d|_dS)NF)r�__init__�	plat_name�initialized)�self�verboseZdry_run�forcerrr rW�szMSVCCompiler.__init__NcCs|dkrt�}|tkr(td�tt����t|}t|�}|sDtd��|�dd�|_|j�t	j
�}td|�|_td|�|_
td|�|_td|�|_td	|�|_td
|�|_x2|�dd��t	j
�D]}|r�|�|�t	j��q�Wx2|�dd��t	j
�D]}|r�|�|�t	j��q�Wd|_d
dddddg|_d
dddddg|_d
ddg}d
dddg}|d �|_|d!�|_|d"�|_|d#�|_|�|_|�|_tj df|jtj df|jtj df|jtj!df|jtj!df|jtj!df|jtj"df|jtj"df|jtj"df|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.exeZinclude�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)r_)r_)r`rarb)r`rarb)%r
�PLAT_TO_VCVARSrrD�tuplerMr*�_pathsrNrrOrT�cc�linkerr^�rc�mc�mtZadd_include_dir�rstrip�sepZadd_library_dirZpreprocess_options�compile_options�compile_options_debugZldflags_exeZldflags_exe_debugZldflags_sharedZldflags_shared_debugZldflags_staticZldflags_static_debugrZ
EXECUTABLEZ
SHARED_OBJECTZSHARED_LIBRARY�_ldflagsrY)rZrXr4Zvc_envrQ�dir�ldflagsZ
ldflags_debugrrr �
initialize�sX




zMSVCCompiler.initializer]csT�fdd��jD��fdd��j�jD����p4d����fdd�}tt||��S)Ncsi|]}�j|�qSr)�
obj_extension)r9�ext)rZrr r;sz1MSVCCompiler.object_filenames.<locals>.<dictcomp>csi|]}�j|�qSr)�
res_extension)r9rt)rZrr r;sr]cs�tj�|�\}}�r"tj�|�}n2tj�|�\}}|�tjjtjjf�rT|dd�}ytj��|�|�St	k
r�t
d�|���YnXdS)N�zDon't know how to compile {})rr�splitext�basename�
splitdrive�
startswithrl�altsepr-�LookupErrorrrD)rR�basertr5)�ext_map�
output_dir�	strip_dirrr �
make_out_path#sz4MSVCCompiler.object_filenames.<locals>.make_out_path)�src_extensions�_rc_extensions�_mc_extensions�list�map)rZZsource_filenamesr�rr�r)r~rrZr�r �object_filenamess
zMSVCCompiler.object_filenamesc	Cs�|js|��|�||||||�}	|	\}}
}}}|p6g}
|
�d�|rT|
�|j�n|
�|j�d}�x|
D�]}y||\}}Wntk
r�wlYnX|r�tj	�
|�}||jkr�d|}�nD||jkr�d|}d}�n*||j
k�rB|}d|}y|�|jg|||g�Wqltk
�r<}zt|��Wdd}~XYqlXqln�||jk�r�tj	�|�}tj	�|�}y\|�|jd|d||g�tj	�tj	�|��\}}tj	�||d	�}|�|jd||g�Wqltk
�r�}zt|��Wdd}~XYqlXqlntd
�||���|jg|
|}|�r$|�d�|�|�|�d|�|�|�y|�|�Wqltk
�r�}zt|��Wdd}~XYqlXqlW|
S)
Nz/cFz/Tcz/TpTz/foz-hz-rz.rcz"Don't know how to compile {} to {}z/EHscz/Fo)rYrrZ_setup_compile�append�extendrnrm�KeyErrorrrrP�
_c_extensions�_cpp_extensionsr��spawnrhrrr��dirnamerirwrxr-rDrf)rZZsourcesrZmacrosZinclude_dirsr�
extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_optsZadd_cpp_opts�obj�srcrtZ	input_optZ
output_opt�msgZh_dirZrc_dirr}r5Zrc_file�argsrrr �compile9sn








zMSVCCompiler.compilec	
Cs�|js|��|�||�\}}|j||d�}|�||�r�|d|g}|rJy,t�d|jd�|��|�	|jg|�Wq�t
k
r�}zt|��Wdd}~XYq�Xnt�d|�dS)N)rz/OUT:zExecuting "%s" %s� zskipping %s (up-to-date))rYrr�_fix_object_args�library_filename�
_need_linkr	rr^r-r�rr)	rZr�Zoutput_libnamerr�target_lang�output_filenameZlib_argsr�rrr �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�|��}|�|�y,t�d|jd�	|��|�|jg|�Wn,tk
�r�}zt|��Wdd}~XYnXnt�d	|�dS)
Nz5I don't know what to do with 'runtime_library_dirs': cSsg|]}d|�qS)z/EXPORT:r)r9Zsymrrr �
<listcomp>�sz%MSVCCompiler.link.<locals>.<listcomp>z/OUT:rz/IMPLIB:zExecuting "%s" %sr�zskipping %s (up-to-date))rYrrr�Z
_fix_lib_args�warn�strrrrr-r�ror�rwrxr�r�r�rPZmkpathr	rrgr�rr)rZZtarget_descr�r�rZ	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrr�r�Z
build_tempr�Z
fixed_argsZlib_optsrqZexport_optsZld_argsZdll_nameZdll_extZimplib_filer�rrr �link�sL



zMSVCCompiler.linkc	s4t�d�}z|jtjd<t��|�S|tjd<XdS)Nr)rrBrer)�superr�)rZrHZold_path)�	__class__rr r��s

zMSVCCompiler.spawncCsd|S)Nz	/LIBPATH:r)rZrprrr �library_dir_option�szMSVCCompiler.library_dir_optioncCstd��dS)Nz:don't know how to set runtime library search path for MSVC)r)rZrprrr �runtime_library_dir_optionsz'MSVCCompiler.runtime_library_dir_optioncCs
|�|�S)N)r�)rZr^rrr �library_optionszMSVCCompiler.library_optioncCs`|r|d|g}n|g}xB|D]6}x0|D](}tj�||�|��}tj�|�r(|Sq(WqWdSdS)NZ_d)rrr-r�r3)rZ�dirsr^rZ	try_namesrp�nameZlibfilerrr �find_library_files

zMSVCCompiler.find_library_file)rrr)N)rr])NNNrNNN)NrN)
NNNNNrNNNN)r)�__name__�
__module__�__qualname__Z
compiler_typeZexecutablesr�r�r�r�r�rursZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrWrrr�r�r�r�r�r�r�r�r��
__classcell__rr)r�r rV�sJ


P

[

8rV)N)rZshutil�statr+rZdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	Zdistutils.utilr
�	itertoolsrr!r2r7rMrTrcrVrrrr �<module>s""


Hacked By AnonymousFox1.0, Coded By AnonymousFox