????

Your IP : 3.142.172.36


Current Path : /lib/python3.10/distutils/__pycache__/
Upload File :
Current File : //lib/python3.10/distutils/__pycache__/msvc9compiler.cpython-310.pyc

o

��bc�v�@sLdZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlZejZejZejZejZejejejejfZej dkoWej!dkZ"e"rad	Z#d
Z$dZ%ndZ#d
Z$dZ%ddd�Z&Gdd�d�Z'Gdd�d�Z(dd�Z)dd�Z*dd�Z+dd�Z,d$dd�Z-e)�Z.e.d kr�ed!e.��Gd"d#�d#e�Z/dS)%adistutils.msvc9compiler

Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio 2008.

The module is compatible with VS 2005 and VS 2008. You can find legacy support
for older versions of VS in distutils.msvccompiler.
�N)�DistutilsExecError�DistutilsPlatformError�CompileError�LibError�	LinkError)�	CCompiler�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�x86�amd64�rz	win-amd64c@sPeZdZdZdd�Zee�Zdd�Zee�Zdd�Zee�Zdd	�Ze	e�Zd
S)�Regz2Helper class to read values from the registry
    cCs6tD]}|�||�}|r||vr||Sqt|���N)�HKEYS�read_values�KeyError)�cls�path�key�base�d�r�./usr/lib/python3.10/distutils/msvc9compiler.py�	get_value?s�z
Reg.get_valuecCsfzt||�}Wn
tyYdSwg}d}	zt||�}Wn
ty(Y|Sw|�|�|d7}q)zReturn list of registry keys.NrT�)�RegOpenKeyEx�RegError�
RegEnumKey�append)rrr�handle�L�i�krrr�	read_keysGs"��
�z
Reg.read_keysc	Cs~zt||�}Wn
tyYdSwi}d}	z
t||�\}}}Wn
ty+Y|Sw|��}|�|�||�|�<|d7}q)z`Return dict of registry keys and values.

        All names are converted to lowercase.
        NrTr)rr�RegEnumValue�lower�convert_mbcs)	rrrr!rr#�name�value�typerrrrYs$���zReg.read_valuescCs<t|dd�}|durz|d�}W|StyY|Sw|S)N�decode�mbcs)�getattr�UnicodeError)�s�decrrrr(os
��zReg.convert_mbcsN)
�__name__�
__module__�__qualname__�__doc__r�classmethodr%rr(�staticmethodrrrrr;src@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
MacroExpandercCsi|_t||_|�|�dSr)�macros�VS_BASE�vsbase�load_macros)�self�versionrrr�__init__{s
zMacroExpander.__init__cCst�||�|jd|<dS)Nz$(%s))rrr9)r=�macrorrrrr�	set_macro�szMacroExpander.set_macroc	Cs�|�d|jdd�|�d|jdd�|�dtd�z|dkr(|�d	td
�ntd
��Wnty8td��w|dkrN|�d
|jd�|�dtd�dSd}tD])}zt||�}Wn	tydYqRwt	|d�}t
�|d||f�}|d|jd<qRdS)N�VCInstallDirz	\Setup\VC�
productdir�VSInstallDirz	\Setup\VS�FrameworkDir�installroot� @�FrameworkSDKDirzsdkinstallrootv2.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"@�FrameworkVersionzclr version�
WindowsSdkDir�currentinstallfolderz.Software\Microsoft\NET Framework Setup\Productrz%s\%sr>z$(FrameworkVersion))
rAr;�NET_BASErr�WINSDK_BASErrrrrrr9)r=r>�pr�hrrrrrr<�s:�����
�zMacroExpander.load_macroscCs$|j��D]
\}}|�||�}q|Sr)r9�items�replace)r=r0r$�vrrr�sub�szMacroExpander.subN)r2r3r4r?rAr<rSrrrrr8ys
r8cCs�d}tj�|�}|dkrdS|t|�}tj|d��dd�\}}t|dd��d}|dkr3|d7}t|d	d
��d}|dkrCd}|dkrK||SdS)
z�Return the version of MSVC that was used to build Python.

    For Python 2.3 and up, the version number is included in
    sys.version.  For earlier versions, assume the compiler is MSVC 6.
    zMSC v.����N� r����
��g$@r)�sysr>�find�len�split�int)�prefixr#r0�rest�majorVersion�minorVersionrrr�get_build_version�srdcCs0g}|D]}tj�|�}||vr|�|�q|S)znReturn a list of normalized paths with duplicates removed.

    The current order of paths is maintained.
    )�osr�normpathr )�paths�
reduced_pathsrN�nprrr�normalize_and_reduce_paths�s
�rjcCs<|�tj�}g}|D]}||vr|�|�q
tj�|�}|S)z8Remove duplicate values of an environment variable.
    )r^re�pathsepr �join)�variable�oldList�newListr#�newVariablerrr�removeDuplicates�s
�rqcCst|}z
t�d|d�}Wntyt�d�d}Ynw|r'tj�|�sbd|}tj	�
|d�}|r[tj�|�r[tj�|tjtjd�}tj�
|�}tj�|�sZt�d|�dSnt�d|�|skt�d	�dStj�|d
�}tj�|�rz|St�d�dS)z�Find the vcvarsall.bat file

    At first it tries to find the productdir of VS 2008 in the registry. If
    that fails it falls back to the VS90COMNTOOLS env var.
    z%s\Setup\VCrCz%Unable to find productdir in registryNzVS%0.f0COMNTOOLS�VCz%s is not a valid directoryz Env var %s is not set or invalidzNo productdir foundz
vcvarsall.bat�Unable to find vcvarsall.bat)r:rrrr	�debugrer�isdir�environ�getrl�pardir�abspath�isfile)r>r;rC�toolskey�toolsdir�	vcvarsallrrr�find_vcvarsall�s8
�
��

r~cCsFt|�}hd�}i}|durtd��t�d||�tjd||ftjtjd�}z\|��\}}|��dkr;t|�	d���|�	d�}|�
d	�D]2}t�|�}d
|vrQqE|�
�}|�
d
d�\}	}
|	��}	|	|vrw|
�tj�rq|
dd�}
t|
�||	<qEW|j��|j��n|j��|j��wt|�t|�kr�ttt|������|S)
zDLaunch vcvarsall.bat and read the settings from its environment
    >�libr�include�libpathNrsz'Calling 'vcvarsall.bat %s' (version=%s)z
"%s" %s & set)�stdout�stderrrr-�
�=rrT)r~rr	rt�
subprocess�Popen�PIPE�communicate�waitr,r^rr(�stripr'�endswithrerkrqr��closer�r]�
ValueError�str�list�keys)r>�archr}�interesting�result�popenr�r��linerr*rrr�query_vcvarsall�sF�

��


�r�rGz(VC %0.1f is not supported by this modulec@s�eZdZdZdZiZdgZgd�ZdgZdgZ	eeee	Z
dZdZd	Z
d
ZdZZdZd,dd�Zd-dd�Z	
	d.dd�Z	
	d/dd�Z		
	d0dd�Z						
				d1dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd2d(d)�Zd*d+�ZdS)3�MSVCCompilerzwConcrete class that implements an interface to Microsoft Visual C++,
       as defined by the CCompiler abstract class.�msvcz.c)z.ccz.cppz.cxx�.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs8t�||||�t|_d|_g|_d|_d|_d|_dS)NzSoftware\Microsoft\VisualStudioF)	rr?�VERSION�_MSVCCompiler__version�_MSVCCompiler__root�_MSVCCompiler__paths�	plat_name�_MSVCCompiler__arch�initialized)r=�verbose�dry_run�forcerrrr?Hs
zMSVCCompiler.__init__NcCs�|jrJd��|durt�}d}||vrtd|f��dtjvr:dtjvr:|�d�r:d|_d|_d|_d	|_	d
|_
na|t�ksC|dkrHt|}ntt�dt|}tt
|�}|d
�tj�|_|dtjd<|dtjd<t|j�dkr}td|j��|�d�|_|�d�|_|�d�|_|�d	�|_	|�d
�|_
ztjd
�d�D]}|j�|�q�Wn	ty�Ynwt|j�|_d�|j�tjd
<d|_|jdkr�gd�|_gd�|_n
gd�|_gd�|_gd�|_|jdkr�gd�|_dg|_d|_dS)Nzdon't init multiple timesrz--plat-name must be one of %s�DISTUTILS_USE_SDK�MSSdkzcl.exezlink.exezlib.exezrc.exezmc.exer�_rrr�rzxPython was built with %s, and extensions need to be built with the same version of the compiler, but it isn't installed.�;r)�/nologo�/Ox�/MD�/W3�/DNDEBUG)r��/Od�/MDdr��/Z7�/D_DEBUG)r�r�r�r��/GS-r�)r�r�r�r�r�r�r�)�/DLLr�z/INCREMENTAL:NO�)r�r�z/INCREMENTAL:noz/DEBUGr�T)r�r
rrerv�find_exe�cc�linkerr�rc�mc�PLAT_TO_VCVARSr�r�r^rkr�r]�_MSVCCompiler__productr rrjrl�preprocess_optionsr��compile_options�compile_options_debug�ldflags_sharedr��ldflags_shared_debug�ldflags_static)r=r��ok_plats�	plat_spec�vc_envrNrrr�
initializeSsh�
�
���







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)rer�splitext�
splitdrive�isabs�src_extensionsr�basename�_rc_extensionsr rl�
res_extension�_mc_extensions�
obj_extension)r=�source_filenames�	strip_dir�
output_dir�	obj_names�src_namer�extrrr�object_filenames�s,

�
��zMSVCCompiler.object_filenamesc	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-rr�z"Don't know how to compile %s to %sz/Fo)r�r��_setup_compiler �extendr�r�rrerry�
_c_extensions�_cpp_extensionsr��spawnr�rrr��dirnamer�r�r�rlr�)r=�sourcesr�r9�include_dirsrt�
extra_preargs�extra_postargs�depends�compile_info�objects�pp_opts�build�compile_opts�obj�srcr��	input_opt�
output_opt�msg�h_dir�rc_dirrr��rc_filerrr�compile�s�
�
�




�
���


��
�
�����
���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))r�r��_fix_object_args�library_filename�
_need_linkr�rrrr	rt)	r=r��output_libnamer�rt�target_lang�output_filename�lib_argsr�rrr�create_static_libs"���zMSVCCompiler.create_static_libc
Cs<|js|��|�||�\}}|�|||�}|\}}}|r&|�dt|��t||||�}|dur8tj�	||�}|�
||��r|tjkrV|	rN|j
dd�}n|jdd�}n	|	r\|j
}n|j}g}|pdgD]	}|�d|�qe||||d|g}tj�|d�}|dur�tj�tj�|��\}}tj�	||�|��}|�d|�|�|||�|
r�|
|dd�<|r�|�|�|�tj�|��z|�|jg|�Wnty�}zt|��d}~ww|�||�}|du�r|\}}d||f}z
|�dd	d
||g�WdSt�y}zt|��d}~wwdSt�d|�dS)Nz5I don't know what to do with 'runtime_library_dirs': rz/EXPORT:r�rz/IMPLIB:z-outputresource:%s;%szmt.exez-nologoz	-manifestr�)r�r�r��
_fix_lib_args�warnr�rrerrlr�r�
EXECUTABLEr�r�r r�r�r�r��manifest_setup_ldargsr��mkpathr�r�rr�manifest_get_embed_infor	rt)r=�target_descr�r�r��	libraries�library_dirs�runtime_library_dirs�export_symbolsrtr�r��
build_tempr��
fixed_args�lib_opts�ldflags�export_opts�sym�ld_args�dll_name�dll_ext�implib_filer��mfinfo�
mffilename�mfid�out_argrrr�link5s��
��

��
��
��

����	zMSVCCompiler.linkcCs,tj�|tj�|�d�}|�d|�dS)Nz	.manifest�/MANIFESTFILE:)rerrlr�r )r=r�rr�
temp_manifestrrrr��s
�z"MSVCCompiler.manifest_setup_ldargscCs^|D]}|�d�r|�dd�d}nqdS|tjkrd}nd}|�|�}|dur+dS||fS)Nr�:rrY)�
startswithr^rr��_remove_visual_c_ref)r=rr�argrrrrrr��s
�

z$MSVCCompiler.manifest_get_embed_infocCs�zUt|�}z
|��}W|��n|��wt�dtj�}t�|d|�}d}t�|d|�}t�dtj�}t�||�dur>WdSt|d�}z
|�|�|W|��WS|��wt	y_YdSw)NzU<assemblyIdentity.*?name=("|')Microsoft\.VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)r�z*<dependentAssembly>\s*</dependentAssembly>zI<assemblyIdentity.*?name=(?:"|')(.+?)(?:"|').*?(?:/>|</assemblyIdentity>)�w)
�open�readr��rer��DOTALLrS�search�write�OSError)r=�
manifest_file�
manifest_f�manifest_buf�patternrrrr�s4	
��

�z!MSVCCompiler._remove_visual_c_refcCsd|S)Nz	/LIBPATH:r�r=�dirrrr�library_dir_option�szMSVCCompiler.library_dir_optioncCstd��)Nz<don't know how to set runtime library search path for MSVC++)rr&rrr�runtime_library_dir_option�s�z'MSVCCompiler.runtime_library_dir_optioncCs
|�|�Sr)r�)r=rrrr�library_option�s
zMSVCCompiler.library_optioncCs\|r	|d|g}n|g}|D]}|D]}tj�||�|��}tj�|�r*|SqqdS)N�_d)rerrlr��exists)r=�dirsrrt�	try_namesr'r)�libfilerrr�find_library_file�s��zMSVCCompiler.find_library_filecCsz|jD]}tj�tj�|�|�}tj�|�r|Sqtjd�d�D]}tj�tj�|�|�}tj�|�r:|Sq#|S)a�Return 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'.
        �Pathr�)r�rerrlryrzrvr^)r=�exerN�fnrrrr�s
	��zMSVCCompiler.find_exe)rrrr)rr�)NNNrNNN)NrN)
NNNNNrNNNN)r) r2r3r4r5�
compiler_type�executablesr�r�r�r�r�r�r��static_lib_extension�shared_lib_extension�static_lib_format�shared_lib_format�
exe_extensionr?r�r�r�r�rr�r�rr(r)r*r0r�rrrrr�*sd��

W
� 
�X
�
�_+
r�)r)0r5rer�r[r�distutils.errorsrrrrr�distutils.ccompilerrr�	distutilsr	�distutils.utilr
�winreg�	OpenKeyExr�EnumKeyr�	EnumValuer&�errorr�
HKEY_USERS�HKEY_CURRENT_USER�HKEY_LOCAL_MACHINE�HKEY_CLASSES_ROOTr�platform�maxsize�NATIVE_WIN64r:rMrLr�rr8rdrjrqr~r�r�r�rrrr�<module>sR��>.
#)

Page not found | The NCLEX Doctor

Page not found!

Sorry, this page is not available...