a
�DOg
U � @ s� d dl Z d dlZd dlZg d�ZdZdZdZd-dd�Zd.d d
�Zdd� Z da
d
d� Zdadd� Z
dd� Zdd� Zdadd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� ZdS )/� 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)r r r r
Z_OSX_SUPPORT_INITIAL_c C s� |d u rt jd }|�t j�}t j�| �\}}tjdkrH|dkrH| d } t j�| �s�|D ]&}t j� || �}t j�|�rX| S qXd S | S d S )N�PATH�win32z.exe)
�os�environ�split�pathsep�path�splitext�sys�platform�isfile�join)�
executabler �paths�base�ext�p�f� r �$/usr/lib64/python3.9/_osx_support.py�_find_executable s
r Fc C s� dd l }zdd l}|�� }W n& tyB tdt�� f d�}Y n0 |�|��R}|rdd| |jf }nd| |jf }t� |�s�|�
� �d��� nd W d � S 1 s�0 Y d S )Nr z/tmp/_osx_support.%szw+bz
%s >'%s' 2>&1z%s 2>/dev/null >'%s'zutf-8)
�
contextlib�tempfile�NamedTemporaryFile�ImportError�openr
�getpid�closing�name�system�read�decode�strip)Z
commandstringZcapture_stderrr r! �fp�cmdr r r �_read_output7 s ��
r. c C s t | �ptd| f �pdS )Nz/usr/bin/xcrun -find %s� )r r. )Ztoolnamer r r �_find_build_toolM s
��r0 c C s~ t d u rzda ztd�} W n ty* Y nP0 zt�d| �� �}W | �� n
| �� 0 |d urzd�|�d�� d�d d� �a t S )Nr/ z0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)�.� � )
�_SYSTEM_VERSIONr$ �OSError�re�searchr) �closer �groupr )r �mr r r �_get_system_versionV s
�r; c C sJ t d u rFt� } | rFztdd� | �d�D ��a W n tyD da Y n0 t S )Nc s s | ]}t |�V qd S �N��int��.0�ir r r � � � z,_get_system_version_tuple..r1 r )�_SYSTEM_VERSION_TUPLEr; �tupler �
ValueError�Zosx_versionr r r �_get_system_version_tupleu s
rH c C s" t | �D ]}|�t�r| |= qd S r<