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-1.pyc

B

� f�M�@s�dZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZddlm
Z
mZddlmZddlmZddlmZdd	�Zd
d�Zdd
�Zdd�Zddd�Zddd�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)�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�d	d
ddd
dddg	ddd���}Wntj	t
tfk
r|dSXtj�|ddd�}tj�|�r�d|fSdS)aJReturns "15, path" based on the result of invoking vswhere.exe
    If no install is found, returns "None, None"

    The version is returned to avoid unnecessarily changing the function
    result. It may be ignored when the path is not None.

    If vswhere.exe is not available, by definition, VS 2017 is not
    installed.
    rNzProgramFiles(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)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)rrB�split�pathseprr-�abspathr3)Zexe�paths�p�fnrrr �	_find_exe�s	
rTZx86Z	x86_amd64)Zwin32z	win-amd64c
s�eZdZdZdZiZdgZdddgZdgZdgZ	eeee	Z
d	Zd
ZdZ
dZd
ZZdZd(dd�Zd)dd�Zd*dd�Zd+dd�Zd,dd�Zd-dd�Z�fdd�Zd d!�Zd"d#�Zd$d%�Zd.d&d'�Z�ZS)/�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 t�||||�d|_d|_dS)NF)r�__init__�	plat_name�initialized)�self�verboseZdry_runZforcerrr rV�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^r_r`)r^r_r`)%r
�PLAT_TO_VCVARSrrD�tuplerMr*�_pathsrNrrOrT�cc�linkerr\�rc�mcZmtZadd_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�_ldflagsrX)rYrWr4Zvc_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)rYrr r;sz1MSVCCompiler.object_filenames.<locals>.<dictcomp>csi|]}�j|�qSr)�
res_extension)r9rq)rYrr 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�
startswithri�altsepr-�LookupErrorrrD)rR�baserqr5)�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)rYZsource_filenamesr}r|r~r)r{r|rYr}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)rXroZ_setup_compile�append�extendrkrj�KeyErrorrrrP�
_c_extensions�_cpp_extensionsr��spawnrfrrr��dirnamergrtrur-rDrd)rYZsourcesr|ZmacrosZinclude_dirsr�
extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_optsZadd_cpp_opts�obj�srcrqZ	input_optZ
output_opt�msgZh_dirZrc_dirrzr5Zrc_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)r|z/OUT:zExecuting "%s" %s� zskipping %s (up-to-date))rXro�_fix_object_args�library_filename�
_need_linkr	rr\r-r�rr)	rYr�Zoutput_libnamer|r�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))rXror�Z
_fix_lib_args�warn�strrrrr-r�rlr�rtrur�r�r�rPZmkpathr	rrer�rr)rYZtarget_descr�r�r|Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrr�r�Z
build_tempr�Z
fixed_argsZlib_optsrnZexport_optsZld_argsZdll_nameZdll_extZimplib_filer�rrr �link�sL



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

zMSVCCompiler.spawncCsd|S)Nz	/LIBPATH:r)rYrmrrr �library_dir_option�szMSVCCompiler.library_dir_optioncCstd��dS)Nz:don't know how to set runtime library search path for MSVC)r)rYrmrrr �runtime_library_dir_optionsz'MSVCCompiler.runtime_library_dir_optioncCs
|�|�S)N)r�)rYr\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)rY�dirsr\rZ	try_namesrm�nameZlibfilerrr �find_library_files

zMSVCCompiler.find_library_file)rrr)N)rr[)NNNrNNN)NrN)
NNNNNrNNNN)r)�__name__�
__module__�__qualname__�__doc__Z
compiler_typeZexecutablesr�r�r�r�rrrrpZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrVror�r�r�r�r�r�r�r�r��
__classcell__rr)r�r rU�sL


P

[

8rU)N)r�rZshutil�statr+rZdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	Zdistutils.utilr
�	itertoolsrr!r2r7rMrTrarUrrrr �<module>s$"


Hacked By AnonymousFox1.0, Coded By AnonymousFox