관리-도구
편집 파일: MSVSVersion.cpython-36.pyc
3 w�peM � @ s� d Z ddlZddlZddlZddlZddlZddlZdd� ZG dd� d�Zdd� Z dd d �Z dd� Zd d� Zddd�Z dd� Zdd� Zddd�ZdS )z3Handle version information related to Visual Stuio.� Nc G s t jjt jj| � �S )N)�os�path�normpath�join)�args� r �/MSVSVersion.py�JoinPath s r c @ sz e Zd ZdZddd�Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� ZdS )�VisualStudioVersionz1Information regarding a version of Visual Studio.Nc C sZ || _ || _|| _|| _|| _|| _|| _|| _| | _| p<g } | j dd� dd� | | _ d S )Nc S s t | jdd��S )N�v� )�float�replace)r r r r �<lambda>- s z.VisualStudioVersion.__init__.<locals>.<lambda>T)�key�reverse)� short_name�description�solution_version�project_version�flat_sln�uses_vcxprojr � sdk_based�default_toolset�sort�compatible_sdks)�selfr r r r r r r r r r r r r �__init__ s zVisualStudioVersion.__init__c C s | j S )N)r )r r r r � ShortName0 s zVisualStudioVersion.ShortNamec C s | j S )z(Get the full description of the version.)r )r r r r �Description3 s zVisualStudioVersion.Descriptionc C s | j S )z(Get the version number of the sln files.)r )r r r r �SolutionVersion7 s z#VisualStudioVersion.SolutionVersionc C s | j S )z6Get the version number of the vcproj or vcxproj files.)r )r r r r �ProjectVersion; s z"VisualStudioVersion.ProjectVersionc C s | j S )N)r )r r r r �FlatSolution? s z VisualStudioVersion.FlatSolutionc C s | j S )z1Returns true if this version uses a vcxproj file.)r )r r r r �UsesVcxprojB s zVisualStudioVersion.UsesVcxprojc C s | j r dpdS )z+Returns the file extension for the project.z.vcxprojz.vcproj)r )r r r r �ProjectExtensionF s z$VisualStudioVersion.ProjectExtensionc C s | j S )z/Returns the path to Visual Studio installation.)r )r r r r �PathJ s zVisualStudioVersion.Pathc C s t jjt jj| jd|��S )z+Returns the path to a given compiler tool. zVC/bin)r r r r )r Ztoolr r r �ToolPathN s zVisualStudioVersion.ToolPathc C s | j S )z\Returns the msbuild toolset version that will be used in the absence of a user override.)r )r r r r �DefaultToolsetR s z"VisualStudioVersion.DefaultToolsetc C sJ |dkst d��tjjdd�}t|dd�}| jrL|rLtjj|�rL|d| gS tjjd �d kpjtjjd�d k}| jdkr�t| jd ddd�}|r�dnd}|dkr�dnd}|}||kr�|d| 7 }||gS t| jd d�} |dk�r| jdko�| jd dko�|�r| dgS t| jddd�gS n0|dk�rFd}| jd dk�r>|�r>d}| |gS dS )zLReturns a command (with arguments) to be used to set up the environment.�x86�x64ztarget_arch not supportedZ WindowsSDKDirr ZBinz SetEnv.Cmd�/ZPROCESSOR_ARCHITECTUREZAMD64ZPROCESSOR_ARCHITEW6432�2017ZVCZ AuxiliaryZBuildz vcvarsall.bat�amd64�_�2013� �eZ amd64_x86ZCommon7ZToolszvsvars32.batZ x86_amd64N)r( r) ���r1 ) �AssertionErrorr �environ�getr r r �existsr ) r �target_archZsdk_dirZ setup_pathZis_host_arch_x64�script_pathZ host_archZmsvc_target_arch�argZ vcvarsallr r r �_SetupScriptInternalW s8 z(VisualStudioVersion._SetupScriptInternalc C s. | j |�}|d }tjj|�s*td| ��|S )Nr z3%s is missing - make sure VC++ tools are installed.)r9 r r r5 � Exception)r r6 Zscript_datar7 r r r �SetupScript� s zVisualStudioVersion.SetupScript)NN)�__name__� __module__�__qualname__�__doc__r r r r r! r"