Your IP : 3.15.211.55


Current Path : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/_osx_support.cpython-36.opt-2.pyc

3


 \�J�
@s�ddlZddlZddlZddddgZd0Zd1ZdZd2dd�Zdd�Zdd�Z	da
dd�Zdd�Zdd�Z
d d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d�Zd-d�Zd.d�Zd/d�ZdS)3�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx�CFLAGS�LDFLAGS�CPPFLAGS�
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXX�	PY_CFLAGS�
PY_LDFLAGS�PY_CPPFLAGS�PY_CORE_CFLAGS�PY_CORE_LDFLAGSZ_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|jtj�}tjj|�\}}tjdkrH|dkrH|d}tjj|�s�x*|D]"}tjj	||�}tjj|�rZ|SqZWdS|SdS)N�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r#�$/usr/lib64/python3.6/_osx_support.py�_find_executables

r%cCs�ddl}yddl}|j�}Wn(tk
rDtdtj�fd�}YnX|j|��0}d||jf}tj	|�s||j
�jd�j�SdSQRXdS)Nrz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringr&r'�fp�cmdr#r#r$�_read_output7sr3cCst|�ptd|f�pdS)Nz/usr/bin/xcrun -find %s�)r%r3)Ztoolnamer#r#r$�_find_build_toolJsr5cCsxtdkrtdaytd�}Wntk
r,YnHXztjd|j��}Wd|j�X|dk	rtdj|jd�j	d�dd��atS)Nr4z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr)�OSError�re�searchr.�closer�groupr)r"�mr#r#r$�_get_system_versionSs

r@cCs&x t|�D]}|jt�r
||=q
WdS)N)�list�
startswith�_INITPRE)�_config_vars�kr#r#r$�_remove_original_valuesqs
rFcCs8|j|d�}||kr,t||kr,||t|<|||<dS)Nr4)�getrC)rD�cvZnewvalueZoldvaluer#r#r$�_save_modified_valuexsrIcCsTt�}|r@ytdd�|jd�D��}Wntk
r>d}YnX|rPt|dk�SdS)	Ncss|]}t|�VqdS)N)�int)�.0�ir#r#r$�	<genexpr>�sz-_supports_universal_builds.<locals>.<genexpr>r6r4�
�F)rNrO)r@�tupler�
ValueError�bool)Zosx_versionr#r#r$�_supports_universal_builds�s
rScCs�dtjkr|S|dj�d}}t|�s4td�}n<tjj|�jd�rptd|j	dd�f�}|rpd|krptd�}|s|t
d	��||kr�xTtD]L}||kr�|tjkr�||j�}|d
kr�|n|d|d<t||dj
|��q�W|S)
NrrZclang�gccz'%s' --version�'z'"'"'zllvm-gcczCannot locate working compilerr
z++� )rrrr%r5r�basenamerBr3�replace�SystemError�_COMPILER_CONFIG_VARSrIr)rDZccZoldcc�datarHZcv_splitr#r#r$�_find_appropriate_compiler�s(


r\cCsZxTtD]L}||kr|tjkr||}tjdd|tjd�}tjdd|�}t|||�qW|S)Nz
-arch\s+\w+\srV)�flagsz-isysroot [^ 	]*)�_UNIVERSAL_CONFIG_VARSrrr;�sub�ASCIIrI)rDrHr]r#r#r$�_remove_universal_flags�s
racCs�dtjkr|Stjd|d�dk	r�tjd|djdd�f�}|r�x@tD]8}||krH|tjkrH||}tjdd|�}t|||�qHW|S)	Nrz-arch\s+ppcrzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullrUz'"'"'z-arch\s+ppc\w*\srV)	rrr;r<r-rXr^r_rI)rDZstatusrHr]r#r#r$�_remove_unsupported_archs�s
	
rbcCshdtjkrdtjd}xNtD]F}||krd||kr||}tjdd|�}|d|}t|||�qW|S)N�	ARCHFLAGSz-archz
-arch\s+\w+\srV)rrr^r;r_rI)rDZarchrHr]r#r#r$�_override_all_archss


rdcCs||jdd�}tjd|�}|dk	rx|jd�}tjj|�sxx@tD]8}||kr<|tjkr<||}tj	dd|�}t
|||�q<W|S)Nrr4z-isysroot\s+(\S+)r7z-isysroot\s+\S+(?:\s|$)rV)rGr;r<r>rr�existsr^rr_rI)rD�cflagsr?ZsdkrHr]r#r#r$�_check_for_unavailable_sdks

rgcCsXd}}t|�}t�s d}}nd|k}d|k}|s>dtjkrxx8y|jd�}|||d�=Wq@tk
rrPYq@Xq@Wdtjkr�|r�|tjdj�}|r�x8y|jd�}|||d�=Wq�tk
r�PYq�Xq�Wd}d|kr�|jd�}||d}n d|k�r|jd�}||d}|�rTtjj|��rTdd	l	m
}|jd
|�|jd�|S)NFTz-archz	-isysrootrcr8r7r)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rArSrr�indexrQrr�isdirZ	distutilsrh�warn)Zcompiler_soZcc_argsZ	stripArchZstripSysrootriZsysroot�idxrhr#r#r$r0sF	






cCs"t�st|�t|�t|�|S)N)rSrardrg)rDr#r#r$rps
cCst|�t|�t|�|S)N)r\rbrd)rDr#r#r$r�s	c
Cs||jdd�}t�p|}|p|}|�rr|}d}|jtd|jdd��}|r�y$tdd�|jd�dd	�D��}Wq�tk
r�d}Yq�Xnd}|dko�d|j�k�r6d
}tjd|�}tt	t
|���}t|�dkr�|d}n\|dkr�d
}nN|d k�r�d}n>|d!k�rd}n.|d"k�rd}n|d#k�r&d}ntd|f��n<|dk�rRtj
d$k�rrd}n |d%k�rrtj
d&k�rnd}nd}|||fS)'N�MACOSX_DEPLOYMENT_TARGETr4Zmacosxrcss|]}t|�VqdS)N)rJ)rKrLr#r#r$rM�sz#get_platform_osx.<locals>.<genexpr>r6rr8rNrOz-archZfatz
-arch\s+(\S+)r7�i386�ppc�x86_64ZintelZfat3�ppc64Zfat64Z	universalz%Don't know machine value for archs=%r� �PowerPC�Power_Macintosh)rNr)rNr)rNrO)rnro)rnrp)rnrorp)rqrp)rnrorqrpl)rsrtl)rGr@rCrPrrQr0r;�findall�sorted�set�lenr�maxsize)rD�osname�release�machineZmacverZ
macreleaserfZarchsr#r#r$r�sP


$






)
rrrr	r
rrr
rrrrr)r
rrr
)N)rr;r�__all__r^rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$�<module>s:
>(@)

?>