OwlCyberSecurity - MANAGER
Edit File: _msvccompiler.cpython-310.opt-1.pyc
o ����S�g'N����������������������@���s����d�Z�ddlZddlZddlZddlmZmZmZmZm Z �ddl mZmZ�ddl mZ�ddlmZ�ddlmZ�dd ��Zd d��Zdd ddd�Zdd��Zdd��Zddd�Zddddd�ZG�dd��de�ZdS�)a��distutils._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)�countc������������������C���s ��zt�jt�jdt�jt�jB�d�}�W�n�ty���t�d��Y�dS�w�d}d�}|��_�t��D�]F}zt�� |�|�\}}}W�n �ty@���Y��n:w�|ro|t�j krotj� |�roztt|��}W�n�ttfya���Y�q)w�|dkro||kro||}}q)W�d�����||fS�W�d�����||fS�1�s�w���Y��||fS�)Nz'Software\Microsoft\VisualStudio\SxS\VC7)�accesszVisual C++ is not registered�NNr�������)�winregZ OpenKeyEx�HKEY_LOCAL_MACHINEZKEY_READZKEY_WOW64_32KEY�OSErrorr ����debugr���Z EnumValueZREG_SZ�os�path�isdir�int�float� ValueError� TypeError)�key�best_version�best_dir�i�vZvc_dirZvt�version��r ����>/opt/alt/python310/lib64/python3.10/distutils/_msvccompiler.py�_find_vc2015���sH��� � � �� �� � � � � r"���c��������������� ���C���s����t�j�d�pt�j�d�}�|�sdS�ztjt�j�|�ddd�ddd d ddd dg ddd����}W�n�tjt t fy:���Y�dS�w�t�j�|ddd�}t�j�|�rNd|fS�dS�)aJ��Returns "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. zProgramFiles(x86)ZProgramFilesr ���zMicrosoft Visual StudioZ Installerzvswhere.exez-latestz-prereleasez -requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z -propertyZinstallationPathz -products�*�mbcs�strict)�encoding�errorsZVCZ AuxiliaryZBuild����)r����environ�get� subprocess�check_outputr����join�strip�CalledProcessErrorr����UnicodeDecodeErrorr���)�rootr���r ���r ���r!����_find_vc20178���s.��� ����r2����x86Zx64ZarmZarm64)r3���� x86_amd64�x86_arm� x86_arm64c�����������������C���s\���t���\}}|st��\}}|st�d��dS�tj�|d�}tj�|�s*t�d|��dS�|d�fS�)Nz$No suitable Visual C++ version foundr ���z vcvarsall.batz%s cannot be found)r2���r"���r ���r���r���r���r-����isfile)� plat_spec�_r���r���� vcvarsallr ���r ���r!����_find_vcvarsall_���s��� r;���c�������������� ���C���s����t��d�rdd��t�j���D��S�t|��\}}|std��ztjd�||��tj d�j ddd �}W�n�tjyI�}�zt� |j��td �|j���d�}~ww�dd��dd ��|���D��D��}|S�)NZDISTUTILS_USE_SDKc�����������������S���s���i�|�] \}}|����|�qS�r �����lower)�.0r����valuer ���r ���r!���� <dictcomp>s���s������z_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)�stderrzutf-16le�replace)r'���zError executing {}c�����������������S���s$���i�|�]\}}}|r|r|����|�qS�r ���r<���)r>���r���r9���r?���r ���r ���r!���r@�������s�������c�����������������s���s�����|�]}|��d��V��qdS�)�=N)� partition)r>����liner ���r ���r!���� <genexpr>����s�����z_get_vc_env.<locals>.<genexpr>)r����getenvr)����itemsr;���r���r+���r,����formatZSTDOUT�decoder/���r ����error�output�cmd� splitlines)r8���r:���r9����out�exc�envr ���r ���r!����_get_vc_envq���s2��� � � �����rR���c�����������������C���sN���|st��d��t�j�}|D�]}t�j�t�j�|�|��}t�j�|�r$|��S�q |�S�)at��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'. r���)r���rG����split�pathsepr���r-����abspathr7���)Zexe�paths�p�fnr ���r ���r!���� _find_exe����s��� �rY���r4���r5���r6���)Zwin32z win-amd64z win-arm32z win-arm64c�����������������������s����e�Zd�ZdZdZi�ZdgZg�d�ZdgZdgZ ee�e�e �Z dZdZd Z d Zd�ZZdZd&dd�Zd'dd�Z d(dd�Z d)dd�Z d*dd�Z d+dd�Z��fdd�Zdd��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.c)z.ccz.cppz.cxx�.rcz.mcz.resz.objz.libz.dllz%s%sz.exer���c�����������������C���s ���t��|�|||��d�|�_d|�_d�S�)NF)r����__init__� plat_name�initialized)�self�verboseZdry_runZforcer ���r ���r!���r\�������s��� zMSVCCompiler.__init__Nc�����������������C���s ��|d�u�rt���}|tvrtd�tt����t|�}t|�}|s"td��|�dd�|�_|�j�t j �}td|�|�_td|�|�_ td|�|�_td|�|�_td |�|�_td |�|�_|�dd��t j �D�] }|rk|��|�t j���q^|�dd��t j �D�] }|r�|��|�t j���qvd�|�_g�d �|�_g�d�|�_g�d�}g�d�}g�|�d�|�_g�|�d�|�_g�|�d�d�d�|�_g�|�d�d�d�|�_g�|�|�_g�|�|�_tj d�f|�jtj df|�jtj df|�jtj!d�f|�jtj!df|�jtj!df|�jtj"d�f|�jtj"df|�jtj"df|�ji |�_#d|�_$d�S�)Nz--plat-name must be one of {}z7Unable to find a compatible Visual Studio installation.r�����zcl.exezlink.exezlib.exezrc.exezmc.exezmt.exeZinclude�lib)�/nologoz/Ox�/W3z/GLz/DNDEBUGz/MD)rc���z/Odz/MDdz/Zird���z/D_DEBUG)rc����/INCREMENTAL:NO�/LTCG)rc���re���rf���z/DEBUG:FULLz/MANIFEST:EMBED,ID=1z/DLLz/MANIFEST:EMBED,ID=2z/MANIFESTUAC:NOFT)%r ����PLAT_TO_VCVARSr���rI����tuplerR���r*����_pathsrS���r���rT���rY����cc�linkerrb����rc�mcZmtZadd_include_dir�rstrip�sepZadd_library_dirZpreprocess_options�compile_options�compile_options_debugZldflags_exeZldflags_exe_debugZldflags_sharedZldflags_shared_debugZldflags_staticZldflags_static_debugr���Z EXECUTABLEZ SHARED_OBJECTZSHARED_LIBRARY�_ldflagsr^���)r_���r]���r8���Zvc_envrV����dir�ldflagsZ ldflags_debugr ���r ���r!���� initialize����s`��� ��� � zMSVCCompiler.initializera���c��������������������sX���i��fdd��j�D����fdd��j�j�D������pd�����fdd�}tt||��S�)Nc������������������������i�|�]}|��j��qS�r ���)� obj_extension�r>����ext�r_���r ���r!���r@���"�������z1MSVCCompiler.object_filenames.<locals>.<dictcomp>c��������������������rv���r ���)� res_extensionrx���rz���r ���r!���r@���#��r{���ra���c��������������������s����t�j�|��\}}�rt�j�|�}nt�j�|�\}}|�t�jjt�jjf�r*|dd���}zt�j��|��|���W�S��t yD���t d�|����w�)N����zDon't know how to compile {})r���r����splitext�basename� splitdrive� startswithro����altsepr-����LookupErrorr���rI���)rW����basery���r9���)�ext_map� output_dir� strip_dirr ���r!���� make_out_path(��s����z4MSVCCompiler.object_filenames.<locals>.make_out_path)�src_extensions�_rc_extensions�_mc_extensions�list�map)r_���Zsource_filenamesr����r����r����r ���)r����r����r_���r����r!����object_filenames��s�����zMSVCCompiler.object_filenamesc �����������������C���sL��|�j�s|�����|��||||||�} | \}} }}}|pg�} | �d��|r*| �|�j��n| �|�j��d}| D�]�}z||�\}}W�n �tyG���Y�q4w�|rPtj � |�}||�jv�rZd|�}n�||�jv�rfd|�}d}n�||�j v�r�|}d|�}z|��|�jg|�||g���W�n�ty��}�zt|��d�}~ww�q4||�jv�r�tj �|�}tj �|�}z.|��|�jd|d||g��tj �tj �|��\}}tj �||d ��}|��|�jd|�|g��W�n�ty��}�zt|��d�}~ww�q4td �||���|�jg| �|�}|r�|�d��|�|��|�d|���|�|��z|��|��W�q4�t�y#�}�zt|��d�}~ww�| S�) Nz/cFz/Tcz/TpTz/foz-hz-rr[���z"Don't know how to compile {} to {}z/EHscz/Fo)r^���ru���Z_setup_compile�append�extendrq���rp����KeyErrorr���r���rU���� _c_extensions�_cpp_extensionsr�����spawnrl���r���r���r�����dirnamerm���r~���r���r-���rI���rj���)r_���Zsourcesr����ZmacrosZinclude_dirsr���� extra_preargs�extra_postargsZdependsZcompile_info�objectsZpp_optsZbuildZcompile_optsZadd_cpp_opts�obj�srcry���Z input_optZ output_opt�msgZh_dirZrc_dirr����r9���Zrc_file�argsr ���r ���r!����compile>��s���� � � �� ��� ��zMSVCCompiler.compilec����������� ��� ���C���s����|�j�s|�����|��||�\}}|�j||d�}|��||�rN|d|�g�}|r& �zt�d|�jd�|���|�� |�jg|���W�d�S��t yM�}�zt|��d�}~ww�t�d|��d�S�)N)r�����/OUT:�Executing "%s" %s� �skipping %s (up-to-date))r^���ru����_fix_object_args�library_filename� _need_linkr ���r���rb���r-���r����r���r���) r_���r����Zoutput_libnamer����r����target_lang�output_filenameZlib_argsr����r ���r ���r!����create_static_lib���s$������zMSVCCompiler.create_static_libc�������������� ���C���s���|�j�s|�����|��||�\}}|��|||�}|\}}}|r&|��dt|����t|�|||�}|d�ur8tj� ||�}|�� ||�r�|�j|| f�}dd��|pKg�D��}||�|�|�d|�g�}tj�|d��}|d�ur�tj� tj�|��\}}tj� ||��|��}|�d|���| r�| |d�d�<�|r�|�|��tj�tj�|��}|��|��zt�d|�jd� |���|��|�jg|���W�d�S��ty��}�zt|��d�}~ww�t�d |��d�S�) Nz5I don't know what to do with 'runtime_library_dirs': c�����������������S���s���g�|�]}d�|��qS�)z/EXPORT:r ���)r>���Zsymr ���r ���r!���� <listcomp>���r{���z%MSVCCompiler.link.<locals>.<listcomp>r����r���z/IMPLIB:r����r����r����)r^���ru���r����Z _fix_lib_args�warn�strr���r���r���r-���r����rr���r����r~���r���r����r����r����rU���Zmkpathr ���r���rk���r����r���r���)r_���Ztarget_descr����r����r����Z librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsr���r����r����Z build_tempr����Z fixed_argsZlib_optsrt���Zexport_optsZld_argsZdll_nameZdll_extZimplib_filer����r ���r ���r!����link���sb���� �� �� �� ��zMSVCCompiler.linkc�������������� ������s<���t��d�}z|�jt�jd<�t���|�W�|t�jd<�S�|t�jd<�w�)Nr���)r���rG���ri���r)����superr����)r_���rM���Zold_path�� __class__r ���r!���r�������s ��� zMSVCCompiler.spawnc�����������������C���s���d|�S�)Nz /LIBPATH:r ����r_���rs���r ���r ���r!����library_dir_option��s���zMSVCCompiler.library_dir_optionc�����������������C���s���t�d��)Nz:don't know how to set runtime library search path for MSVC)r���r����r ���r ���r!����runtime_library_dir_option��s����z'MSVCCompiler.runtime_library_dir_optionc�����������������C���s ���|���|�S��N)r����)r_���rb���r ���r ���r!����library_option ��s��� zMSVCCompiler.library_optionc�����������������C���s\���|r |d�|g}n|g}|D�]}|D�]}t�j�||��|��}t�j�|�r*|����S�qqd�S�)NZ_d)r���r���r-���r����r7���)r_����dirsrb���r���Z try_namesrs����nameZlibfiler ���r ���r!����find_library_file ��s�����zMSVCCompiler.find_library_file)r���r���r���r����)r���ra���)NNNr���NNN)Nr���N) NNNNNr���NNNN)r���)�__name__� __module__�__qualname__�__doc__Z compiler_typeZexecutablesr����r����r����r����r����r|���rw���Zstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr\���ru���r����r����r����r����r����r����r����r����r����� __classcell__r ���r ���r����r!���rZ�������s^������ P �" �] � �ErZ���r����)r����r���r+���r���Zdistutils.errorsr���r���r���r���r���Zdistutils.ccompilerr���r���Z distutilsr ���Zdistutils.utilr ���� itertoolsr���r"���r2���ZPLAT_SPEC_TO_RUNTIMEr;���rR���rY���rg���rZ���r ���r ���r ���r!����<module>���s2����!� �