Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib64/python3.6/test/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/test/__pycache__/test__osx_support.cpython-36.pyc

3

� f�-�@svdZddlZddlZddlZddlZddlZddlZddlZej	ejj
d�d�Gdd�dej��Ze
dkrrej�dS)z=
Test suite for _osx_support: shared OS X support functions.
�N�darwinz
requires OS Xc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)"�Test_OSXSupportc
Cs`d|_d|_tjjtj��|_tjj	�|_
|j|j
j�x"dD]}||j
kr>|j
j
|�q>WdS)NZbogus_program_xxxx�CFLAGS�LDFLAGS�CPPFLAGS�
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXX�	PY_CFLAGS�
PY_LDFLAGS�PY_CPPFLAGS�PY_CORE_CFLAGS�PY_CORE_LDFLAGS)
rrrrrr	r
rrr
rrr)ZmaxDiff�	prog_name�os�path�abspath�getcwd�
temp_path_dir�test�supportZEnvironmentVarGuard�env�
addCleanup�__exit__Zunset)�self�cv�r�;/opt/alt/python36/lib64/python3.6/test/test__osx_support.py�setUps
zTest_OSXSupport.setUpcs�j��fdd��D��dS)Nc3s.|]&}�|�|krd|�|fVqdS)Z_OSX_SUPPORT_INITIAL_Nr)�.0�k)�config_vars�
expected_varsrr�	<genexpr>"szDTest_OSXSupport.add_expected_saved_initial_values.<locals>.<genexpr>)�update)rr#r$r)r#r$r�!add_expected_saved_initial_valuessz1Test_OSXSupport.add_expected_saved_initial_valuescCs�|jdr|jdd|jd<|jdtjj|j�|jd<tjj|j�|j	t
j|j��|jtjj|j�t
|jd��}|jd�WdQRXtj|jtj�|j|jt
j|j��dS)N�PATH�:�wz#!/bin/sh
/bin/echo OK
)rrrrrrr�unlinkrZassertIsNone�_osx_supportZ_find_executabler�open�write�chmod�stat�S_IRWXU�assertEqual)r�frrr�test__find_executable&s
z%Test_OSXSupport.test__find_executablecCs�|jdr|jdd|jd<|jdtjj|j�|jd<tjj|j�|j	tjj|j�t
|jd��}|jd�WdQRXtj|jt
j�|jdtj|j��dS)Nr(r)r*z##!/bin/sh
/bin/echo ExpectedOutput
ZExpectedOutput)rrrrrrrr+rrr-r.r/r0r1r2r,Z_read_output)rr3rrr�test__read_output3s
z!Test_OSXSupport.test__read_outputcCs"tjd�}|jtjj|�d�dS)NZccz!cc not found - check xcode-select)r,Z_find_build_tool�
assertTruerr�isfile)r�outrrr�test__find_build_tool?s
z%Test_OSXSupport.test__find_build_toolcCs |jtj�djtj���dS)Nr)r6�platform�mac_ver�
startswithr,Z_get_system_version)rrrr�test__get_system_versionDsz(Test_OSXSupport.test__get_system_versioncCsLddi}ddi}d}d}tj|||�|j||�tj|�|j||�dS)Nr
zgcc-test -pthreadszclang -pthreads)r,�_save_modified_valueZassertNotEqualZ_remove_original_valuesr2)rr#r$r�newvaluerrr�test__remove_original_valuesHs
z,Test_OSXSupport.test__remove_original_valuescCsBddi}ddi}|j||�d}d}tj|||�|j||�dS)Nr
zgcc-test -pthreadszclang -pthreads)r'r,r>r2)rr#r$rr?rrr�test__save_modified_valueVsz)Test_OSXSupport.test__save_modified_valuecCs6ddi}|j�}d}d}tj|||�|j||�dS)Nr
zgcc-test -pthreads)�copyr,r>r2)rr#r$rr?rrr�#test__save_modified_value_unchangedcsz3Test_OSXSupport.test__save_modified_value_unchangedcCsHddl}tdd�|j�djd�dd�D��}|j|dktj��dS)	Nrcss|]}t|�VqdS)N)�int)r!�irrrr%oszBTest_OSXSupport.test__supports_universal_builds.<locals>.<genexpr>�.��
�)rHrI)r:�tupler;�splitr2r,Z_supports_universal_builds)rr:Z
mac_ver_tuplerrr�test__supports_universal_buildsms
 
z/Test_OSXSupport.test__supports_universal_buildscCs�d}ddddd	d
dd�}d
dddd	ddd�}|j||�|jdrPd|jdnd}tjj|j�||jd<x^|D]V\}}tjj|�|j	tjj|�t
|d��}|jd|�WdQRXtj|t
j�qrW|j|tj|��dS)N�gcc-test� i686-apple-darwin11-llvm-gcc-4.2�clang�clang version 3.1zgcc-test -pthreadsz	cc++-testz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  z-arch ppc -arch i386   -gz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkz(gcc-test -bundle -arch ppc -arch i386 -gzRgcc-test -bundle -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g)r
rrrrrr	zclang -pthreadszclang++z%clang -bundle -arch ppc -arch i386 -gzOclang -bundle -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -gr(r)�r*z#!/bin/sh
/bin/echo �rMrN�rOrP)rRrS)r'rrrrrrrr+rr-r.r/r0r1r2r,Z_find_appropriate_compiler)rZ	compilersr#r$�suffix�c_nameZc_outputr3rrr�test__find_appropriate_compilerts8z/Test_OSXSupport.test__find_appropriate_compilercCsBdddddd�}ddd	d
dd�}|j||�|j|tj|��dS)Nz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  z-arch ppc -arch i386   -gz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkz(gcc-4.0 -bundle  -arch ppc -arch i386 -gzRgcc-4.0 -bundle  -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g)rrrrr	z -fno-strict-aliasing  -g -O3    z    -gz-I.  zgcc-4.0 -bundle    -gzgcc-4.0 -bundle      -g)r'r2r,Z_remove_universal_flags)rr#r$rrr�test__remove_universal_flags�sz,Test_OSXSupport.test__remove_universal_flagscCs�ddddddd�}ddd	dd
dd�}|j||�|jdrHd
|jdnd}tjj|j�||jd<d}tjj|�|j	tjj|�t
|d��}|jd�WdQRXtj|t
j�|j|tj|��dS)NrOz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  z-arch ppc -arch i386   -gz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkz(gcc-4.0 -bundle  -arch ppc -arch i386 -gzRgcc-4.0 -bundle  -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g)r
rrrrr	z*-fno-strict-aliasing  -g -O3  -arch i386  z -arch i386   -gzgcc-4.0 -bundle   -arch i386 -gzIgcc-4.0 -bundle   -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -gr(r)rQr*z#!/bin/sh
exit 255)r'rrrrrrrr+rr-r.r/r0r1r2r,Z_remove_unsupported_archs)rr#r$rTrUr3rrr�test__remove_unsupported_archs�s0z.Test_OSXSupport.test__remove_unsupported_archscCsPd|jd<ddddddd	�}dd
dddd
d	�}|j||�|j|tj|��dS)Nz-arch x86_64Z	ARCHFLAGSrOz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  z-arch ppc -arch i386   -gz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkz(gcc-4.0 -bundle  -arch ppc -arch i386 -gzQgcc-4.0 -bundle -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g)r
rrrrr	z--fno-strict-aliasing  -g -O3     -arch x86_64z    -g -arch x86_64z"gcc-4.0 -bundle    -g -arch x86_64zKgcc-4.0 -bundle   -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -arch x86_64)rr'r2r,Z_override_all_archs)rr#r$rrr�test__override_all_archs�s"
z(Test_OSXSupport.test__override_all_archscCsFddddddd�}dddd	dd
d�}|j||�|j|tj|��dS)NrOz[-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  -isysroot /Developer/SDKs/MacOSX10.1.sdkz-arch ppc -arch i386   -gz,-I. -isysroot /Developer/SDKs/MacOSX10.1.sdkz(gcc-4.0 -bundle  -arch ppc -arch i386 -gzQgcc-4.0 -bundle  -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.1.sdk -g)r
rrrrr	z4-fno-strict-aliasing  -g -O3 -arch ppc -arch i386   z-I.  z)gcc-4.0 -bundle  -arch ppc -arch i386  -g)r'r2r,Z_check_for_unavailable_sdk)rr#r$rrr�test__check_for_unavailable_sdk�s z/Test_OSXSupport.test__check_for_unavailable_sdkcCs*ddd�}tj|ddd�}|jd|�dS)Nz[-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  -isysroot /Developer/SDKs/MacOSX10.1.sdk�10.6)r�MACOSX_DEPLOYMENT_TARGET� �macosx�fat)r^r[r_)r,�get_platform_osxr2)rr#�resultrrr�test_get_platform_osxsz%Test_OSXSupport.test_get_platform_osxN)�__name__�
__module__�__qualname__r r'r4r5r9r=r@rArCrLrVrWrXrYrZrbrrrrrs 



'"r�__main__)�__doc__rr:r0�sysZunittestZtest.supportrr,Z
skipUnlessr<ZTestCaserrc�mainrrrr�<module>s