ok

Mini Shell

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



���]�w�@s�ddlZddlZddlZddlZddlmZmZmZmZm	Z	ddl
mZmZm
Z
ddlmZddlmZddlZejZejZejZejZejejejejfZej dko�ej!d&kZ"e"rd	Z#d
Z$dZ%ndZ#d
Z$dZ%ddddddiZ&Gdd�d�Z'Gdd�d�Z(dd�Z)dd�Z*dd�Z+dd�Z,dd d!�Z-e)�Z.e.d"kr�ed#e.��Gd$d%�d%e�Z/dS)'�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError)�	CCompiler�gen_preprocess_options�gen_lib_options)�log)�get_platform�win32�� z1Software\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�x86z	win-amd64�amd64zwin-ia64Zia64c@speZdZdd�Zee�Zdd�Zee�Zdd�Zee�Zdd�Zee�Zd	S)
�RegcCsMx:tD]2}|j||�}|r||kr||SqWt|��dS)N)�HKEYS�read_values�KeyError)�cls�path�key�base�d�r�2/opt/alt/python35/lib64/python3.5/msvc9compiler.py�	get_valueAs

z
Reg.get_valuecCs�yt||�}Wntk
r+dSYnXg}d}xDyt||�}Wntk
rcPYnX|j|�|d7}q;W|S)Nr�)�RegOpenKeyEx�RegError�
RegEnumKey�append)rrr�handle�L�i�krrr�	read_keysIs
	

z
Reg.read_keysc	Cs�yt||�}Wntk
r+dSYnXi}d}xhyt||�\}}}Wntk
rlPYnX|j�}|j|�||j|�<|d7}q;W|S)Nrr)rr�RegEnumValue�lower�convert_mbcs)	rrrr"rr$�name�value�typerrrr[s
	
zReg.read_valuescCsGt|dd�}|dk	rCy|d�}Wntk
rBYnX|S)N�decode�mbcs)�getattr�UnicodeError)�sZdecrrrr)qs
zReg.convert_mbcsN)	�__name__�
__module__�__qualname__r�classmethodr&rr)�staticmethodrrrrr=src@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
MacroExpandercCs'i|_t||_|j|�dS)N)�macros�VS_BASE�vsbase�load_macros)�self�versionrrr�__init__}s	
zMacroExpander.__init__cCs!tj||�|jd|<dS)Nz$(%s))rrr8)r<Zmacrorrrrr�	set_macro�szMacroExpander.set_macrocCsT|jd|jdd�|jd|jdd�|jdtd�y2|dkrl|jd	td
�ntd
��Wntk
r�td��YnX|dkr�|jd
|jd�|jdtd�n~d}xutD]m}yt||�}Wntk
rw�YnXt	|d�}t
j|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?r:�NET_BASErr�WINSDK_BASErrrr rrr8)r<r=�pr�hrrrrrr;�s.



zMacroExpander.load_macroscCs6x/|jj�D]\}}|j||�}qW|S)N)r8�items�replace)r<r1r%�vrrr�sub�szMacroExpander.subN)r2r3r4r>r?r;rHrrrrr7{sr7cCs�d}tjj|�}|d
kr(dS|t|�}tj|d�jdd�\}}t|dd��d}|dkr�|d7}t|dd��d}|dkr�d	}|dkr�||SdS)NzMSC v.r�� r
�
�g$@r������)�sysr=�find�len�split�int)�prefixr$r1�restZmajorVersionZminorVersionrrr�get_build_version�s%
rVcCsFg}x9|D]1}tjj|�}||kr
|j|�q
W|S)N)�osr�normpathr!)�pathsZ
reduced_pathsrCZnprrr�normalize_and_reduce_paths�s
rZcCsX|jtj�}g}x'|D]}||kr|j|�qWtjj|�}|S)N)rRrW�pathsepr!�join)�variableZoldListZnewListr$ZnewVariablerrr�removeDuplicates�s
r^c
Cs^t|}ytjd|d�}Wn%tk
rKtjd�d}YnX|sftjj|�rd|}tj	j
|d�}|r�tjj|�r�tjj|tjtjd�}tjj
|�}tjj|�stjd|�dSntjd|�|s"tjd�dStjj|d	�}tjj|�rM|Stjd
�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)r9rrrr
�debugrWr�isdir�environ�getr\�pardir�abspath�isfile)r=r:r@ZtoolskeyZtoolsdir�	vcvarsallrrr�find_vcvarsall�s2





!

rgcCs�t|�}td�}i}|dkr6td��tjd||�tjd||fdtjd	tj�}z�|j�\}}|j	�d
kr�t|j
d���|j
d�}x�|jd�D]�}tj
|�}d
|kr�q�|j�}|jd
d�\}	}
|	j�}	|	|kr�|
jtj�rQ|
dd�}
t|
�||	<q�WWd|jj�|jj�Xt|�t|�kr�ttt|j�����|S)N�include�lib�libpathrzUnable to find vcvarsall.batz'Calling 'vcvarsall.bat %s' (version=%s)z
"%s" %s & set�stdout�stderrrr.�
�=r)rhrirjrrM)rg�setrr
r_�
subprocess�Popen�PIPE�communicate�waitr-rRrr)�stripr(�endswithrWr[r^rk�closerlrQ�
ValueError�str�list�keys)r=ZarchrfZinteresting�result�popenrkrl�linerr+rrr�query_vcvarsall�s<	
rg @z(VC %0.1f is not supported by this modulec@syeZdZdZiZdgZdddgZdgZdgZeeeeZ	dZ
d	Zd
ZdZ
dZZd
Zddddd�Zddd�Zdddd�Zddddddddd�Zddddd�Zdddddddddddd�
Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zdd)d*�Zd+d,�ZdS)-�MSVCCompilerZmsvcz.cz.ccz.cppz.cxxz.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCsPtj||||�t|_d|_g|_d|_d|_d|_dS)NzSoftware\Microsoft\VisualStudioF)	rr>�VERSION�_MSVCCompiler__versionZ_MSVCCompiler__root�_MSVCCompiler__paths�	plat_name�_MSVCCompiler__arch�initialized)r<�verbose�dry_run�forcerrrr>Js					zMSVCCompiler.__init__NcCs�|dkrt�}d$}||kr:td|f��dtjkr�dtjkr�|jd�r�d|_d|_d	|_d
|_d|_	n
|t�ks�|dkr�t
|}nt
t�dt
|}tt|�}|d
j
tj�|_|dtjd<|dtjd<t|j�dkrJtd|j��|jd�|_|jd�|_|jd	�|_|jd
�|_|jd�|_	y5x.tjd
j
d�D]}|jj|�q�WWntk
r�YnXt|j�|_dj|j�tjd
<d|_|jdkrgdddddg|_ddddddg|_n9ddddddg|_dddddddg|_dddg|_|jd kr�ddd!d"g|_dg|_d#|_dS)%Nr�	win-amd64�win-ia64z--plat-name must be one of %sZDISTUTILS_USE_SDKZMSSdkzcl.exezlink.exezlib.exezrc.exezmc.exe�_rrirhrzxPython was built with %s, and extensions need to be built with the same version of the compiler, but it isn't installed.�;rz/nologoz/Oxz/MDz/W3z/DNDEBUGz/Odz/MDdz/Z7z/D_DEBUGz/GS-z/DLLz/INCREMENTAL:NO�z/INCREMENTAL:noz/DEBUGT)rr�r�)rrrWra�find_exe�cc�linkerri�rc�mc�PLAT_TO_VCVARSrr�rRr[r�rQZ_MSVCCompiler__productr!rrZr\Zpreprocess_optionsr��compile_options�compile_options_debug�ldflags_sharedr��ldflags_shared_debugZldflags_staticr�)r<r�Zok_platsZ	plat_specZvc_envrCrrr�
initializeUsd	
-				


	zMSVCCompiler.initialize�cCs;|dkrd}g}x|D]}tjj|�\}}tjj|�d}|tjj|�d�}||jkr�td|��|r�tjj|�}||jkr�|j	tjj
|||j��q||jkr|j	tjj
|||j��q|j	tjj
|||j
��qW|S)Nr�rzDon't know how to compile %s)rWr�splitext�
splitdrive�isabs�src_extensionsr�basename�_rc_extensionsr!r\�
res_extension�_mc_extensions�
obj_extension)r<Zsource_filenamesZ	strip_dir�
output_dirZ	obj_namesZsrc_namer�extrrr�object_filenames�s(
zMSVCCompiler.object_filenamesc	Cs|js|j�|j||||||�}	|	\}}
}}}|pOg}
|
jd�|rx|
j|j�n|
j|j�x�|
D]�}y||\}}Wntk
r�w�YnX|r�tj	j
|�}||jkr�d|}n�||jkrd|}n�||j
kr�|}d|}y)|j|jg||g|g�Wq�tk
r�}zt|��WYdd}~Xq�Xq�n||jkr�tj	j|�}tj	j|�}y�|j|jgd|d|g|g�tj	jtj	j|��\}}tj	j||d�}|j|jgd|g|g�Wq�tk
r�}zt|��WYdd}~Xq�Xq�ntd||f��d	|}y-|j|jg|
|||g|�Wq�tk
r}zt|��WYdd}~Xq�Xq�W|
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�rrWrrd�
_c_extensions�_cpp_extensionsr��spawnr�rrr��dirnamer�r�r�r\r�)r<Zsourcesr�r8Z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�|j||�\}}|j|d|�}|j||�r�|d|g}|riy|j|jg|�Wq�tk
r�}zt|��WYdd}~Xq�Xnt	j
d|�dS)Nr�z/OUT:zskipping %s (up-to-date))r�r��_fix_object_args�library_filename�
_need_linkr�rirrr
r_)	r<r�Zoutput_libnamer�r_�target_lang�output_filenameZlib_argsr�rrr�create_static_libs	
	"zMSVCCompiler.create_static_libcCs|js|j�|j||�\}}|j|||�}|\}}}|rl|jdt|��t||||�}|dk	r�tjj	||�}|j
||�r|tjkr�|	r�|j
dd�}q|jdd�}n|	r|j
}n	|j}g}x%|p"gD]}|jd|�q#W||||d|g}tjj|d�}|dk	r�tjjtjj|��\}}tjj	||j|��}|jd|�|j|||�|
r�|
|dd�<|r|j|�|jtjj|��y|j|jg|�Wn1tk
rs}zt|��WYdd}~XnX|j||�}|dk	r|\}}d||f}y |jdd	d
||g�Wqtk
r}zt|��WYdd}~XqXntjd|�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�warnryr	rWrr\r�r�
EXECUTABLEr�r�r!r�r�r�r��manifest_setup_ldargsr�Zmkpathr�r�rr�manifest_get_embed_infor
r_)r<�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�link8sl	
						
"zMSVCCompiler.linkcCs:tjj|tjj|�d�}|jd|�dS)Nz	.manifestz/MANIFESTFILE:)rWrr\r�r!)r<r�r�r��
temp_manifestrrrr��s	z"MSVCCompiler.manifest_setup_ldargscCs�x8|D],}|jd�r|jdd�d}PqWdS|tjkrSd}nd}|j|�}|dkrxdS||fS)Nz/MANIFESTFILE:�:rr
)�
startswithrRrr��_remove_visual_c_ref)r<r�r��argr�r�rrrr��s
	z$MSVCCompiler.manifest_get_embed_infocCs�y�t|�}z|j�}Wd|j�Xtjdtj�}tj|d|�}d}tj|d|�}tjdtj�}tj||�dkr�dSt|d�}z|j|�|SWd|j�XWnt	k
r�YnXdS)NzU<assemblyIdentity.*?name=("|')Microsoft\.VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)r�z*<dependentAssembly>\s*</dependentAssembly>zI<assemblyIdentity.*?name=(?:"|')(.+?)(?:"|').*?(?:/>|</assemblyIdentity>)�w)
�open�readrw�rer��DOTALLrH�search�write�OSError)r<Z
manifest_fileZ
manifest_fZmanifest_buf�patternrrrr��s.	

z!MSVCCompiler._remove_visual_c_refcCsd|S)Nz	/LIBPATH:r)r<�dirrrr�library_dir_option�szMSVCCompiler.library_dir_optioncCstd��dS)Nz<don't know how to set runtime library search path for MSVC++)r)r<r�rrr�runtime_library_dir_option�sz'MSVCCompiler.runtime_library_dir_optioncCs
|j|�S)N)r�)r<rirrr�library_option�szMSVCCompiler.library_optioncCs�|r|d|g}n	|g}xW|D]K}xB|D]:}tjj||j|��}tjj|�r6|Sq6Wq)WdSdS)NZ_d)rWrr\r��exists)r<�dirsrir_Z	try_namesr�r*Zlibfilerrr�find_library_file�s	

zMSVCCompiler.find_library_filecCs�xH|jD]=}tjjtjj|�|�}tjj|�r
|Sq
WxUtjdjd�D]=}tjjtjj|�|�}tjj|�rb|SqbW|S)NZPathr�)r�rWrr\rdrerarR)r<ZexerC�fnrrrr�s	!!zMSVCCompiler.find_exe)r2r3r4Z
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			
XVR+r�l)0rWrprOr�Zdistutils.errorsrrrrrZdistutils.ccompilerrrr	Z	distutilsr
Zdistutils.utilr�winregZ	OpenKeyExrZEnumKeyr Z	EnumValuer'�errorrZ
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINEZHKEY_CLASSES_ROOTr�platform�maxsizeZNATIVE_WIN64r9rBrAr�rr7rVrZr^rgrr�r�rrrr�<module>sL(					>.#)	

Zerion Mini Shell 1.0