a �DOg��� @s�dZdZdZddlZddlZddlZddlZddlZddlZddl Z ddddddd d d d d � Z e� d �Z d d�Z e� dej�Zd}dd�Zd~dd�Ze� d�Zddd�Zddddddd d!d"d#d$d%� Zdd&d'd(d)d*d+�Zd,d-�Zd.d/�Zd�d0d1�Zd2d3�Zd�d5d6�Zd7d8�Zd�d9d:�Zd;d<�Zd=d>�Zd�d?d@�ZdAdB�Z d�dCdD�Z!dEdFdGd�Z"ej#ddfdHdI�Z$dJdK�Z%GdLdM�dM�Z&dNdO�Z'GdPdQ�dQe�(dRdS��Z)da*dTdU�Z+dVdW�Z,dXdY�Z-dZd[�Z.d\d]�Z/d^d_�Z0d`da�Z1e� dbej�Z2e� dcej�Z3e� dd�Z4e� de�Z5iZ6d�dfdg�Z7dhdi�Z8djdk�Z9dldm�Z:dndo�Z;dpdq�ZiZ?d�dvdw�Z@eAdxk�r�dyejBv�ppdzejBvZCd{ejBv�o�d|ejBvZDeEe@eDeC��e�Fd�dS)�a8 This module tries to retrieve as much platform-identifying data as possible. It makes this information available via function APIs. If called from the command line, it prints the platform information concatenated as single string to stdout. The output format is useable as part of a filename. a Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee or royalty is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation or portions thereof, including modifications, that you make. EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! z1.0.8�N� ���(�2��) �dev�alpha�a�beta�b�cZRC�rc�pl�pz([0-9]+|[._+-])c Cs`g}t�|�D]L}|dvrzt|d�}d}WntyJt�|d�}Yn0|�||f�q|S)Nz._+-r�dr)� _component_re�split�int� ValueError� _ver_stages�get�extend)�version�result�v�t�r� /usr/lib64/python3.9/platform.py�_comparable_version�s  rsC(__libc_init)|(GLIBC_([0-9.]+))|(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)��@c Cs|durXz0t�d�}|jdd�}t|�dkr6t|�WSWntttfyPYn0tj }t }t tj d�rttj � |�}t|d���j}|�|�}d} | t|�k�r�d |vs�d |vr�t�|| �} nd} | r�| ��t|�k�r|�|�} | �r |t| t|�d �d�| }d} q�| �s�q�d d �| ��D�\} } }}}}| �rD|�sDd}n�| �rv|dk�r^d}|}n||�||�k�r�|}n\|�r�|dk�r�d}|�r�|�r�||�||�k�r�|}|�r�|t|� d�|k�r�||}| ��} q�Wd�n1�s�0Y||fS)a Tries to determine the libc version that the file executable (which defaults to the Python interpreter) is linked against. Returns a tuple of strings (lib,version) which default to the given parameters in case the lookup fails. Note that the function has intimate knowledge of how different libc versions add symbols to the executable and thus is probably only useable for executables compiled using gcc. The file is read and scanned in chunks of chunksize bytes. N�CS_GNU_LIBC_VERSION�)�maxsplit��realpath�rbrslibcsGLIBCi�cSs"g|]}|dur|�d�n|�qS)N�latin1)�decode)�.0�srrr� �s�zlibc_ver..�libc�glibc)�os�confstrr�len�tuple�AttributeErrorr�OSError�sys� executabler�hasattr�pathr&�open�read� _libc_search�search�end�max�groups)r6�libr� chunksize�ver�parts�V�f�binary�pos�m�chunkZlibcinitr.Z glibcversionZso�threadsZ soversionrrr�libc_ver�s^       �   *rKcCs^|�d�}|r|�|�zttttt|���}WntyF|}Yn0d�|dd��}|S)z� Normalize the version and build strings and return a single version string using the format major.minor.build (or patchlevel). �.N�)r�append�list�map�strrr�join)r�build�l�stringsrrr� _norm_version�s    rVz'(?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\])��win32�win16�dosc Cs�tj|vr|||fSddl}dD]\}z|j||j|jddd�}Wn6t|jfyv}zWYd}~q WYd}~q d}~00q�q |||fS|��}t� |�}|dur�|� �\}}}|ddkr�|dd�}|ddkr�|dd�}t |�}|||fS)a+ Tries to figure out the OS version used and returns a tuple (system, release, version). It uses the "ver" shell command for this which is known to exists on Windows, DOS. XXX Others too ? In case this fails, the given parameters are used as defaults. rN)rBzcommand /c verz cmd /c verT)�stdin�stderr�text�shell�����rL) r5�platform� subprocess� check_output�DEVNULLr4�CalledProcessError�strip� _ver_output�matchr?rV) �system�releaserZsupported_platformsra�cmd�info�whyrHrrr� _syscmd_vers2  � "      rmZ2000ZXPZ 2003ServerZpost2003�Vista�7�8z8.1zpost8.1Z10Zpost10) )�r)rqr#�rqr%)rqN��r�rtr#�rtr%�rtrM�rtN)rr)rNZ 2008ServerZ 2008ServerR2Z 2012ServerZ 2012ServerR2Zpost2012ServerR2)rrrsrurvrwrxcCs t�dvS)N)ZIoTUAPZ NanoServerZWindowsCoreHeadlessZ IoTEdgeOS)� win32_editionrrrr� win32_is_iotSsrzcCs�z,z ddl}Wnty(ddl}Yn0Wnty>Yn^0zHd}|�|j|��"}|�|d�dWd�WS1s|0YWnty�Yn0dS)Nr�,SOFTWARE\Microsoft\Windows NT\CurrentVersionZ EditionId)�winreg� ImportError�_winreg� OpenKeyEx�HKEY_LOCAL_MACHINE� QueryValueExr4)r|�cvkey�keyrrrryVs   4 ryc Cs�zddlm}Wnty.||||fYS0|�}z ttt�d�d��\}}}Wn*ty�|jpt|dd�\}}}Yn0d� |||�}t � ||f�p�t � |df�p�|}|dd�||fk�rzd� |j �}Wn6t �y |dd�d k�rd |dd�}Yn0t|d d�dk�rDt� ||f��pBt� |df��pB|}z.z ddl} Wnt�ynddl} Yn0Wnt�y�Yn`0zHd } | �| j| �� } | �| d �d}Wd�n1�s�0YWnt�y�Yn0||||fS)Nr)�getwindowsversionr%rLrMz {0}.{1}.{2}zSP{}� z Service Pack ZSPZ product_typer{Z CurrentType)r5r�r}rPrrmrrZplatform_version�format�_WIN32_CLIENT_RELEASESrZservice_pack_majorr3�getattr�_WIN32_SERVER_RELEASESr|r~rr�r�r4) rir�csd�ptyper�Zwinver�major�minorrSr|r�r�rrr� win32_verhsR    �� �� 4r�cCs�d}tj�|�sdSz ddl}Wnty4YdS0t|d��}|�|�}Wd�n1s`0Y|d}d}t��j}|dvr�d}|||fS)Nz0/System/Library/CoreServices/SystemVersion.plistrr'ZProductVersion�r r r )ZppczPower MacintoshZPowerPC) r/r8�exists�plistlibr}r9�load�uname�machine)�fnr�rErri� versioninfor�rrr� _mac_ver_xml�s    ( r�r�cCst�}|dur|S|||fS)a< Get macOS version information and return it as tuple (release, versioninfo, machine) with versioninfo being a tuple (version, dev_stage, non_release_version). Entries which cannot be determined are set to the parameter values which default to ''. All tuple entries are strings. N)r�)rir�r�rkrrr�mac_ver�s r�cCsFddlm}z|�|�}|dur&|WS|WSty@|YS0dS)Nr)�System)� java.langr�Z getPropertyr3)�name�defaultr��valuerrr� _java_getprop�s   r�c Cs�z ddl}Wnty*||||fYS0td|�}td|�}|\}}}td|�}td|�}td|�}|||f}|\}} } td| �} td |�}td | �} || | f}||||fS) a] Version interface for Jython. Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being a tuple (vm_name, vm_release, vm_vendor) and osinfo being a tuple (os_name, os_version, os_arch). Values which cannot be determined are set to the defaults given as parameters (which all default to ''). rNz java.vendorz java.versionz java.vm.namezjava.vm.vendorzjava.vm.versionz java.os.archz java.os.namezjava.os.version)r�r}r�) ri�vendor�vminfo�osinfo�javaZvm_nameZ vm_releaseZ vm_vendor�os_name� os_version�os_archrrr�java_ver�s"               r�cCs�|dkr~|dkr|||fS|�d�}|rjzt|d�}WntyJYn 0|d}t|�|d<d�|�}|dkrxd}q�d}n,|dkr�d }|r�|d }q�d }n |d vr�d }|||fS)z� Returns (system, release, version) aliased to common marketing names used for some systems. It also does some reordering of the information in some cases where it would otherwise cause confusion. ZSunOS�5rLrrM�6ZSolarisZIRIX64ZIRIXz (64bit)�64bit�rXrY�Windows)rrrrQrR)rhrirrTr�rrr� system_alias�s.       r�cGs�d�dd�tt|�D��}|�dd�}|�dd�}|�dd�}|�dd�}|�d d�}|�d d�}|�d d�}|�d d�}|�d d�}|�dd�}||kr�q�|}q�|ddkr�|dd�}q�|S)zq Helper to format the platform string in a filename compatible format e.g. "system-version-machine". �-css|]}|��VqdS�N)re)r*�xrrr� ,�z_platform..� �_�/�\�:�;�"�(�)�unknownr z--r_N)rR�filterr1�replace)�argsr`Zcleanedrrr� _platform&s"           r�cCsJz ddl}Wnty"|YS0z |��WStyD|YS0dS)z8 Helper to determine the node name of this machine. rN)�socketr}� gethostnamer4)r�r�rrr�_nodeFs     r�cCsBtj�|�}tj�|�r>tj�tj�tj�|�t�|���}q |S)zT In case filepath is a symlink, follow it until a real file is reached. )r/r8�abspath�islink�normpathrR�dirname�readlink)�filepathrrr�_follow_symlinksUs   �r�c Csxtjdvr|Sddl}t|�}ttjdd�}z|jdd|g|j|d�}Wnt |j fyd|YS0|sn|S|� d �S) z� Interface to the system's file command. The function uses the -b option of the file command to have it omit the filename in its output. Follow the symlinks. It returns default in case the command should fail. )rZrXrYrN�C)�LC_ALL�filez-b)r\�envzlatin-1) r5r`rar��dictr/�environrbrcr4rdr))�targetr�rar��outputrrr� _syscmd_fileas  �  r�)r � WindowsPE)r r�)r �MSDOScCs|s&ddl}|�d�}t|d�d}|r6t|d�}nd}|sx|tjkrxtjtvrpttj\}}|rh|}|rp|}||fSd|vr�d|vr�||fSd |vr�d }nd |vr�d }n d |vr�d}d|vr�d}n8d|vr�d|vr�d}q�d}nd|vr�d}nd|vr�d}n||fS)a� Queries the given executable (defaults to the Python interpreter binary) for various architecture information. Returns a tuple (bits, linkage) which contains information about the bit architecture and the linkage format used for the executable. Both values are returned as strings. Values that cannot be determined are returned as given by the parameter presets. If bits is given as '', the sizeof(pointer) (or sizeof(long) on Python version < 1.5.2) is used as indicator for the supported pointer size. The function relies on the system's "file" command to do the actual work. This is available on most if not all Unix platforms. On some non-Unix platforms where the "file" command does not exist and the executable is set to the Python interpreter binary defaults from _default_architecture are used. rN�P��bitr r6z shared objectz32-bit�32bitZN32Zn32bitz64-bitr�ZELFZPEr�r�ZCOFFzMS-DOSr�)�struct�calcsizerQr�r5r6r`�_default_architecture)r6�bits�linkager��sizeZfileoutr rTrrr� architecture�sH  � r�cCstj�dd�ptj�dd�S)NZPROCESSOR_ARCHITEW6432r ZPROCESSOR_ARCHITECTURE)r/r�rrrrr�_get_machine_win32�s �r�c@s0eZdZedd��Zdd�Zdd�Zdd�Zd S) � _ProcessorcCs t|dtj��|j�}|�pdS)NZget_r )r�r5r`�from_subprocess)�cls�funcrrrr�sz_Processor.getcCstj�dt��S)NZPROCESSOR_IDENTIFIER)r/r�rr�rrrr� get_win32�sz_Processor.get_win32cCsDz ddl}WntyYn"0|�dd�\}}|dkrs�Y � � G  � 2��  3  #4  $�O   ��*Y     ���� h      L