Your IP : 18.217.241.235


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/_osx_support.cpython-34.pyc

�
i f�J�@sdZddlZddlZddlZddddgZd0Zd1ZdZddd�Zdd�Z	dd�Z
dadd�Zdd�Z
dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d�Zd-d�Zd.d�Zd/d�ZdS)2zShared OS X support functions.�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_CFLAGSZ_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}n|jtj�}tjj|�\}}tjdkrn|dkrn|d}ntjj|�s�x9|D]1}tjj	||�}tjj|�r�|Sq�WdS|SdS)z�Tries to find 'executable' in the directories listed in 'path'.

    A string listing directories separated by 'os.pathsep'; defaults to
    os.environ['PATH'].  Returns the complete filename or None if not found.
    N�PATH�win32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r#�1/opt/alt/python34/lib64/python3.4/_osx_support.py�_find_executables

r%cCs�ddl}yddl}|j�}Wn.tk
rXtdtj�fd�}YnX|j|��F}d||jf}tj	|�s�|j
�jd�j�SdSWdQXdS)z0Output from successful command execution or NonerNz/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
r3cCs#t|�p"td|f�p"dS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s�)r%r3)Ztoolnamer#r#r$�_find_build_toolJsr5cCs�tdkr�daytd�}Wntk
r6Yq�Xztjd|j��}Wd|j�X|dk	r�dj|jd�j	d�dd��aq�ntS)z*Return the OS X system version as a stringNr4z0/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

	1r@cCs4x-t|�D]}|jt�r
||=q
q
WdS)z-Remove original unmodified values for testingN)�list�
startswith�_INITPRE)�_config_vars�kr#r#r$�_remove_original_valuesqsrFcCsM|j|d�}||kr?t||kr?||t|<n|||<dS)z@Save modified and original unmodified value of configuration varr4N)�getrC)rD�cvZnewvalueZoldvaluer#r#r$�_save_modified_valuexsrIcCsmt�}|rSy&tdd�|jd�D��}WqStk
rOd}YqSXn|rit|dk�SdS)	z=Returns True if universal builds are supported on this systemcss|]}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	&
rScCsDdtjkr|S|dj�d}}t|�sFtd�}n^tjj|�jd�r�td|j	dd�f�}|r�d|kr�td�}q�n|s�t
d	��n||kr@xxtD]m}||kr�|tjkr�||j�}|d
kr|n|d|d<t||dj
|��q�q�Wn|S)
z7Find appropriate C compiler for extension module buildsr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\cCs}xvtD]n}||kr|tjkr||}tjdd|tj�}tjdd|�}t|||�qqW|S)z5Remove all universal build arguments from config varsz
-arch\s+\w+\srVz-isysroot [^ 	]*)�_UNIVERSAL_CONFIG_VARSrrr;�sub�ASCIIrI)rDrH�flagsr#r#r$�_remove_universal_flags�s

racCs�dtjkr|Stjd|d�dk	r�tjd|djdd�f�}|r�x^tD]S}||krb|tjkrb||}tjdd	|�}t|||�qbqbWq�n|S)
z-Remove any unsupported archs from config varsrz-arch\s+ppcrNzNecho '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	

rbcCs�dtjkr�tjd}xmtD]b}||kr#d||kr#||}tjdd|�}|d|}t|||�q#q#Wn|S)z2Allow override of all archs with ARCHFLAGS env var�	ARCHFLAGSz-archz
-arch\s+\w+\srV)rrr]r;r^rI)rDZarchrHr`r#r#r$�_override_all_archss


rdcCs�|jdd�}tjd|�}|dk	r�|jd�}tjj|�s�x^tD]S}||krX|tjkrX||}tj	dd|�}t
|||�qXqXWq�n|S)z+Remove references to any SDKs not availablerr4z-isysroot\s+(\S+)Nr7z-isysroot\s+\S+(?:\s|$)rV)rGr;r<r>rr�existsr]rr^rI)rD�cflagsr?ZsdkrHr`r#r#r$�_check_for_unavailable_sdks

rgcCs�d}}t|�}t�s,d}}nd|k}d|k}|sYdtjkr�xAy$|jd�}|||d�=Wq\tk
r�PYq\Xq\Wndtjkr�|r�|tjdj�}n|rxAy$|jd�}|||d�=Wq�tk
rPYq�Xq�Wnd}d|krI|jd�}||d}n,d|kru|jd�}||d}n|r�tjj|�r�d	d
l	m
}|jd|�|jd�n|S)
ae
    This function will strip '-isysroot PATH' and '-arch ARCH' from the
    compile flags if the user has specified one them in extra_compile_flags.

    This is needed because '-arch ARCH' adds another architecture to the
    build, without a way to remove an architecture. Furthermore GCC will
    barf if multiple '-isysroot' arguments are present.
    FTz-archz	-isysrootrcr8Nr7r)�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|�nt|�t|�|S)a�Customize Python build configuration variables.

    Called internally from sysconfig with a mutable mapping
    containing name/value pairs parsed from the configured
    makefile used to build this interpreter.  Returns
    the mapping updated as needed to reflect the environment
    in which the interpreter is running; in the case of
    a Python from a binary installer, the installed
    environment may be very different from the build
    environment, i.e. different OS levels, different
    built tools, different available CPU architectures.

    This customization is performed whenever
    distutils.sysconfig.get_config_vars() is first
    called.  It may be used in environments where no
    compilers are present, i.e. when installing pure
    Python dists.  Customization of compiler paths
    and detection of unavailable archs is deferred
    until the first extension module build is
    requested (in distutils.sysconfig.customize_compiler).

    Currently called from distutils.sysconfig
    )rSrardrg)rDr#r#r$rps
	


cCs"t|�t|�t|�|S)z�Customize compiler path and configuration variables.

    This customization is performed when the first
    extension module build is requested
    in distutils.sysconfig.customize_compiler).
    )r\rbrd)rDr#r#r$r�s	


c
Cs|jdd�}t�p|}|p*|}|r�|}d}|jtd|jdd��}|r�y0tdd�|jd�dd	�D��}Wq�tk
r�d}Yq�Xnd}|dkr�d|j�kr�d
}tjd|�}tt	t
|���}t|�dkr(|d}q�|dkr=d
}q�|d krRd}q�|d!krgd}q�|d"kr|d}q�|d#kr�d}q�td|f��q�|dkr�tj
d$kr�d}q�q�|d%kr�tj
d&kr�d}q�d}q�n|||fS)'z Filter values for get_platform()�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

0

						)zCFLAGSzLDFLAGSzCPPFLAGSz
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXXz	PY_CFLAGSz
PY_LDFLAGSzPY_CPPFLAGSzPY_CORE_CFLAGS)r}r~rr�)�__doc__rr;r�__all__r]rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$�<module>s<	>(@)

?>