AlkantarClanX12

Your IP : 3.149.214.223


Current Path : /lib64/python3.8/__pycache__/
Upload File :
Current File : //lib64/python3.8/__pycache__/_osx_support.cpython-38.pyc

U

e5dU�@s�dZddlZddlZddlZddddgZdZdZd	Zd-d
d�Zd.d
d�Z	dd�Z
dadd�Zda
dd�Zdd�Zdd�Zdadd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�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�|D]&}tj�	||�}tj�|�rX|SqXdS|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�$/usr/lib64/python3.8/_osx_support.py�_find_executables

rFc
Cs�ddl}zddl}|��}Wn(tk
rDtdt��fd�}YnX|�|��P}|rfd||jf}nd||jf}t�	|�s�|�
��d���ndW5QR�SQRXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz
%s >'%s' 2>&1z%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfileZNamedTemporaryFile�ImportError�openr�getpid�closing�name�system�read�decode�strip)Z
commandstringZcapture_stderrrr�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_toolMs
��r-cCsxtdkrtdaztd�}Wntk
r,YnHXzt�d|���}W5|��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�close�re�searchr&r�groupr)r�mrrr�_get_system_versionVs
�
r8cCsLtdkrHt�}|rHztdd�|�d�D��aWntk
rFdaYnXtS)z}
    Return the macOS system version as a tuple

    The return value is safe to use to compare
    two version numbers.
    Ncss|]}t|�VqdS�N��int��.0�irrr�	<genexpr>�sz,_get_system_version_tuple.<locals>.<genexpr>r.r)�_SYSTEM_VERSION_TUPLEr8�tupler�
ValueError�Zosx_versionrrr�_get_system_version_tupleus
rDcCs"t|�D]}|�t�r||=qdS)z-Remove original unmodified values for testingN)�list�
startswith�_INITPRE)�_config_vars�krrr�_remove_original_values�s
rJcCs8|�|d�}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr,N)�getrG)rH�cvZnewvalueZoldvaluerrr�_save_modified_value�srMcCs�tdk	rtStd|fd�}d}|��D]T}|�d�r<d}q(|�d�rLd}q(|r(|��}|dkrfdaq(|�d	�r(|dd
�aq(tdkr�datS)z= Returns the root of the default SDK for this system, or '/' Nz%s -c -E -v - </dev/nullTFz#include <...>zEnd of search listz/usr/include�/z.sdk/usr/includei�)�_cache_default_sysrootr+�
splitlinesrFr(�endswith)�cc�contentsZ
in_incdirs�linerrr�_default_sysroot�s$


rUcCst�}|rt|dk�SdS)z=Returns True if universal builds are supported on this system��
�F)rD�boolrCrrr�_supports_universal_builds�srZcCst�}|r|dkSdS)z9Returns True if arm64 builds are supported on this system)�rF)rDrCrrr�_supports_arm64_builds�sr\cCs�dtjkr|S|d��d}}t|�s4td�}n<tj�|��d�rptd|�	dd�f�}|rpd|krptd�}|s|t
d	��||kr�tD]L}||kr�|tjkr�||��}|d
kr�|n|d|d<t||d�
|��q�|S)
z7Find appropriate C compiler for extension module buildsr	rZclangZgccz'%s' --version�'�'"'"'zllvm-gcczCannot locate working compilerr
z++� )rr
rrr-r�basenamerFr+�replace�SystemError�_COMPILER_CONFIG_VARSrMr)rHrRZoldcc�datarLZcv_splitrrr�_find_appropriate_compiler�s,

��recCsVtD]L}||kr|tjkr||}tjdd|tjd�}t�dd|�}t|||�q|S)z5Remove all universal build arguments from config vars�
-arch\s+\w+\sr_)�flagsz-isysroot\s*\S+)�_UNIVERSAL_CONFIG_VARSrr
r4�sub�ASCIIrM)rHrLrgrrr�_remove_universal_flagssrkcCs�dtjkr|St�d|d�dk	r�t�d|d�dd�f�}|r�tD]8}||krF|tjkrF||}t�dd	|�}t|||�qF|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/nullr]r^z-arch\s+ppc\w*\sr_)	rr
r4r5r%rarhrirM)rHZstatusrLrgrrr�_remove_unsupported_archss
��	rlcCsddtjkr`tjd}tD]F}||krd||kr||}t�dd|�}|d|}t|||�q|S)z2Allow override of all archs with ARCHFLAGS env var�	ARCHFLAGS�-archrfr_)rr
rhr4rirM)rHZarchrLrgrrr�_override_all_archs:s

rocCsx|�dd�}t�d|�}|dk	rt|�d�}tj�|�sttD]8}||kr:|tjkr:||}t�	dd|�}t
|||�q:|S)z+Remove references to any SDKs not availablerr,z-isysroot\s*(\S+)Nr/z-isysroot\s*\S+(?:\s|$)r_)rKr4r5r6rr�existsrhr
rirM)rH�cflagsr7ZsdkrLrgrrr�_check_for_unavailable_sdkKs
rrc
Cs�d}}t|�}t�s d}}nd|k}tdd�|D��}|sHdtjkr�z|�d�}|||d�=WqHtk
r|Yq�YqHXqHnFt�s�tt	t
|���D].}||dkr�||dd	kr�|||d�=q�dtjkr�|s�|tjd��}|�r@d
d�t|�D�}|�s
�q@|d}||d
k�r0|||d�=q�|||d�=q�d}|}dd�t|�D�}|�sv|}dd�t|�D�}|D]B}||d
k�r�||d}�q�n||t
d
�d�}�q��qz|�r�tj
�|��s�ddlm}	|	�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.
    FTrncss|]}|�d�r|VqdS)�	-isysrootN�rF)r=�argrrrr?ys
z!compiler_fixup.<locals>.<genexpr>rmr0r/�arm64cSsg|]\}}|�d�r|�qS�rsrt�r=r>�xrrr�
<listcomp>�s
z"compiler_fixup.<locals>.<listcomp>rrsNcSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
cSsg|]\}}|�d�r|�qSrwrtrxrrrrz�s
)�logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)rErZ�anyrr
�indexrBr\�reversed�range�lenr�	enumerater�isdirZ	distutilsr{�warn)
Zcompiler_soZcc_argsZ	stripArchZstripSysrootr}�idx�indicesZsysrootZargvarr{rrrrfsZ	


�
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
    )rZrkrorr�rHrrrr�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).
    )rerlror�rrrr�s	cCs�|�dd�}t�p|}|p|}|�r�|}d}|�td|�dd��}|r�z$tdd�|�d�dd	�D��}Wq�tk
r�d
}Yq�Xnd
}|dk�rFd|��k�rFd
}t�d|�}tt	t
|���}t|�dkr�|d}nj|dkr�d}n\|dkr�d
}nN|dk�rd}n>|dk�rd}n.|dk�r&d}n|dk�r6d}ntd|f��n<|dk�rbtj
dk�r�d}n |dk�r�tj
dk�r~d }nd!}|||fS)"z Filter values for get_platform()ZMACOSX_DEPLOYMENT_TARGETr,Zmacosxrcss|]}t|�VqdSr9r:r<rrrr?sz#get_platform_osx.<locals>.<genexpr>r.rr0)rWrrVrnZfatz
-arch\s+(\S+)r/)rv�x86_64Z
universal2)�i386�ppc)r�r�Zintel)r�r�r�Zfat3)�ppc64r�Zfat64)r�r�r�r�Z	universalz%Don't know machine value for archs=%rr�lr�)ZPowerPCZPower_Macintoshr�r�)rKr8rGrArrBr(r4�findall�sorted�setr�r�maxsize)rHZosname�release�machineZmacverZ
macreleaserqZarchsrrrr�sX



�$




�

)N)F)�__doc__rr4r�__all__rhrcrGrr+r-r1r8r@rDrJrMrOrUrZr\rerkrlrorrrrrrrrrr�<module>sB�


	

>(Q)