a
DOg
U @ 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 rt jd }|t j}t j| \}}tjdkrH|dkrH| d } t j| s|D ]&}t j || }t j|rX| S qXdS | S dS )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.
NPATHwin32z.exe)
osenvironsplitpathseppathsplitextsysplatformisfilejoin)
executabler pathsbaseextpf r $/usr/lib64/python3.9/_osx_support.py_find_executable s
r Fc C s ddl }zddl}| }W n& tyB tdt f d}Y n0 ||R}|rdd| |jf }nd| |jf }t |s|
d ndW d S 1 s0 Y dS )z0Output from successful command execution or Noner Nz/tmp/_osx_support.%szw+bz
%s >'%s' 2>&1z%s 2>/dev/null >'%s'zutf-8)
contextlibtempfileNamedTemporaryFileImportErroropenr
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
r0 c C s~ t du rzda ztd} W n ty* Y nP0 ztd| }W | n
| 0 |durzd|d ddd a t S )z*Return the OS X system version as a stringNr/ z0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?). )
_SYSTEM_VERSIONr$ OSErrorresearchr) closer groupr )r mr r r _get_system_versionV s
r; c C sJ t du rFt } | rFztdd | dD a W n tyD da Y n0 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 s | ]}t |V qd S Nint.0ir r r