HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_platform.cpython-37.pyc
B

��g�E�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
Gdd�dej�ZGdd�dej�Z
edkr�e��dS)	�)�mockN)�supportc@seZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Ze�ej�d�d�dd ��Zd!d"�Zd#d$�Zd%d&�Ze�ejd'kd(�d)d*��Zd+d,�Zd-d.�Zejd/d0��Z d1d2�Z!d3d4�Z"d5d6�Z#d7S)8�PlatformTestcCst��}dS)N)�platformZarchitecture)�self�res�r�./usr/local/lib/python3.7/test/test_platform.py�test_architectureszPlatformTest.test_architecturec	s�tjdkr,tj�tj�s,ddl}|�d�}ntj�tj�}tj�	t
j�}t�||�d}tjdkr�dd�tj
D�}d�tj�|�|�dd��|d<tj�|�|d<t�d	�r�tj�tj�|d
<d�fdd�	}z��|tj�|||d
��Wdt�|�XdS)N�win32rcSsi|]}tj||���qSr)�os�environ�upper)�.0�krrr	�
<dictcomp>!sz>PlatformTest.test_architecture_via_symlink.<locals>.<dictcomp>z{};{}�PATH�Z
PYTHONHOMETZ
PYTHONPATHcsj|ddg}tj|tjtj|d�}|��}|jrftt|d��tt|d�tjd���	d�
|j��|S)Nz-cz/import platform; print(platform.architecture()))�stdout�stderr�envr�)�filez'unexpected return code: {0} (0x{0:08X}))�
subprocess�Popen�PIPEZcommunicate�
returncode�print�repr�sysrZfail�format)Zpythonr�cmd�p�r)rrr	�get(s

z7PlatformTest.test_architecture_via_symlink.<locals>.get)r)N)rrr�path�exists�
executable�_winapi�GetModuleFileName�realpath�abspathr�TESTFN�symlinkr
r �dirnamer$�	sysconfigZis_python_build�__file__�assertEqual�remove)rr(�real�linkrr$r)rr	�test_architecture_via_symlinks$


z*PlatformTest.test_architecture_via_symlinkcCs,x&dD]}xdD]}t�||�}qWqWdS)N)FT)r)rZaliasedZterserrrr	�
test_platform:s

zPlatformTest.test_platformcCst��}dS)N)r�system)rrrrr	�test_system?szPlatformTest.test_systemcCst��}dS)N)r�node)rrrrr	�	test_nodeBszPlatformTest.test_nodecCst��}dS)N)r�release)rrrrr	�test_releaseEszPlatformTest.test_releasecCst��}dS)N)r�version)rrrrr	�test_versionHszPlatformTest.test_versioncCst��}dS)N)r�machine)rrrrr	�test_machineKszPlatformTest.test_machinecCst��}dS)N)r�	processor)rrrrr	�test_processorNszPlatformTest.test_processorcCstj|_tj|_tj|_dS)N)rr=�save_version�_git�save_gitr�
save_platform)rrrr	�setUpQszPlatformTest.setUpcCs|jt_|jt_|jt_dS)N)rCrr=rErDrFr)rrrr	�tearDownVszPlatformTest.tearDownc
Cs:xBdD]:\}}t�|�\}}}}}}}	|�||dd|||	f|�qWdd|jfddddd	d
ddd
dd|jfdi}
x�|
��D]�\\}}}
}|t_|dkr�ttd�r�t`n|t_|
dk	r�|
t_|�t�	�|d�|�t�
�|d�|�t��|d�|�t��|d�|�t�
�|d�|�t��|d�qzWdS)N))zC2.4.3 (#1, Jun 21 2006, 13:54:21) 
[GCC 3.3.4 (pre 3.3.5 20040809)])�CPythonz2.4.3rr�1zJun 21 2006 13:54:21zGCC 3.3.4 (pre 3.3.5 20040809))z)IronPython 1.0.60816 on .NET 2.0.50727.42)�
IronPythonz	1.0.60816rrrrz.NET 2.0.50727.42)z4IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42)rKz1.0.0rrrrz.NET 2.0.50727.42)z"2.4.3 (truncation, date, t) 
[GCC])rIz2.4.3rr�
truncationzdate t�GCC)z!2.4.3 (truncation, date, ) 
[GCC])rIz2.4.3rrrL�daterM)z 2.4.3 (truncation, date,) 
[GCC])rIz2.4.3rrrLrNrM)z2.4.3 (truncation, date) 
[GCC])rIz2.4.3rrrLrNrM)z2.4.3 (truncation, d) 
[GCC])rIz2.4.3rrrL�drM)z2.4.3 (truncation, ) 
[GCC])rIz2.4.3rrrLrrM)z2.4.3 (truncation,) 
[GCC])rIz2.4.3rrrLrrM)z2.4.3 (truncation) 
[GCC])rIz2.4.3rrrLrrMrzX2.6.1 (r261:67515, Dec  6 2008, 15:26:00) 
[GCC 4.0.1 (Apple Computer, Inc. build 5370)])rIz	tags/r261�67515)rIz2.6.1z	tags/r261rP)z
r261:67515zDec  6 2008 15:26:00z+GCC 4.0.1 (Apple Computer, Inc. build 5370))z/IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053N�cli)rKz2.0.0rr)rrz.NET 2.0.50727.3053)z=2.6.1 (IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433)NrQ)rKz2.6.1rr)rrz.NET 2.0.50727.1433)z@2.7.4 (IronPython 2.7.4 (2.7.0.40) on Mono 4.0.30319.1 (32-bit))NrQ)rKz2.7.4rr)rrzMono 4.0.30319.1 (32-bit))z^2.5 (trunk:6107, Mar 26 2009, 13:02:18) 
[Java HotSpot(TM) Client VM ("Apple Computer, Inc.")])�Jython�trunk�6107zjava1.5.0_16)rRz2.5.0rSrT)z
trunk:6107zMar 26 2009zjava1.5.0_16z12.5.2 (63378, Mar 26 2009, 18:03:29)
[PyPy 1.0.0])�PyPyrS�63378)rUz2.5.2rSrV)rVzMar 26 2009rrDrr����)rZ_sys_versionr1rF�itemsrr=�hasattrrDZpython_implementationZpython_versionZ
python_branchZpython_revisionZpython_buildZpython_compiler)r�input�output�namer=�branchZrevisionZbuildnoZ	builddateZcompilerZsys_versionsZversion_tagZscmZsys_platform�inforrr	�test_sys_version[sD
zPlatformTest.test_sys_versioncCst�t��t��t���}dS)N)rZsystem_aliasr7r;r=)rrrrr	�test_system_alias�szPlatformTest.test_system_aliascCs�t��}|�t|��|�|d|j�|�|d|j�|�|d|j�|�|d|j�|�|d|j	�|�|d|j
�dS)NrrrWrXrYrZ)r�uname�
assertTrue�anyr1r7r9r;r=r?rA)rrrrr	�
test_uname�szPlatformTest.test_uname�winzwindows only testc	Cs�z�t���p}d|kr|d=d|d<dt_t��\}}}}}}|�|d�d|d<dt_t��\}}}}}}|�|d�WdQRXWddt_XdS)NZPROCESSOR_ARCHITEW6432ZfooZPROCESSOR_ARCHITECTUREZbar)rZEnvironmentVarGuardrZ_uname_cacherdr1)rr
r7r9r;r=r?rArrr	�test_uname_win32_ARCHITEW6432�s
z*PlatformTest.test_uname_win32_ARCHITEW6432cCs$t��}tjdkr |�t|��dS)N�java)rZjava_verrre�all)rrrrr	�
test_java_ver�s
zPlatformTest.test_java_vercCst��}dS)N)rZ	win32_ver)rrrrr	�test_win32_ver�szPlatformTest.test_win32_vercCst��}t��jdk�rt�dd�}d}x(|D] }|�d�r.|����d}Pq.W|�	�|�
|dk�|d�d�}|dd	gkr�d
dg}|�d�}t|�t|�}|dkr�|�dg|�|�
||�|�
|dd
�tjdkr�|�|dd�n|�
|dd�dS)NZDarwinZsw_versr#zProductVersion:���r�.Z10Z16Z11�0r)rrr�littlerW)Zi386Zx86_64ZPowerPC)r�mac_verrdr7r�popen�
startswith�strip�split�closeZassertFalse�len�extendr1r�	byteorderZassertIn)rr�fdZreal_verZlnZresult_listZexpect_listZlen_diffrrr	�test_mac_ver�s,



zPlatformTest.test_mac_ver�darwinz
OSX only testcCsPt��}|dkr$t��}t�d�n(t�|d�\}}|�||�|�|d�dS)Nr)r�forkrrr�_exit�waitpidr1)r�pidraZcpid�stsrrr	�test_mac_ver_with_forksz#PlatformTest.test_mac_ver_with_forkc	Cs.t���t�ddt�t��}WdQRXdS)N�ignorez?dist\(\) and linux_distribution\(\) functions are deprecated .*)�warnings�catch_warnings�filterwarnings�DeprecationWarningr�dist)rrrrr	�	test_dists
zPlatformTest.test_distc	Cs�tj�tj�r,tj�tjd�r,tjd}n2tjdkrXtj�tj�sXddl}|�d�}ntj}t�	|�}|�
tjtj
�ttj
d��}|�dd�|�d�WdQRX|�t�	tj
�d�dS)	Nz.exerr�wb�xi�?s"GLIBC_1.23.4GLIBC_1.9GLIBC_1.21)Zglibcz1.23.4)rr%�isdirrr'r&rr(r)Zlibc_verZ
addCleanupr�unlinkr,�open�writer1)rr'r(r�frrr	�
test_libc_ver"s
zPlatformTest.test_libc_vercCs|ddlm}|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d	��|�|d�|d
��|�|d	�|d��|�|d
�|d��|�|d�|d
��|�|d�|d
��|�|d
�|d��|�|d
�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d�|d��|�|d �|d!��|�|d"�|d#��|�|d"�|d ��|�|d!�|d#��|�|d �|d#��|�|d$�|d%��|�|d&�|d'��|�|d(�|d)��dS)*Nr)�_comparable_versionz1.2.3z1.2.10z1.2.3.4z1_2-3+4z1.2spamz1.2devz1.2alphaz1.2az1.2betaz1.2bz1.2cz1.2RCz1.2rcz1.2.0z1.2plz1.2pz1.5.1z1.5.2b2z3.10aZ161z8.02z3.4jz
1996.07.12z3.1.1.6z3.2.pl0Z2g6Z11gz0.9z2.2z1.2z1.2.1z1.1z1.2.2z0.4z0.4.0z1.13++z5.5.kwz0.960923z	2.2beta29)rr�r1Z
assertLess)r�Vrrr	�test__comparable_version7s@z%PlatformTest.test__comparable_versioncCs(x"dD]\}}|�t�|�|�qWdS)N)
)zSuSE Linux 9.3 (x86-64))zSuSE Linux z9.3zx86-64)zSUSE LINUX 10.1 (X86-64))zSUSE LINUX z10.1zX86-64)zSUSE LINUX 10.1 (i586))zSUSE LINUX z10.1Zi586)z Fedora Core release 5 (Bordeaux))zFedora Core�5ZBordeaux)z"Red Hat Linux release 8.0 (Psyche))z
Red Hat Linuxz8.0ZPsyche)z Red Hat Linux release 9 (Shrike))z
Red Hat Linux�9ZShrike)z+Red Hat Enterprise Linux release 4 (Nahant))zRed Hat Enterprise Linux�4ZNahant)zCentOS release 4)ZCentOSr�N)zRocks release 4.2.1 (Cydonia))ZRocksz4.2.1ZCydonia)r)rrr)r1rZ_parse_release_file)rr]r^rrr	�test_parse_release_file[sz$PlatformTest.test_parse_release_filec	
Cstjdk}|rd�tj�}nd�tj�}t���Ht�dt�t�|��&}|�	��
�}|��|�|d�WdQRXWdQRXd}|r�d}nd}|�tj�}t���nt�dt�t�|d	��J}|�
|�}|��}|�|�tjd
kr�|}n|d?}|�|t|��WdQRXWdQRXdS)Nrz"{}" -c "print('Hello')"z'{}' -c 'print("Hello")'r�ZHelloZplopz<"{}" -c "import sys; data=sys.stdin.read(); exit(len(data))"z<'{}' -c 'import sys; data=sys.stdin.read(); exit(len(data))'�w�nt�)rrr r'r�r��simplefilterr�rs�readrurwr1r�ZassertIsNotNonerr_rx)	rZ	mswindowsZcommandrZhello�data�stdin�retrrrr	�
test_popenls2

 



zPlatformTest.test_popencCs�t����}tj�|d�}t|ddd��}|�d�WdQRXt�d|��Bt	�
��"t	�ddt�t
��\}}}WdQRX|�|d	�WdQRX|�|d
�|�|d�WdQRXdS)Nzfedora-releaser�zutf-8)�encodingu)Fedora release 19 (Schrödinger’s Cat)
zplatform._UNIXCONFDIRr�z?dist\(\) and linux_distribution\(\) functions are deprecated .*ZFedoraZ19uSchrödinger’s Cat)�tempfileZTemporaryDirectoryrr%�joinr�r�rZpatchr�r�r�r�r�linux_distributionr1)rZtempdir�filenamer�Zdistnamer=Zdistidrrr	� test_linux_distribution_encoding�s

z-PlatformTest.test_linux_distribution_encodingN)$�__name__�
__module__�__qualname__r
rZskip_unless_symlinkr5r6r8r:r<r>r@rBrGrHrbrcrg�unittestZ
skipUnlessrrrtrirlrmr|r�r�r�Zcpython_onlyr�r�r�r�rrrr	r
s2)W
&
$ rc@seZdZdd�Zdd�ZdS)�DeprecationTestc	Cs4|�t��}t��WdQRX|�t|j�d�dS)NzFdist() and linux_distribution() functions are deprecated in Python 3.5)�assertWarnsr�rr�r1�str�warning)r�cmrrr	�test_dist_deprecation�sz%DeprecationTest.test_dist_deprecationc	Cs4|�t��}t��WdQRX|�t|j�d�dS)NzFdist() and linux_distribution() functions are deprecated in Python 3.5)r�r�rr�r1r�r�)rr�rrr	�#test_linux_distribution_deprecation�sz3DeprecationTest.test_linux_distribution_deprecationN)r�r�r�r�r�rrrr	r��sr��__main__)r�rrrrrr/r�r�ZtestrZTestCaserr�r��mainrrrr	�<module>s