Your IP : 216.73.216.52


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test__osx_support.cpython-35.opt-2.pyc



���]�-�@s�ddlZddlZddlZddlZddlZddlZddlZddlZej	ejj
d�d�Gdd�dej��Ze
dkr�ej�dS)�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
krY|j
j
|�qYWdS)NZbogus_program_xxxx�CFLAGS�LDFLAGS�CPPFLAGS�
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXX�	PY_CFLAGS�
PY_LDFLAGS�PY_CPPFLAGS�PY_CORE_CFLAGS)rrrrrr	r
rrr
rr)ZmaxDiff�	prog_name�os�path�abspath�getcwd�
temp_path_dir�test�supportZEnvironmentVarGuard�env�
addCleanup�__exit__Zunset)�self�cv�r�6/opt/alt/python35/lib64/python3.5/test__osx_support.py�setUps		
zTest_OSXSupport.setUpcs'�j��fdd��D��dS)Nc3s7|]-}�|�|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_values sz1Test_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.r/r0r1r+Z_read_output)rr2rrr�test__read_output4s
'	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@sz%Test_OSXSupport.test__find_build_toolcCs*|jtj�djtj���dS)Nr)r5�platform�mac_ver�
startswithr+Z_get_system_version)rrrr�test__get_system_versionEsz(Test_OSXSupport.test__get_system_versioncCshddi}ddi}d}d}tj|||�|j||�tj|�|j||�dS)Nr
zgcc-test -pthreadszclang -pthreads)r+�_save_modified_valueZassertNotEqualZ_remove_original_valuesr1)rr"r#r�newvaluerrr�test__remove_original_valuesIs
z,Test_OSXSupport.test__remove_original_valuescCs[ddi}ddi}|j||�d}d}tj|||�|j||�dS)Nr
zgcc-test -pthreadszclang -pthreads)r&r+r=r1)rr"r#rr>rrr�test__save_modified_valueWsz)Test_OSXSupport.test__save_modified_valuecCsKddi}|j�}d}d}tj|||�|j||�dS)Nr
zgcc-test -pthreads)�copyr+r=r1)rr"r#rr>rrr�#test__save_modified_value_unchangeddsz3Test_OSXSupport.test__save_modified_value_unchangedcCsbddl}tdd�|j�djd�dd�D��}|j|dktj��dS)	Nrcss|]}t|�VqdS)N)�int)r �irrrr$pszBTest_OSXSupport.test__supports_universal_builds.<locals>.<genexpr>�.��
�)rGrH)r9�tupler:�splitr1r+Z_supports_universal_builds)rr9Z
mac_ver_tuplerrr�test__supports_universal_buildsns
*z/Test_OSXSupport.test__supports_universal_buildscCsQd}ddddd	d
ddd
dddddi}ddddd	d
ddd
dddddi}|j||�|jdr�d|jdnd}tjj|j�||jd<xw|D]o\}}tjj|�|j	tjj|�t
|d��}|jd|�WdQRXtj|t
j�q�W|j|tj|��dS)N�gcc-test� i686-apple-darwin11-llvm-gcc-4.2�clang�clang version 3.1r
zgcc-test -pthreadsrz	cc++-testrz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  rz-arch ppc -arch i386   -grz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkrz(gcc-test -bundle -arch ppc -arch i386 -gr	zRgcc-test -bundle -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -gzclang -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 �rLrM�rNrO)rQrR)r&rrrrrrrr*rr,r-r.r/r0r1r+Z_find_appropriate_compiler)rZ	compilersr"r#�suffix�c_nameZc_outputr2rrr�test__find_appropriate_compilerus8$ 	z/Test_OSXSupport.test__find_appropriate_compilerc
Csuddddddddd	d
i}dddddd
ddd	di}|j||�|j|tj|��dS)Nrz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  rz-arch ppc -arch i386   -grz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkrz(gcc-4.0 -bundle  -arch ppc -arch i386 -gr	zRgcc-4.0 -bundle  -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -gz -fno-strict-aliasing  -g -O3    z    -gz-I.  zgcc-4.0 -bundle    -gzgcc-4.0 -bundle      -g)r&r1r+Z_remove_universal_flags)rr"r#rrr�test__remove_universal_flags�s	z,Test_OSXSupport.test__remove_universal_flagscCs*ddddddddd	d
ddi}dddd
ddddd	dddi}|j||�|jdr�d|jdnd}tjj|j�||jd<d}tjj|�|j	tjj|�t
|d��}|jd�WdQRXtj|t
j�|j|tj|��dS)Nr
rNrz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  rz-arch ppc -arch i386   -grz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkrz(gcc-4.0 -bundle  -arch ppc -arch i386 -gr	zRgcc-4.0 -bundle  -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -gz*-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(rPr)z#!/bin/sh
exit 255)r&rrrrrrrr*rr,r-r.r/r0r1r+Z_remove_unsupported_archs)rr"r#rSrTr2rrr�test__remove_unsupported_archs�s0$ 	z.Test_OSXSupport.test__remove_unsupported_archscCs�d|jd<ddddddd	d
ddd
di}ddddddd	d
ddd
di}|j||�|j|tj|��dS)Nz-arch x86_64Z	ARCHFLAGSr
rNrz3-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  rz-arch ppc -arch i386   -grz--I. -isysroot /Developer/SDKs/MacOSX10.4u.sdkrz(gcc-4.0 -bundle  -arch ppc -arch i386 -gr	zQgcc-4.0 -bundle -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -gz--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&r1r+Z_override_all_archs)rr"r#rrr�test__override_all_archs�s"
	z(Test_OSXSupport.test__override_all_archscCs�ddddddddd	d
ddi}dddd
ddddd	d
ddi}|j||�|j|tj|��dS)Nr
rNrz[-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  -isysroot /Developer/SDKs/MacOSX10.1.sdkrz-arch ppc -arch i386   -grz,-I. -isysroot /Developer/SDKs/MacOSX10.1.sdkrz(gcc-4.0 -bundle  -arch ppc -arch i386 -gr	zQgcc-4.0 -bundle  -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.1.sdk -gz4-fno-strict-aliasing  -g -O3 -arch ppc -arch i386   z-I.  z)gcc-4.0 -bundle  -arch ppc -arch i386  -g)r&r1r+Z_check_for_unavailable_sdk)rr"r#rrr�test__check_for_unavailable_sdk�s 	z/Test_OSXSupport.test__check_for_unavailable_sdkcCs>ddddi}tj|ddd�}|jd|�dS)	Nrz[-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  -isysroot /Developer/SDKs/MacOSX10.1.sdk�MACOSX_DEPLOYMENT_TARGET�10.6� �macosx�fat)r]r[r^)r+�get_platform_osxr1)rr"�resultrrr�test_get_platform_osx	sz%Test_OSXSupport.test_get_platform_osxN)�__name__�
__module__�__qualname__rr&r3r4r8r<r?r@rBrKrUrVrWrXrYrarrrrrs 



'"r�__main__)rr9�shutilr/�sysZunittestZtest.supportrr+Z
skipUnlessr;ZTestCaserrb�mainrrrr�<module>s(�