�
c��jV � � � d Z ddlZddlZddlZg d�ZdZdZdZdd�Zdd�Z d � Z
dad
� Zda
d� Zd� Zd
� Zdad� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zy)zShared 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_CFLAGS�PY_CORE_LDFLAGS)r r r
r �_OSX_SUPPORT_INITIAL_c �� � |�t j d }|j t j � }t j j | � \ }}t j dk( r
|dk7 r| dz } t j j | � sK|D ]E }t j j || � }t j j |� s�C|c S y| S )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�base�ext�p�fs �%/usr/lib64/python3.12/_osx_support.py�_find_executabler) s� � � �|��z�z�&�!���J�J�r�z�z�"�E���� � ��,�I�D�#������c�V�m��&�(�
�
�7�7�>�>�*�%��A������Q�
�+�A��w�w�~�~�a� ��� �
��� c � � ddl } ddl}|j � }|j |� 5 }|r| �d|j �d�}n| �d|j �d�}t j |� s-|j � j d � j � ndcddd� S # t $ r$ t dt j � ��d� }Y ��w xY w# 1 sw Y yxY w)
z0Output from successful command execution or Noner Nz/tmp/_osx_support.zw+bz >'z' 2>&1z 2>/dev/null >'�'�utf-8)
�
contextlib�tempfile�NamedTemporaryFile�ImportError�openr �getpid�closing�name�system�read�decode�strip)�
commandstring�capture_stderrr. r/ �fp�cmds r( �_read_outputr> 7 s� � � �"��
�
(�
(�
*��
� � �B� �2��%2�B�G�G�<�C�,9�2�7�7�C�C�8:� � �#��r�w�w�y����(�.�.�0�D�
� �� � "�
��I�I�K�� �"��"��
� �s �B �A+C� *C
�C
�Cc �@ � t | � xs t d| ��� xs dS )z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find � )r) r> )�toolnames r( �_find_build_toolrB M s' � ��X�&�
��X� G�H�
��r* c �j � t �da t dd�� } t j d| j � � }| j � |�2dj
|j d� j d� dd � a t S t S # | j � w xY w# t $ r Y t S w xY w)
z*Return the OS X system version as a stringNr@ z0/System/Library/CoreServices/SystemVersion.plistr- )�encodingz=