Your IP : 18.190.239.189


Current Path : /opt/alt/python310/lib64/python3.10/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/distutils/__pycache__/msvccompiler.cpython-310.opt-2.pyc

o

6��f�[�@s~	ddlZddlZddlmZmZmZmZmZddlm	Z	m
Z
ddlmZdZ
zddlZdZ
eZejZejZejZejZWn2eyozddlZddlZdZ
eZejZejZejZejZWneyle�d�YnwYnwe
r|ejejejejfZ dd	�Z!d
d�Z"dd
�Z#Gdd�d�Z$dd�Z%dd�Z&dd�Z'Gdd�de	�Z(e%�dkr�e�)d�e(Z*ddl+m(Z(ddl+m$Z$dSdS)�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError)�	CCompiler�gen_lib_options)�logFTz�Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules winreg, win32api or win32con are installed.cCsh	zt||�}Wn
tyYdSwg}d}	zt||�}Wn
ty)Y|Sw|�|�|d7}q�NrT�)�RegOpenKeyEx�RegError�
RegEnumKey�append)�base�key�handle�L�i�k�r�=/opt/alt/python310/lib64/python3.10/distutils/msvccompiler.py�	read_keys7s$��
�rcCs|	zt||�}Wn
tyYdSwi}d}	z
t||�\}}}Wn
ty,Y|Sw|��}t|�|t|�<|d7}qr
)rr
�RegEnumValue�lower�convert_mbcs)rrr�dr�name�value�typerrr�read_valuesHs&���r cCs<t|dd�}|durz|d�}W|StyY|Sw|S)N�decode�mbcs)�getattr�UnicodeError)�sZdecrrrr]s
��rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
MacroExpandercCsi|_|�|�dS�N)�macros�load_macros)�self�versionrrr�__init__gszMacroExpander.__init__cCs4tD]}t||�}|r|||jd|<dSqdS)Nz$(%s))�HKEYSr r()r*Zmacro�pathrrrrrr�	set_macroks
��zMacroExpander.set_macroc

Cs�d|}|�d|dd�|�d|dd�d}|�d|d	�z|d
kr,|�d|d�n|�d|d
�WntyD}ztd��d}~wwd}tD](}zt||�}Wn	ty[YqIwt|d�}t|d||f�}	|	d|jd<qIdS)Nz%Software\Microsoft\VisualStudio\%0.1fZVCInstallDirz	\Setup\VCZ
productdirZVSInstallDirz	\Setup\VSz Software\Microsoft\.NETFrameworkZFrameworkDirZinstallrootg@ZFrameworkSDKDirzsdkinstallrootv1.1ZsdkinstallrootaPython was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.z.Software\Microsoft\NET Framework Setup\Productrz%s\%sr+z$(FrameworkVersion))	r/�KeyErrorrr-rr
rr r()
r*r+ZvsbaseZnet�exc�pr�hrrrrrr)rs6�����
�zMacroExpander.load_macroscCs$|j��D]
\}}|�||�}q|Sr')r(�items�replace)r*r%r�vrrr�sub�szMacroExpander.subN)�__name__�
__module__�__qualname__r,r/r)r7rrrrr&fs
r&cCs�	d}tj�|�}|dkrdS|t|�}tj|d��dd�\}}t|dd��d}|dkr4|d7}t|dd	��d
}|dkrDd}|dkrL||SdS)NzMSC v.����� r����
��g$@r)�sysr+�find�len�split�int)�prefixrr%�restZmajorVersionZminorVersionrrr�get_build_version�s rIcCsB	d}tj�|�}|dkrdStj�d|�}tj|t|�|�S)Nz bit (r;�Intel�))rBr+rCrD)rGr�jrrr�get_build_architecture�srMcCs2	g}|D]}tj�|�}||vr|�|�q|Sr')�osr.�normpathr)�pathsZ
reduced_pathsr2Znprrr�normalize_and_reduce_paths�s
�rQc@s�eZdZ	dZiZdgZgd�ZdgZdgZeeeeZ	dZ
dZdZd	Z
d
ZZdZd*d
d�Zdd�Z		d+dd�Z		d,dd�Z			d-dd�Z										d.dd�Zdd�Zdd�Zdd �Zd/d!d"�Zd#d$�Zd0d&d'�Zd(d)�ZdS)1�MSVCCompilerZmsvcz.c)z.ccz.cppz.cxx�.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCsvt�||||�t�|_t�|_|jdkr.|jdkr$d|_t|j�|_nd|_d|j|_	nd|jd|_	d|_
dS)	NrJ�zSoftware\Microsoft\VisualStudiozSoftware\Microsoft\DevstudiozVisual Studio version %szMicrosoft SDK compiler %sr<F)rr,rI�_MSVCCompiler__versionrM�_MSVCCompiler__arch�_MSVCCompiler__rootr&�_MSVCCompiler__macros�_MSVCCompiler__product�initialized)r*�verboseZdry_runZforcerrrr,�s


zMSVCCompiler.__init__cCs�g|_dtjvr"dtjvr"|�d�r"d|_d|_d|_d|_d|_n<|�	d�|_t
|j�d	kr6td
|j��|�d�|_|�d�|_|�d�|_|�d�|_|�d�|_|�
d�|�
d�ztjd�d
�D]}|j�|�qgWn	tyzYnwt|j�|_d
�|j�tjd<d|_|jdkr�gd�|_gd�|_n
gd�|_gd�|_gd�|_|jdkr�gd�|_ngd�|_dg|_d|_dS)NZDISTUTILS_USE_SDKZMSSdkzcl.exezlink.exezlib.exezrc.exezmc.exer.rzxPython was built with %s, and extensions need to be built with the same version of the compiler, but it isn't installed.�libZinclude�;rJ)�/nologo�/Ox�/MD�/W3�/GX�/DNDEBUG)r^�/Od�/MDdrarb�/Z7�/D_DEBUG)r^r_r`ra�/GS-rc)r^rdrerarhrfrg)�/DLLr^z/INCREMENTAL:NOrT)rir^�/INCREMENTAL:no�/DEBUG)rir^rjz	/pdb:Nonerkr^T)�_MSVCCompiler__pathsrN�environ�find_exe�cc�linkerr\�rc�mc�get_msvc_pathsrDrrY�set_path_env_varrErr0rQ�joinZpreprocess_optionsrV�compile_options�compile_options_debug�ldflags_sharedrU�ldflags_shared_debugZldflags_staticrZ)r*r2rrr�
initialize�sP�

��







zMSVCCompiler.initialize�cCs�|durd}g}|D]b}tj�|�\}}tj�|�d}|tj�|�d�}||jvr1td|��|r9tj�|�}||jvrL|�	tj�
|||j��q
||jvr_|�	tj�
|||j��q
|�	tj�
|||j
��q
|S)Nr{rzDon't know how to compile %s)rNr.�splitext�
splitdrive�isabs�src_extensionsr�basename�_rc_extensionsrru�
res_extension�_mc_extensions�
obj_extension)r*Zsource_filenamesZ	strip_dir�
output_dirZ	obj_namesZsrc_namer�extrrr�object_filenames8s,

�
��zMSVCCompiler.object_filenamesNc	Cs8|js|��|�||||||�}	|	\}}
}}}|pg}
|
�d�|r*|
�|j�n|
�|j�|
D]�}z||\}}Wn	tyEYq2w|rNtj	�
|�}||jvrXd|}n�||jvrbd|}n�||j
vr�|}d|}z|�|jg||g|g�Wnty�}zt|��d}~wwq2||jvr�tj	�|�}tj	�|�}z6|�|jgd|d|g|g�tj	�tj	�|��\}}tj	�||d�}|�|jgd|g|g�Wnty�}zt|��d}~wwq2td||f��d	|}z|�|jg|
|||g|�Wq2t�y}zt|��d}~ww|
S)
Nz/cz/Tcz/Tpz/foz-hz-rrSz"Don't know how to compile %s to %sz/Fo)rZrzZ_setup_compiler�extendrwrvr0rNr.�abspath�
_c_extensions�_cpp_extensionsr��spawnrqrrr��dirnamerrr|r�ruro)r*Zsourcesr�r(Zinclude_dirs�debug�
extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_opts�obj�srcr�Z	input_optZ
output_opt�msgZh_dirZrc_dirr�_Zrc_filerrr�compileWs�
�
�




�
���


��
�
�����
���zMSVCCompiler.compilec	
Cs�|js|��|�||�\}}|j||d�}|�||�rC|d|g}|r&	z|�|jg|�WdStyB}zt|��d}~wwt	�
d|�dS)N)r��/OUT:�skipping %s (up-to-date))rZrz�_fix_object_args�library_filename�
_need_linkr�r\rrr	r�)	r*r�Zoutput_libnamer�r��target_lang�output_filenameZlib_argsr�rrr�create_static_lib�s"���zMSVCCompiler.create_static_libc
Cs�|js|��|�||�\}}|�|||�}|\}}}|r&|�dt|��t||||�}|dur8tj�	||�}|�
||�r�|tjkrU|	rM|j
dd�}n|jdd�}n	|	r[|j
}n|j}g}|pcgD]	}|�d|�qd||||d|g}|dur�tj�tj�|��\}}tj�	tj�|d�|�|��}|�d|�|
r�|
|dd�<|r�|�|�|�tj�|��z|�|jg|�WdSty�}zt|��d}~wwt�d|�dS)Nz5I don't know what to do with 'runtime_library_dirs': rz/EXPORT:r�rz/IMPLIB:r�)rZrzr�Z
_fix_lib_args�warn�strrrNr.rur�rZ
EXECUTABLEryrxrr|r�r�r�r�Zmkpathr�rprrr	r�)r*Ztarget_descr�r�r�Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsr�r�r�Z
build_tempr�Z
fixed_argsZlib_optsZldflagsZexport_optsZsymZld_argsZdll_nameZdll_extZimplib_filer�rrr�link�sl�
��

��
��
��zMSVCCompiler.linkcCsd|S)Nz	/LIBPATH:r�r*�dirrrr�library_dir_optionszMSVCCompiler.library_dir_optioncCstd��)Nz<don't know how to set runtime library search path for MSVC++)rr�rrr�runtime_library_dir_options�z'MSVCCompiler.runtime_library_dir_optioncCs
|�|�Sr')r�)r*r\rrr�library_options
zMSVCCompiler.library_optioncCs\|r	|d|g}n|g}|D]}|D]}tj�||�|��}tj�|�r*|SqqdS)NZ_d)rNr.rur��exists)r*�dirsr\r�Z	try_namesr�rZlibfilerrr�find_library_file#s��zMSVCCompiler.find_library_filecCs|	|jD]}tj�tj�|�|�}tj�|�r|Sqtjd�d�D]}tj�tj�|�|�}tj�|�r;|Sq$|S)NZPathr])rlrNr.rur��isfilermrE)r*Zexer2�fnrrrrn5s
��zMSVCCompiler.find_exe�x86cCs�	tsgS|d}|jdkrd|j|jf}nd|j|f}tD]$}t||�}|rD|jdkr;|j�||��d�S||�d�Sq |jdkratD]}t|d|j�dur`|�d�gSqLgS)	Nz dirsrTz6%s\%0.1f\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directoriesz?%s\6.0\Build System\Components\Platforms\Win32 (%s)\Directoriesr]r<z%s\6.0z�It seems you have Visual Studio 6 installed, but the expected registry settings are not present.
You must at least run the Visual Studio GUI once so that these entries are created.)	�
_can_read_regrUrWr-r rXr7rEr�)r*r.�platformrrrrrrrsKs4

��

�

�zMSVCCompiler.get_msvc_pathscCs<	|dkr|�d�}n|�|�}|rd�|�tj|<dSdS)Nr\Zlibraryr])rsrurNrm)r*rr2rrrrtos
�zMSVCCompiler.set_path_env_var)rrr)rr{)NNNrNNN)NrN)
NNNNNrNNNN)r)r�)r8r9r:Z
compiler_typeZexecutablesr�r�r�r�rr�r�Zstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionr,rzr�r�r�r�r�r�r�r�rnrsrtrrrrrR�sb��
B
� 
�X
�
�S

$rRg @z3Importing new compiler from distutils.msvc9compiler)rR)r&),rBrNZdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	r��winregZhkey_modZ	OpenKeyExrZEnumKeyrZ	EnumValuer�errorr
�ImportErrorZwin32apiZwin32con�infoZ
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINEZHKEY_CLASSES_ROOTr-rr rr&rIrMrQrRr�ZOldMSVCCompilerZdistutils.msvc9compilerrrrr�<module>sj



����	-

9
�

?>