o
?OgU @ s d Z ddlZddlZddlZg dZdZdZdZd.ddZd/d
dZ dd
Z
dadd Zda
dd Zdd Zdd Zdadd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- ZdS )0zShared OS X support functions. N)compiler_fixupcustomize_config_varscustomize_compilerget_platform_osx)
CFLAGSZLDFLAGSZCPPFLAGSZ
BASECFLAGS BLDSHAREDLDSHAREDCCCXXZ PY_CFLAGSZ
PY_LDFLAGSZPY_CPPFLAGSZPY_CORE_CFLAGSZPY_CORE_LDFLAGS)r r r r
Z_OSX_SUPPORT_INITIAL_c C s |du r t jd }|t j}t j| \}}tjdkr$|dkr$| d } t j| sB|D ]}t j || }t j|r?| S q,dS | S )zTries 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.
NPATHZwin32z.exe)
osenvironsplitpathseppathsplitextsysplatformisfilejoin)
executabler pathsbaseZextpf r 3/opt/alt/python310/lib64/python3.10/_osx_support.py_find_executable s
r Fc C s ddl }z
ddl}| }W n ty! tdt f d}Y nw ||)}|r2d| |jf }nd| |jf }t |sG|
d ndW d S 1 sSw Y dS )z0Output from successful command execution or Noner Nz/tmp/_osx_support.%szw+bz
%s >'%s' 2>&1z%s 2>/dev/null >'%s'utf-8)
contextlibtempfileZNamedTemporaryFileImportErroropenr getpidclosingnamesystemreaddecodestrip)Z
commandstringZcapture_stderrr r fpcmdr r r _read_output7 s" $r, c C s t | ptd| f pdS )z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s )r r, )Ztoolnamer r r _find_build_toolM s
r. c C s t du r@da ztddd} W n
ty Y t S w ztd| }W | n| w |dur@d|d ddd a t S )
z*Return the OS X system version as a stringNr- z0/System/Library/CoreServices/SystemVersion.plistr )encodingz=ProductUserVisibleVersion\s*(.*?). )
_SYSTEM_VERSIONr" OSErrorresearchr' closer groupr )r mr r r _get_system_versionV s
r: c C sN t du r%t } | r%ztdd | dD a W t S ty$ da Y t S w t S )z}
Return the macOS system version as a tuple
The return value is safe to use to compare
two version numbers.
Nc s | ]}t |V qd S Nint.0ir r r