grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î ¤ f�Jã @sdZddlZddlZddlZddddgZd0Zd1ZdZddd„Zdd„Z dd„Z da dd„Z dd„Z dd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d„Zd-d„Zd.d„Zd/d„ZdS)2zShared 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_CFLAGSZ_OSX_SUPPORT_INITIAL_cCsÈ|dkrtjd}n|jtjƒ}tjj|ƒ\}}tjdkrn|dkrn|d}ntjj|ƒsÀx9|D]1}tjj ||ƒ}tjj|ƒr‡|Sq‡WdS|SdS)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ÚbaseZextÚpÚf©r#ú1/opt/alt/python34/lib64/python3.4/_osx_support.pyÚ_find_executables   r%cCs´ddl}yddl}|jƒ}Wn.tk rXtdtjƒfdƒ}YnX|j|ƒ�F}d||jf}tj |ƒs¦|j ƒj dƒj ƒSdSWdQXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8) Ú contextlibÚtempfileZNamedTemporaryFileÚ ImportErrorÚopenrÚgetpidÚclosingÚnameÚsystemÚreadÚdecodeÚstrip)Z commandstringr&r'ÚfpÚcmdr#r#r$Ú _read_output7s   r3cCs#t|ƒp"td|fƒp"dS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %sÚ)r%r3)Ztoolnamer#r#r$Ú_find_build_toolJs r5cCs¢tdkrždaytdƒ}Wntk r6YqžXztjd|jƒƒ}Wd|jƒX|dk rždj|jdƒj dƒdd…ƒaqžntS)z*Return the OS X system version as a stringNr4z0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)Ú.éé) Ú_SYSTEM_VERSIONr)ÚOSErrorÚreÚsearchr.ÚcloserÚgroupr)r"Úmr#r#r$Ú_get_system_versionSs     1r@cCs4x-t|ƒD]}|jtƒr ||=q q WdS)z-Remove original unmodified values for testingN)ÚlistÚ startswithÚ_INITPRE)Ú _config_varsÚkr#r#r$Ú_remove_original_valuesqsrFcCsM|j|dƒ}||kr?t||kr?||t|Šsz-_supports_universal_builds..r6r4é éF)rNrO)r@ÚtuplerÚ ValueErrorÚbool)Z osx_versionr#r#r$Ú_supports_universal_builds€s & rScCsDdtjkr|S|djƒd}}t|ƒsFtdƒ}n^tjj|ƒjdƒr¤td|j ddƒfƒ}|r¤d|kr¤tdƒ}q¤n|s¹t d ƒ‚n||kr@xxt D]m}||krÌ|tjkrÌ||jƒ}|d kr|n|d |d/dev/nullrUz'"'"'z-arch\s+ppc\w*\srV) rrr;r<r-rXr]r^rI)rDZstatusrHr`r#r#r$Ú_remove_unsupported_archsÜs   rbcCs�dtjkrŒtjd}xmtD]b}||kr#d||kr#||}tjdd|ƒ}|d|}t|||ƒq#q#Wn|S)z2Allow override of all archs with ARCHFLAGS env varÚ ARCHFLAGSz-archz -arch\s+\w+\srV)rrr]r;r^rI)rDZarchrHr`r#r#r$Ú_override_all_archss   rdcCs¹|jddƒ}tjd|ƒ}|dk rµ|jdƒ}tjj|ƒsµx^tD]S}||krX|tjkrX||}tj dd|ƒ}t |||ƒqXqXWqµn|S)z+Remove references to any SDKs not availablerr4z-isysroot\s+(\S+)Nr7z-isysroot\s+\S+(?:\s|$)rV) rGr;r<r>rrÚexistsr]rr^rI)rDÚcflagsr?ZsdkrHr`r#r#r$Ú_check_for_unavailable_sdks    rgc CsÂd}}t|ƒ}tƒs,d}}nd|k}d|k}|sYdtjkr�xAy$|jdƒ}|||d…=Wq\tk r•PYq\Xq\WndtjkrÍ| rÍ|tjdjƒ}n|rxAy$|jdƒ}|||d…=WqÖtk rPYqÖXqÖWnd}d|krI|jdƒ}||d}n,d|kru|jdƒ}||d}n|r¾tjj|ƒ r¾d d l m }|j d |ƒ|j d ƒn|S) ae This function will strip '-isysroot PATH' and '-arch ARCH' from the compile flags if the user has specified one them in extra_compile_flags. This is needed because '-arch ARCH' adds another architecture to the build, without a way to remove an architecture. Furthermore GCC will barf if multiple '-isysroot' arguments are present. FTz-archz -isysrootrcr8Nr7r)Úlogz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation) rArSrrÚindexrQrrÚisdirZ distutilsrhÚwarn)Z compiler_soZcc_argsZ stripArchZ stripSysrootriZsysrootÚidxrhr#r#r$r0sF             cCs.tƒst|ƒnt|ƒt|ƒ|S)aöCustomize Python build configuration variables. Called internally from sysconfig with a mutable mapping containing name/value pairs parsed from the configured makefile used to build this interpreter. Returns the mapping updated as needed to reflect the environment in which the interpreter is running; in the case of a Python from a binary installer, the installed environment may be very different from the build environment, i.e. different OS levels, different built tools, different available CPU architectures. This customization is performed whenever distutils.sysconfig.get_config_vars() is first called. It may be used in environments where no compilers are present, i.e. when installing pure Python dists. Customization of compiler paths and detection of unavailable archs is deferred until the first extension module build is requested (in distutils.sysconfig.customize_compiler). Currently called from distutils.sysconfig )rSrardrg)rDr#r#r$rps     cCs"t|ƒt|ƒt|ƒ|S)zÅCustomize compiler path and configuration variables. This customization is performed when the first extension module build is requested in distutils.sysconfig.customize_compiler). )r\rbrd)rDr#r#r$r™s   c Cs |jddƒ}tƒp|}|p*|}|rþ|}d}|jtd|jddƒƒ}|rµy0tdd„|jdƒdd …Dƒƒ}Wq»tk r±d}Yq»Xnd}|dkr§d |jƒkr§d }tjd|ƒ}tt t |ƒƒƒ}t |ƒdkr(|d}qû|dkr=d }qû|d krRd}qû|d!krgd}qû|d"kr|d}qû|d#kr‘d}qûtd|fƒ‚qþ|dkrÎt j d$krûd}qûqþ|d%krþt j d&kròd}qûd}qþn|||fS)'z Filter values for get_platform()ÚMACOSX_DEPLOYMENT_TARGETr4Zmacosxrcss|]}t|ƒVqdS)N)rJ)rKrLr#r#r$rMÇsz#get_platform_osx..r6rr8rNrOz-archZfatz -arch\s+(\S+)r7Úi386ÚppcÚx86_64ZintelZfat3Úppc64Zfat64Z universalz%Don't know machine value for archs=%ré ÚPowerPCÚPower_Macintosh)rNr)rNr)rNrO)rnro)rnrp)rnrorp)rqrp)rnrorqrpl)rsrtl)rGr@rCrPrrQr0r;ÚfindallÚsortedÚsetÚlenrÚmaxsize)rDÚosnameÚreleaseÚmachineZmacverZ macreleaserfZarchsr#r#r$r­sP   0                 ) zCFLAGSzLDFLAGSzCPPFLAGSz BASECFLAGSú BLDSHAREDúLDSHAREDúCCúCXXz PY_CFLAGSz PY_LDFLAGSz PY_CPPFLAGSzPY_CORE_CFLAGS)r}r~rr€)Ú__doc__rr;rÚ__all__r]rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$Ús<           >  (   @ )