a
ÕDOg
U ã @ sÜ d Z ddlZddlZddlZg d¢ZdZdZdZd.dd„Zd/d
d„Z 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_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Œ |du rt jd }| t j¡}t j | ¡\}}tjdkrH|dkrH| d } t j | ¡s„|D ]&}t j || ¡}t j |¡rX| S qXdS | S dS )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ÚPATHZwin32z.exe)
ÚosÚenvironÚsplitÚpathsepÚpathÚsplitextÚsysÚplatformÚisfileÚjoin)Ú
executabler ÚpathsÚbaseZextÚpÚf© r ú1/opt/alt/python39/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 s¦0 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)
Ú
contextlibÚtempfileZNamedTemporaryFileÚ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 )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 rzda ztdƒ} W n ty* Y nP0 zt d| ¡ ¡}W | ¡ n
| ¡ 0 |durzd | d¡ d¡dd… ¡a t S )z*Return the OS X system version as a stringNr, z0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)Ú.é é )
Ú_SYSTEM_VERSIONr! ÚOSErrorÚreÚsearchr&