�
�WcU c s� � 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� 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)r r r r Z_OSX_SUPPORT_INITIAL_c s� � |�t j d }|j t j � }t j j | � \ }}t j dk r|dk r| dz } t j j | � sO|D ]I }t j j || � }t j j |� s�G|c S dS | 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.
NZPATHZwin32z.exe)
�os�environ�splitZpathsep�pathZsplitext�sysZplatformZisfile�join)Z
executabler
ZpathsZbaseZextZp�fs �%/usr/lib64/python3.12/_osx_support.py�_find_executabler s� � � �|��z�z�&�!���J�J�r�z�z�"�E���� � ��,�I�D�#�������c�V�m�m��&�(�
�
�7�7�>�>�*�%�%�� � �A������Q�
�+�A��w�w�~�~�a� � �������t��� Fc s� � ddl } ddl}|j � }|j |� 5 }|r| �d|j �d�}n| �d|j �d�}t j |� s0|j � j d � j � ndcddd� S # t $ r( t dt j � ��d� }Y ��w xY w# 1 sw Y dS xY w)
z0Output from successful command execution or Noner Nz/tmp/_osx_support.zw+bz >'z' 2>&1z 2>/dev/null >'�'�utf-8)
�
contextlib�tempfileZNamedTemporaryFileZImportError�openr
ZgetpidZclosingZname�system�readZdecode�strip)Z
commandstringZcapture_stderrr r ZfpZcmd� r �_read_outputr 7 sN � � ����"�����
�
(�
(�
*��
� � �B� � Q�2��>�%2�]�]�B�G�G�G�G�<�C�C�,9�M�M�2�7�7�7�7�C�C�8:� � �#���r�w�w�y����(�.�.�0�0�D�Q� Q� Q� Q� Q� Q� Q�� � "� "� "�
�T��I�I�K�K�� �"����"����Q� Q� Q� Q� Q� Q� Q� Q� Q� Q���s �B( �A0C�(/C�C�C'c s@ � t | � pt d| ��� pdS )z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find � )r r )Ztoolname� r �_find_build_toolr M s+ � ��X�&�
��<�X�X� G�H�
��r c s� � t ��da t dd�� } t j d| j � � }| j � |�5dj
|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 )Zencodingz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>�.� � )
�_SYSTEM_VERSIONr �re�searchr Zcloser �groupr ZOSError)r �m� r �_get_system_versionr* V s� � � ����
F��G�RY�Z�Z�A�
��I�I� 8�9:����C�� ��� � ��}�"%�(�(�1�7�7�1�:�+;�+;�C�+@��!�+D�"E�� ��?��� ��� � � � � � �� � � � �
� �� ���s �B. �'B �B+�.
C� Cc s� � t �;t � } | r- t d� | j d� D � � a t S t S # t $ r da Y t S w xY w)z}
Return the macOS system version as a tuple
The return value is safe to use to compare
two version numbers.
Nc 3 �2 K � | ] }t |� �� �d S �N�Zint��.0�ir) r � <genexpr>z,_get_system_version_tuple.<locals>.<genexpr>� s"