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__/msvc9compiler.cpython-37.opt-2.pyc

B

YI~d/w�@sNddlZddlZddlZddlZddlmZmZmZmZm	Z	ddl
mZmZm
Z
ddlmZddlmZddlZejZejZejZejZejejejejfZej dko�ej!dkZ"e"r�dZ#d	Z$d
Z%ndZ#dZ$d
Z%ddd�Z&Gdd�d�Z'Gdd�d�Z(dd�Z)dd�Z*dd�Z+dd�Z,d#dd�Z-e)�Z.e.dk�r:ed e.��Gd!d"�d"e�Z/dS)$�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError)�	CCompiler�gen_preprocess_options�gen_lib_options)�log)�get_platform�win32lz1Software\Wow6432Node\Microsoft\VisualStudio\%0.1fz5Software\Wow6432Node\Microsoft\Microsoft SDKs\Windowsz,Software\Wow6432Node\Microsoft\.NETFrameworkz%Software\Microsoft\VisualStudio\%0.1fz)Software\Microsoft\Microsoft SDKs\Windowsz Software\Microsoft\.NETFramework�x86Zamd64)rz	win-amd64c@sLeZdZdd�Zee�Zdd�Zee�Zdd�Zee�Zdd�Zee�Zd	S)
�RegcCs:x,tD]$}|�||�}|r||kr||SqWt|��dS)N)�HKEYS�read_values�KeyError)�cls�path�key�base�d�r�</opt/alt/python37/lib64/python3.7/distutils/msvc9compiler.py�	get_value@s

z
Reg.get_valuecCsnyt||�}Wntk
r"dSXg}d}x<yt||�}Wntk
rRPYnX|�|�|d7}q.W|S)Nr�)�RegOpenKeyEx�RegError�
RegEnumKey�append)rrr�handle�L�i�krrr�	read_keysHs
z
Reg.read_keysc	Cs�yt||�}Wntk
r"dSXi}d}xTyt||�\}}}Wntk
rXPYnX|��}|�|�||�|�<|d7}q.W|S)Nrr)rr�RegEnumValue�lower�convert_mbcs)	rrrrrr!�name�value�typerrrrZszReg.read_valuescCs:t|dd�}|dk	r6y|d�}Wntk
r4YnX|S)N�decode�mbcs)�getattr�UnicodeError)�sZdecrrrr&pszReg.convert_mbcsN)	�__name__�
__module__�__qualname__r�classmethodr#rr&�staticmethodrrrrr<src@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
MacroExpandercCsi|_t||_|�|�dS)N)�macros�VS_BASE�vsbase�load_macros)�self�versionrrr�__init__|s
zMacroExpander.__init__cCst�||�|jd|<dS)Nz$(%s))rrr5)r9Zmacrorrrrr�	set_macro�szMacroExpander.set_macroc	Cs|�d|jdd�|�d|jdd�|�dtd�y$|dkrP|�d	td
�ntd
��Wntk
rvtd��YnX|dkr�|�d
|jd�|�dtd�ndd}x^tD]V}yt||�}Wntk
r�w�YnXt	|d�}t
�|d||f�}|d|jd<q�WdS)NZVCInstallDirz	\Setup\VC�
productdirZVSInstallDirz	\Setup\VSZFrameworkDirZinstallrootg @ZFrameworkSDKDirzsdkinstallrootv2.0aPython was built with Visual Studio 2008;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2008 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.g"@ZFrameworkVersionzclr versionZ
WindowsSdkDirZcurrentinstallfolderz.Software\Microsoft\NET Framework Setup\Productrz%s\%sr:z$(FrameworkVersion))
r<r7�NET_BASErr�WINSDK_BASErrrrrrr5)r9r:�pr�hrrrrrr8�s.

zMacroExpander.load_macroscCs(x"|j��D]\}}|�||�}qW|S)N)r5�items�replace)r9r.r"�vrrr�sub�szMacroExpander.subN)r/r0r1r;r<r8rErrrrr4zsr4cCs�d}tj�|�}|dkrdS|t|�}tj|d��dd�\}}t|dd��d}|dkrf|d7}t|dd	��d
}|dkr�d}|dkr�||SdS)NzMSC v.����� r����
��g$@r)�sysr:�find�len�split�int)�prefixr!r.�restZmajorVersionZminorVersionrrr�get_build_version�srTcCs4g}x*|D]"}tj�|�}||kr
|�|�q
W|S)N)�osr�normpathr)�pathsZ
reduced_pathsr@Znprrr�normalize_and_reduce_paths�s
rXcCs@|�tj�}g}x|D]}||kr|�|�qWtj�|�}|S)N)rPrU�pathsepr�join)�variableZoldListZnewListr!ZnewVariablerrr�removeDuplicates�s
r\cCst|}yt�d|d�}Wn"tk
r>t�d�d}YnX|rPtj�|�s�d|}tj	�
|d�}|r�tj�|�r�tj�|tjtjd�}tj�
|�}tj�|�s�t�d|�dSnt�d|�|s�t�d�dStj�|d	�}tj�|�r�|St�d
�dS)Nz%s\Setup\VCr=z%Unable to find productdir in registryzVS%0.f0COMNTOOLSZVCz%s is not a valid directoryz Env var %s is not set or invalidzNo productdir foundz
vcvarsall.batzUnable to find vcvarsall.bat)r6rrrr
�debugrUr�isdir�environ�getrZ�pardir�abspath�isfile)r:r7r=ZtoolskeyZtoolsdir�	vcvarsallrrr�find_vcvarsall�s2





recCs<t|�}ddddh}i}|dkr(td��t�d||�tjd||ftjtjd�}z�|��\}}|��d	krzt|�	d
���|�	d
�}xr|�
d�D]d}t�|�}d|kr�q�|�
�}|�
dd
�\}	}
|	��}	|	|kr�|
�tj�r�|
dd�}
t|
�||	<q�WWd|j��|j��Xt|�t|�k�r8ttt|������|S)N�include�libZlibpathrzUnable to find vcvarsall.batz'Calling 'vcvarsall.bat %s' (version=%s)z
"%s" %s & set)�stdout�stderrrr+�
�=rrF)rerr
r]�
subprocess�Popen�PIPEZcommunicate�waitr*rPrr&�stripr%�endswithrUrYr\rh�closerirO�
ValueError�str�list�keys)r:ZarchrdZinteresting�result�popenrhri�linerr(rrr�query_vcvarsall�s<



rzg @z(VC %0.1f is not supported by this modulec
@s�eZdZdZiZdgZdddgZdgZdgZeeeeZ	dZ
d	Zd
ZdZ
dZZd
Zd-dd�Zd.dd�Zd/dd�Zd0dd�Zd1dd�Zd2dd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd3d)d*�Zd+d,�ZdS)4�MSVCCompilerZmsvcz.cz.ccz.cppz.cxxz.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs8t�||||�t|_d|_g|_d|_d|_d|_dS)NzSoftware\Microsoft\VisualStudioF)	rr;�VERSION�_MSVCCompiler__versionZ_MSVCCompiler__root�_MSVCCompiler__paths�	plat_name�_MSVCCompiler__arch�initialized)r9�verboseZdry_run�forcerrrr;IszMSVCCompiler.__init__NcCs|dkrt�}d}||kr(td|f��dtjkrfdtjkrf|�d�rfd|_d|_d|_d|_d	|_	n�|t�ksx|d
kr�t
|}nt
t�dt
|}tt|�}|d�
tj�|_|d
tjd
<|dtjd<t|j�dkr�td|j��|�d�|_|�d�|_|�d�|_|�d�|_|�d	�|_	y,x&tjd�
d�D]}|j�|��q<WWntk
�rjYnXt|j�|_d�|j�tjd<d|_|jdk�r�dddddg|_ddddddg|_n&ddddddg|_dddddddg|_dddg|_|jdk�rddd d!g|_dg|_d"|_dS)#N)rz	win-amd64z--plat-name must be one of %sZDISTUTILS_USE_SDKZMSSdkzcl.exezlink.exezlib.exezrc.exezmc.exer�_rrgrfrzxPython was built with %s, and extensions need to be built with the same version of the compiler, but it isn't installed.�;r
z/nologoz/Oxz/MDz/W3z/DNDEBUGz/Odz/MDdz/Z7z/D_DEBUGz/GS-z/DLLz/INCREMENTAL:NO�z/INCREMENTAL:noz/DEBUGT)rrrUr_�find_exe�cc�linkerrg�rc�mc�PLAT_TO_VCVARSrzr|rPrYr~rOZ_MSVCCompiler__productrrrXrZZpreprocess_optionsr��compile_options�compile_options_debug�ldflags_sharedr}�ldflags_shared_debugZldflags_staticr�)r9rZok_platsZ	plat_specZvc_envr@rrr�
initializeTsd







zMSVCCompiler.initialize�cCs�|dkrd}g}x�|D]�}tj�|�\}}tj�|�d}|tj�|�d�}||jkrdtd|��|rttj�|�}||jkr�|�	tj�
|||j��q||jkr�|�	tj�
|||j��q|�	tj�
|||j
��qW|S)Nr�rzDon't know how to compile %s)rUr�splitext�
splitdrive�isabs�src_extensionsr�basename�_rc_extensionsrrZ�
res_extension�_mc_extensions�
obj_extension)r9Zsource_filenamesZ	strip_dir�
output_dirZ	obj_namesZsrc_namer�extrrr�object_filenames�s(



zMSVCCompiler.object_filenamesc	Cst|js|��|�||||||�}	|	\}}
}}}|p6g}
|
�d�|rT|
�|j�n|
�|j��x|
D�]}y||\}}Wntk
r�whYnX|r�tj	�
|�}||jkr�d|}�nT||jkr�d|}�n>||j
k�r>|}d|}y"|�|jg||g|g�Wqhtk
�r8}zt|��Wdd}~XYqhXqhn�||jk�rtj	�|�}tj	�|�}yl|�|jgd|d|g|g�tj	�tj	�|��\}}tj	�||d�}|�|jgd|g|g�Wqhtk
�r�}zt|��Wdd}~XYqhXqhntd||f��d	|}y&|�|jg|
|||g|�Wqhtk
�rj}zt|��Wdd}~XYqhXqhW|
S)
Nz/cz/Tcz/Tpz/foz-hz-rz.rcz"Don't know how to compile %s to %sz/Fo)r�r�Z_setup_compiler�extendr�r�rrUrrb�
_c_extensions�_cpp_extensionsr��spawnr�rrr��dirnamer�r�r�rZr�)r9Zsourcesr�r5Zinclude_dirsr]�
extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_opts�obj�srcr�Z	input_optZ
output_opt�msgZh_dirZrc_dirrr�Zrc_filerrr�compile�sj




zMSVCCompiler.compilec	
Cs�|js|��|�||�\}}|j||d�}|�||�r�|d|g}|rJy|�|jg|�Wq�tk
r�}zt|��Wdd}~XYq�Xnt	�
d|�dS)N)r�z/OUT:zskipping %s (up-to-date))r�r��_fix_object_args�library_filename�
_need_linkr�rgrrr
r])	r9r�Zoutput_libnamer�r]�target_lang�output_filenameZlib_argsr�rrr�create_static_libszMSVCCompiler.create_static_libc
CsX|js|��|�||�\}}|�|||�}|\}}}|rL|�dt|��t||||�}|dk	rptj�	||�}|�
||��rH|tjkr�|	r�|j
dd�}q�|jdd�}n|	r�|j
}n|j}g}x|p�gD]}|�d|�q�W||||d|g}tj�|d�}|dk	�rPtj�tj�|��\}}tj�	||�|��}|�d|�|�|||�|
�rp|
|dd�<|�r�|�|�|�tj�|��y|�|jg|�Wn,tk
�r�}zt|��Wdd}~XYnX|�||�}|dk	�rT|\}}d||f}y|�dd	d
||g�Wn,tk
�rD}zt|��Wdd}~XYnXnt�d|�dS)Nz5I don't know what to do with 'runtime_library_dirs': rz/EXPORT:z/OUT:rz/IMPLIB:z-outputresource:%s;%szmt.exez-nologoz	-manifestzskipping %s (up-to-date))r�r�r�Z
_fix_lib_args�warnrtr	rUrrZr�r�
EXECUTABLEr�r�rr�r�r�r��manifest_setup_ldargsr�Zmkpathr�r�rr�manifest_get_embed_infor
r])r9�target_descr�r�r�Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsr]r�r��
build_tempr�Z
fixed_argsZlib_optsZldflagsZexport_optsZsym�ld_argsZdll_nameZdll_extZimplib_filer�ZmfinfoZ
mffilename�mfidZout_argrrr�link6sl





zMSVCCompiler.linkcCs,tj�|tj�|�d�}|�d|�dS)Nz	.manifestz/MANIFESTFILE:)rUrrZr�r)r9r�r�r��
temp_manifestrrrr��sz"MSVCCompiler.manifest_setup_ldargscCs`x,|D] }|�d�r|�dd�d}PqWdS|tjkr>d}nd}|�|�}|dkrXdS||fS)Nz/MANIFESTFILE:�:rrK)�
startswithrPrr��_remove_visual_c_ref)r9r�r��argr�r�rrrr��s



z$MSVCCompiler.manifest_get_embed_infocCs�y�t|�}z|��}Wd|��Xt�dtj�}t�|d|�}d}t�|d|�}t�dtj�}t�||�dkrrdSt|d�}z|�|�|S|��XWnt	k
r�YnXdS)NzU<assemblyIdentity.*?name=("|')Microsoft\.VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)r�z*<dependentAssembly>\s*</dependentAssembly>zI<assemblyIdentity.*?name=(?:"|')(.+?)(?:"|').*?(?:/>|</assemblyIdentity>)�w)
�open�readrr�rer��DOTALLrE�search�write�OSError)r9Z
manifest_fileZ
manifest_fZmanifest_buf�patternrrrr��s.	


z!MSVCCompiler._remove_visual_c_refcCsd|S)Nz	/LIBPATH:r)r9�dirrrr�library_dir_option�szMSVCCompiler.library_dir_optioncCstd��dS)Nz<don't know how to set runtime library search path for MSVC++)r)r9r�rrr�runtime_library_dir_option�sz'MSVCCompiler.runtime_library_dir_optioncCs
|�|�S)N)r�)r9rgrrr�library_option�szMSVCCompiler.library_optioncCs`|r|d|g}n|g}xB|D]6}x0|D](}tj�||�|��}tj�|�r(|Sq(WqWdSdS)NZ_d)rUrrZr��exists)r9�dirsrgr]Z	try_namesr�r'Zlibfilerrr�find_library_file�s

zMSVCCompiler.find_library_filecCszx4|jD]*}tj�tj�|�|�}tj�|�r|SqWx>tjd�d�D]*}tj�tj�|�|�}tj�|�rH|SqHW|S)NZPathr�)r~rUrrZrbrcr_rP)r9Zexer@�fnrrrr�s	zMSVCCompiler.find_exe)rrr)N)rr�)NNNrNNN)NrN)
NNNNNrNNNN)r)r/r0r1Z
compiler_typeZexecutablesr�r�r�r�r�r�r�Zstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionr;r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr{+sP


W

V

R+
r{)r
)0rUrlrMr�Zdistutils.errorsrrrrrZdistutils.ccompilerrrr	Z	distutilsr
Zdistutils.utilr�winregZ	OpenKeyExrZEnumKeyrZ	EnumValuer$�errorrZ
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINEZHKEY_CLASSES_ROOTr�platform�maxsizeZNATIVE_WIN64r6r?r>r�rr4rTrXr\rerzr|r{rrrr�<module>sJ>.#
)


Hacked By AnonymousFox1.0, Coded By AnonymousFox