HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //lib/python3.6/site-packages/gyp/__pycache__/MSVSVersion.cpython-36.pyc
3

��S]M�@s�dZddlZddlZddlZddlZddlZddlZddlZdd�ZGdd�de	�Z
dd�Zdd	d
�Zdd�Z
d
d�Zddd�Zdd�Zdd�Zddd�ZdS)z3Handle version information related to Visual Stuio.�NcGstjjtjj|��S)N)�os�path�normpath�join)�args�r�!/usr/lib/python3.6/MSVSVersion.py�JoinPathsr	c@szeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�VisualStudioVersionz1Information regarding a version of Visual Studio.NcCsZ||_||_||_||_||_||_||_||_|	|_|
p<g}
|
j	dd�dd�|
|_
dS)NcSst|jdd��S)N�v�)�float�replace)rrrr�<lambda>$sz.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)�selfrrrrrrrrrrrrr�__init__szVisualStudioVersion.__init__cCs|jS)N)r)rrrr�	ShortName'szVisualStudioVersion.ShortNamecCs|jS)z(Get the full description of the version.)r)rrrr�Description*szVisualStudioVersion.DescriptioncCs|jS)z(Get the version number of the sln files.)r)rrrr�SolutionVersion.sz#VisualStudioVersion.SolutionVersioncCs|jS)z6Get the version number of the vcproj or vcxproj files.)r)rrrr�ProjectVersion2sz"VisualStudioVersion.ProjectVersioncCs|jS)N)r)rrrr�FlatSolution6sz VisualStudioVersion.FlatSolutioncCs|jS)z1Returns true if this version uses a vcxproj file.)r)rrrr�UsesVcxproj9szVisualStudioVersion.UsesVcxprojcCs|jr
dpdS)z+Returns the file extension for the project.z.vcxprojz.vcproj)r)rrrr�ProjectExtension=sz$VisualStudioVersion.ProjectExtensioncCs|jS)z/Returns the path to Visual Studio installation.)r)rrrr�PathAszVisualStudioVersion.PathcCstjjtjj|jd|��S)z+Returns the path to a given compiler tool. zVC/bin)rrrr)rZtoolrrr�ToolPathEszVisualStudioVersion.ToolPathcCs|jS)z\Returns the msbuild toolset version that will be used in the absence
    of a user override.)r)rrrr�DefaultToolsetIsz"VisualStudioVersion.DefaultToolsetc
CsJ|dkstd��tjjdd�}t|dd�}|jrL|rLtjj|�rL|d|gStjjd	�d
kpjtjjd�d
k}|jdkr�t|jd
ddd�}|r�dnd}|dkr�dnd}|}||kr�|d|7}||gSt|jd
d�}	|dk�r|jdko�|jddko�|�r|	dgSt|jddd�gSn0|dk�rFd}|jddk�r>|�r>d}|	|gSdS)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_x86ZCommon7ZToolszvsvars32.batZ	x86_amd64N)r(r)���r1)	�AssertionErrorr�environ�getr	rr�existsr)
r�target_archZsdk_dirZ
setup_pathZis_host_arch_x64�script_pathZ	host_archZmsvc_target_arch�argZ	vcvarsallrrr�_SetupScriptInternalOs6


z(VisualStudioVersion._SetupScriptInternalcCs.|j|�}|d}tjj|�s*td|��|S)Nrz3%s is missing - make sure VC++ tools are installed.)r9rrr5�	Exception)rr6Zscript_datar7rrr�SetupScript�s
zVisualStudioVersion.SetupScript)NN)�__name__�
__module__�__qualname__�__doc__rrrr r!r"r#r$r%r&r'r9r;rrrrr
s
5r
cCsntjdkrdStjjtjjdd�|d�d|g}|r@|jd|g�tj	|tj
tj
d	�}|j�d
}|jrjdS|S)a�Use reg.exe to read a particular key.

  While ideally we might use the win32 module, we would like gyp to be
  python neutral, so for instance cygwin python lacks this module.

  Arguments:
    sysdir: The system subdirectory to attempt to launch reg.exe from.
    key: The registry key to read from.
    value: The particular value to read.
  Return:
    stdout from reg.exe, or None for failure.
  �win32�cygwinNZWINDIRrzreg.exeZqueryz/v)�stdout�stderrr)r@rA)
�sys�platformrrrr3r4�extend�
subprocess�Popen�PIPE�communicate�
returncode)Zsysdirr�value�cmd�p�textrrr�_RegistryQueryBase�s
rPcCsXd}ytd||�}Wn>tk
rR}z"|jtjkr@td||�}n�WYdd}~XnX|S)a�Use reg.exe to read a particular key through _RegistryQueryBase.

  First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If
  that fails, it falls back to System32.  Sysnative is available on Vista and
  up and available on Windows Server 2003 and XP through KB patch 942589. Note
  that Sysnative will always fail if using 64-bit python due to it being a
  virtual directory and System32 will work correctly in the first place.

  KB 942589 - http://support.microsoft.com/kb/942589/en-us.

  Arguments:
    key: The registry key.
    value: The particular registry value to read (optional).
  Return:
    stdout from reg.exe, or None for failure.
  NZ	SysnativeZSystem32)rP�OSError�errno�ENOENT)rrLrOr0rrr�_RegistryQuery�srTcCs�yddl}Wntk
r(ddl}YnXyF|jdd�\}}|dksHt�|j|j|��}|j||�dSQRXWntk
r�dSXdS)aUse the _winreg module to obtain the value of a registry key.

  Args:
    key: The registry key.
    value: The particular registry value to read.
  Return:
    contents of the registry key's value, or None on failure.  Throws
    ImportError if _winreg is unavailable.
  rN�\r/ZHKLM)	�_winreg�ImportError�winreg�splitr2�OpenKey�HKEY_LOCAL_MACHINEZQueryValueExZWindowsError)rrLrX�rootZsubkey�hkeyrrr�_RegistryGetValueUsingWinReg�s
r^cCsPy
t||�Stk
rYnXt||�}|s2dStjd|�}|sFdS|jd�S)a�Use _winreg or reg.exe to obtain the value of a registry key.

  Using _winreg is preferable because it solves an issue on some corporate
  environments where access to reg.exe is locked down. However, we still need
  to fallback to reg.exe for the case where the _winreg module is not available
  (for example in cygwin python).

  Args:
    key: The registry key.
    value: The particular registry value to read.
  Return:
    contents of the registry key's value, or None on failure.
  NzREG_\w+\s+([^\r]+)\r\nr/)r^rWrT�re�search�group)rrLrO�matchrrr�_RegistryGetValue�s

rcFcCsZ|rtjj|�}tdddddd||ddd	gd
�
tdddddd||ddd	gd
�
td
ddddd||dd�	tdddddd||dd�	tdddddd||dd�	tdddddd||dd�	tdddddd||dd�	tdddddd||d �td!d"dddd||d �td#d$d%d&dd||d �td'd$d%d&dd||d �td(d)d&d*dd||d �td+d)d&d*dd||d �d,�
}|t|�S)-aSets up MSVS project generation.

  Setup is based off the GYP_MSVS_VERSION environment variable or whatever is
  autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is
  passed in that doesn't match a value in versions python will throw a error.
  �2019zVisual Studio 2019z12.00z15.0FTZv141zv8.1zv10.0)rrrrrrrrr+zVisual Studio 2017�2015zVisual Studio 2015z14.0Zv140)rrrrrrrr.zVisual Studio 2013z13.00z12.0Zv120�2013e�2012zVisual Studio 2012z4.0Zv110�2012e�2010zVisual Studio 2010z11.00)rrrrrr�2010ezVisual C++ Express 2010�2008zVisual Studio 2008z10.00z9.00�2008e�2005zVisual Studio 2005z8.00�2005e)
rdr+rer.rfrgrhrirjrkrlrmrn)rrrr
�str)�namerr�versionsrrr�_CreateVersion�s�

rrcCs2tjdkr.tjd|gtjd�}|j�dj�}|S)z.Convert to cygwin path if we are using cygwin.rAZcygpath)rBr)rDrErGrHrIrJ�strip)rrNrrr�_ConvertToCygpath|s
rtc
	Cs�dddddddd�}g}�xx|D�]n}d	|d
|d|d|g}x�tt|��D]�}t||d
�}|shqPt|�}tjj|d�}tjj|d�}	|r�tjj|�r�|jt	||tjj|dd���qPt
j
|	�rP|jt	||dtjj|dd���qPWddddg}x�tt|��D]�}t|||�}|�s(�qt|�}|dk�rZtjj|��r�|jt	d|��n0|dk�r|jt	||dtjj|d�dd���qWq W|S)aXCollect the list of installed visual studio versions.

  Returns:
    A list of visual studio versions installed in descending order of
    usage preference.
    Base this on the registry and a quick check if devenv.exe exists.
    Possibilities are:
      2005(e) - Visual Studio 2005 (8)
      2008(e) - Visual Studio 2008 (9)
      2010(e) - Visual Studio 2010 (10)
      2012(e) - Visual Studio 2012 (11)
      2013(e) - Visual Studio 2013 (12)
      2015    - Visual Studio 2015 (14)
      2017    - Visual Studio 2017 (15)
    Where (e) is e for express editions of MSVS and blank otherwise.
  rmrkrirgr.rer+)z8.0z9.0z10.0z11.0z12.0z14.0z15.0z'HKLM\Software\Microsoft\VisualStudio\%sz3HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%sz$HKLM\Software\Microsoft\VCExpress\%sz0HKLM\Software\Wow6432Node\Microsoft\VCExpress\%sZ
InstallDirz
devenv.exez*express.exez..r0z,HKLM\Software\Microsoft\VisualStudio\SxS\VC7z8HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7z,HKLM\Software\Microsoft\VisualStudio\SxS\VS7z8HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VS7z15.0z14.0T)r)�range�lenrcrtrrrr5�appendrr�glob)
Zversions_to_checkZ
force_expressZversion_to_yearrq�version�keys�indexr�	full_pathZexpress_pathrrr�_DetectVisualStudioVersions�sT



 r}�autoTcCs�|dkrtjjdd�}ddddddddddddd d
�
}tjjd�}|rltjjd�}|s^td��t||d
d�St|�}t||d|k�}|s�|s�td��|dkr�tdd�St|d�S|dS)!z�Select which version of Visual Studio projects to generate.

  Arguments:
    version: Hook to allow caller to force a particular version (vs auto).
  Returns:
    An object representing a visual studio project format version.
  r~ZGYP_MSVS_VERSION�15.0�14.0�12.0�10.0�9.0�8.0�11.0)
r~rmrnrkrlrirjrgrhr.rfrer+ZGYP_MSVS_OVERRIDE_PATHz`GYP_MSVS_OVERRIDE_PATH requires GYP_MSVS_VERSION to be set to a particular version (e.g. 2010e).T)rr0z,Could not locate Visual Studio installation.rmNr)rr�r�r�r�r�r�)r�)r�)r�)r�)r�)r�)r�)r�)r�)r�)r�)r)rr3r4�
ValueErrorrrror})ryZallow_fallbackZversion_mapZ
override_pathZmsvs_versionrqrrr�SelectVisualStudioVersion�s<	

r�)N)F)r~T)r?rRrr_rGrDZgyprxr	�objectr
rPrTr^rcrrrtr}r�rrrr�<module>s"y

I