Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/_osx_support.cpython-37.pyc

B

� f�L�@s�dZddlZddlZddlZddddgZdZdZd	Zd&d
d�Zdd
�Z	dd�Z
dadd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d�Zd#d�Zd$d�Zd%d�ZdS)'zShared OS X support functions.�N�compiler_fixup�customize_config_vars�customize_compiler�get_platform_osx)
�CFLAGSZLDFLAGSZCPPFLAGSZ
BASECFLAGS�	BLDSHARED�LDSHARED�CC�CXXZ	PY_CFLAGSZ
PY_LDFLAGSZPY_CPPFLAGSZPY_CORE_CFLAGSZPY_CORE_LDFLAGS)rrr	r
Z_OSX_SUPPORT_INITIAL_cCs�|dkrtjd}|�tj�}tj�|�\}}tjdkrH|dkrH|d}tj�|�s�x*|D]"}tj�	||�}tj�|�rZ|SqZWdS|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�PATHZwin32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler�paths�baseZext�p�f�r�1/opt/alt/python37/lib64/python3.7/_osx_support.py�_find_executables

rc	Cs�ddl}yddl}|��}Wn(tk
rDtdt��fd�}YnX|�|��0}d||jf}t�	|�s||�
��d���SdSQRXdS)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
commandstringrr�fp�cmdrrr�_read_output7sr+cCst|�ptd|f�pdS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s�)rr+)Ztoolnamerrr�_find_build_toolJsr-cCsxtdkrtdaytd�}Wntk
r,YnHXzt�d|���}Wd|��X|dk	rtd�|�d��	d�dd��atS)z*Return the OS X system version as a stringNr,z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.��)
�_SYSTEM_VERSIONr!�OSError�re�searchr&�closer�groupr)r�mrrr�_get_system_versionSs

r8cCs&x t|�D]}|�t�r
||=q
WdS)z-Remove original unmodified values for testingN)�list�
startswith�_INITPRE)�_config_vars�krrr�_remove_original_valuesqs
r>cCs8|�|d�}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr,N)�getr;)r<�cvZnewvalueZoldvaluerrr�_save_modified_valuexsrAcCsTt�}|r@ytdd�|�d�D��}Wntk
r>d}YnX|rPt|dk�SdS)z=Returns True if universal builds are supported on this systemcss|]}t|�VqdS)N)�int)�.0�irrr�	<genexpr>�sz-_supports_universal_builds.<locals>.<genexpr>r.r,)�
�F)r8�tupler�
ValueError�bool)Zosx_versionrrr�_supports_universal_builds�s
rKcCs�dtjkr|S|d��d}}t|�s4td�}n<tj�|��d�rptd|�	dd�f�}|rpd|krptd�}|s|t
d	��||kr�xTtD]L}||kr�|tjkr�||��}|d
kr�|n|d|d<t||d�
|��q�W|S)
z7Find appropriate C compiler for extension module buildsr	rZclangZgccz'%s' --version�'z'"'"'zllvm-gcczCannot locate working compilerr
z++� )rr
rrr-r�basenamer:r+�replace�SystemError�_COMPILER_CONFIG_VARSrAr)r<ZccZoldcc�datar@Zcv_splitrrr�_find_appropriate_compiler�s(


rScCsZxTtD]L}||kr|tjkr||}tjdd|tjd�}t�dd|�}t|||�qW|S)z5Remove all universal build arguments from config varsz
-arch\s+\w+\srM)�flagsz-isysroot\s*\S+)�_UNIVERSAL_CONFIG_VARSrr
r3�sub�ASCIIrA)r<r@rTrrr�_remove_universal_flags�s
rXcCs�dtjkr|St�d|d�dk	r�t�d|d�dd�f�}|r�x@tD]8}||krH|tjkrH||}t�dd	|�}t|||�qHW|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/nullrLz'"'"'z-arch\s+ppc\w*\srM)	rr
r3r4r%rOrUrVrA)r<Zstatusr@rTrrr�_remove_unsupported_archs�s
	
rYcCshdtjkrdtjd}xNtD]F}||krd||kr||}t�dd|�}|d|}t|||�qW|S)z2Allow override of all archs with ARCHFLAGS env var�	ARCHFLAGSz-archz
-arch\s+\w+\srM)rr
rUr3rVrA)r<Zarchr@rTrrr�_override_all_archss


r[cCs||�dd�}t�d|�}|dk	rx|�d�}tj�|�sxx@tD]8}||kr<|tjkr<||}t�	dd|�}t
|||�q<W|S)z+Remove references to any SDKs not availablerr,z-isysroot\s*(\S+)Nr/z-isysroot\s*\S+(?:\s|$)rM)r?r3r4r6rr�existsrUr
rVrA)r<�cflagsr7Zsdkr@rTrrr�_check_for_unavailable_sdks

r^c
Cs�d}}t|�}t�s d}}nd|k}tdd�|D��}|sHdtjkr�x8y|�d�}|||d�=WqJtk
r|PYqJXqJWdtjkr�|s�|tjd��}|r�xNdd	�t|�D�}|s�P|d
}||dkr�|||d�=q�|||d�=q�Wd
}|}dd	�t|�D�}|�s,|}dd	�t|�D�}xB|D]:}||dk�rT||d}Pn||t	d�d
�}P�q2W|�r�tj
�|��s�d
dlm
}	|	�d|�|	�d�|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-archcss|]}|�d�r|VqdS)z	-isysrootN)r:)rC�argrrrrECsz!compiler_fixup.<locals>.<genexpr>rZr0cSsg|]\}}|�d�r|�qS)z	-isysroot)r:)rCrD�xrrr�
<listcomp>Usz"compiler_fixup.<locals>.<listcomp>rz	-isysrootr/NcSsg|]\}}|�d�r|�qS)z	-isysroot)r:)rCrDr`rrrraescSsg|]\}}|�d�r|�qS)z	-isysroot)r:)rCrDr`rrrrahs)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)r9rK�anyrr
�indexrIr�	enumerate�lenr�isdirZ	distutilsrb�warn)
Zcompiler_soZcc_argsZ	stripArchZstripSysrootrd�indicesZsysrootZargvar�idxrbrrrr0sT	



cCs"t�st|�t|�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
    )rKrXr[r^)r<rrrr{s
cCst|�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).
    )rSrYr[)r<rrrr�s	cCs||�dd�}t�p|}|p|}|�rr|}d}|�td|�dd��}|r�y$tdd�|�d�dd	�D��}Wq�tk
r�d
}Yq�Xnd
}|dk�r6d|��k�r6d
}t�d|�}tt	t
|���}t|�dkr�|d}nZ|dkr�d
}nL|dkr�d}n>|dk�rd}n.|dk�rd}n|dk�r&d}ntd|f��n<|dk�rRtj
dk�rrd}n |dk�rrtj
dk�rnd}nd}|||fS) z Filter values for get_platform()ZMACOSX_DEPLOYMENT_TARGETr,Zmacosxrcss|]}t|�VqdS)N)rB)rCrDrrrrE�sz#get_platform_osx.<locals>.<genexpr>r.rr0)rFr)rFrGz-archZfatz
-arch\s+(\S+)r/)�i386�ppc)rk�x86_64Zintel)rkrlrmZfat3)�ppc64rmZfat64)rkrlrnrmZ	universalz%Don't know machine value for archs=%rrklrm)ZPowerPCZPower_Macintoshrnrl)r?r8r;rHrrIr(r3�findall�sorted�setrfr�maxsize)r<Zosname�release�machineZmacverZ
macreleaser]Zarchsrrrr�sP


$





)N)�__doc__rr3r�__all__rUrQr;rr+r-r1r8r>rArKrSrXrYr[r^rrrrrrrr�<module>s6
>(K)

Hacked By AnonymousFox1.0, Coded By AnonymousFox