f ž _Lc@s¶ddlZddlZddlZgd¢ZdZdZdZd&dd„Zdd „Zd d „Z da d d „Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„ZdS)'éN)Úcompiler_fixupÚcustomize_config_varsÚcustomize_compilerÚget_platform_osx) ÚCFLAGSZLDFLAGSZCPPFLAGSZ BASECFLAGSÚ BLDSHAREDÚLDSHAREDÚCCÚCXXZ PY_CFLAGSZ PY_LDFLAGSZ PY_CPPFLAGSZPY_CORE_CFLAGSZPY_CORE_LDFLAGS)rrrr Z_OSX_SUPPORT_INITIAL_cCs†|durtjd}| tj¡}tj |¡\}}tjdkrH|dkrH|d}tj |¡s‚|D]$}tj  ||¡}tj |¡rX|SdS|S)NZPATHZwin32z.exe) ÚosÚenvironÚsplitZpathsepÚpathZsplitextÚsysZplatformZisfileÚjoin)Z executabler ZpathsZbaseZextZpÚf©rú%/usr/lib64/python3.10/_osx_support.pyÚ_find_executables    rcCs ddl}zddl}| ¡}Wn&tyBtdt ¡fdƒ}Yn0| |¡>}d||jf}t  |¡sz|  ¡  d¡  ¡ndWdƒS1s’0YdS)Nrz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8) Ú contextlibÚtempfileZNamedTemporaryFileZ ImportErrorÚopenr ZgetpidZclosingZnameÚsystemÚreadZdecodeÚstrip)Z commandstringrrZfpZcmdrrrÚ _read_output7s  ÿÿ  rcCst|ƒptd|fƒpdS)Nz/usr/bin/xcrun -find %sÚ)rr)ZtoolnamerrrÚ_find_build_toolJs  ÿþrcCs~tdurzdaz tdƒ}Wnty*YnP0zt d| ¡¡}W| ¡n | ¡0|durzd | d¡  d¡dd…¡atS)Nrz0/System/Library/CoreServices/SystemVersion.plistz=ProductUserVisibleVersion\s*(.*?)Ú.éé) Ú_SYSTEM_VERSIONrZOSErrorÚreÚsearchrZcloserÚgroupr )rÚmrrrÚ_get_system_versionSs   ÿr%cCs"t|ƒD]}| t¡r||=qdS©N)ÚlistÚ startswithÚ_INITPRE)Ú _config_varsZkrrrÚ_remove_original_valuesqs  r+cCs8| |d¡}||kr,t||vr,||t|<|||<dS)Nr)Úgetr))r*ÚcvZnewvalueZoldvaluerrrÚ_save_modified_valuexs  r.cCsRtƒ}|r>ztdd„| d¡Dƒƒ}Wnty<d}Yn0|rNt|dkƒSdS)Ncsó|]}t|ƒVqdSr&©Zint©Ú.0ÚirrrÚ Šóz-_supports_universal_builds..rr©é iF)r%Útupler Ú ValueErrorZbool)Z osx_versionrrrÚ_supports_universal_builds€s  r:cCsÚdtjvr|S|d ¡d}}t|ƒs4tdƒ}n/dev/nullr;r<z-arch\s+ppc\w*\sr=) r r r!r"rr>rCrDr.)r*Zstatusr-rBrrrÚ_remove_unsupported_archsÜs þÿ rFcCsddtjvr`tjd}tD]F}||vrd||vr||}t dd|¡}|d|}t|||ƒq|S)NÚ ARCHFLAGSú-archrAr=)r r rCr!rDr.)r*Zarchr-rBrrrÚ_override_all_archss   rIcCsx| dd¡}t d|¡}|durt| d¡}tj |¡sttD]8}||vr:|tjvr:||}t  dd|¡}t |||ƒq:|S)Nrrz-isysroot\s*(\S+)rz-isysroot\s*\S+(?:\s|$)r=) r,r!r"r#r r ZexistsrCr rDr.)r*Úcflagsr$Zsdkr-rBrrrÚ_check_for_unavailable_sdks    rKc Cs¦d}}t|ƒ}tƒs d}}nd|v}tdd„|Dƒƒ}|sHdtjvr|z| d¡}|||d…=WqHtyzYq|YqH0dtjvrœ|sœ|tjd ¡}|rìdd „t|ƒDƒ}|s¸qì|d }||d krÜ|||d…=q |||d …=q d}|}d d „t|ƒDƒ}|s"|}dd „t|ƒDƒ}|D]D}||d krN||d }qlq&||t d ƒd…}qlq&|r¢tj   |¡s¢d dl m } |  d|¡|  d¡|S)NFTrHcss|]}| d¡r|VqdS)ú -isysrootN©r()r2Zargrrrr4Cr5z!compiler_fixup..rGrcSóg|]\}}| d¡r|‘qS©rLrM©r2r3ZxrrrÚ Ur5z"compiler_fixup..rrLrcSrNrOrMrPrrrrQer5cSrNrOrMrPrrrrQhr5)Úlogz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)r'r:Zanyr r Úindexr9r Z enumerateÚlenr ZisdirZ distutilsrRZwarn) Z compiler_soZcc_argsZ stripArchZ stripSysrootrSZindicesZsysrootZargvarZidxrRrrrr0sR          ÿ rcCs"tƒst|ƒt|ƒt|ƒ|Sr&)r:rErIrK©r*rrrr{s rcCst|ƒt|ƒt|ƒ|Sr&)r@rFrIrUrrrr¤s rcCsx| dd¡}tƒp|}|p|}|rn|}d}| td| dd¡¡}|r„z$tdd„| d¡dd …Dƒƒ}Wnty‚d }Yn0d }|d kr2d | ¡vr2d }t d|¡}tt t |ƒƒƒ}t |ƒdkrÖ|d}n˜|dkräd }nŠ|dkròd}n||dkrd}nl|dkrd}n\|dkr"d}nLtd|fƒ‚n<|dkrNt j dkrnd}n |dvrnt j dkrjd}nd}|||fS) NZMACOSX_DEPLOYMENT_TARGETrZmacosxrcsr/r&r0r1rrrr4Òr5z#get_platform_osx..rrr)r7rr6rHZfatz -arch\s+(\S+)r)Úi386Úppc)rVÚx86_64Zintel)rVrWrXZfat3)Úppc64rXZfat64)rVrWrYrXZ universalz%Don't know machine value for archs=%rrVlrX)ZPowerPCZPower_MacintoshrYrW)r,r%r)r8r r9rr!ZfindallZsortedZsetrTrZmaxsize)r*ZosnameZreleaseZmachineZmacverZ macreleaserJZarchsrrrr¸sT    ÿ$        ÿ    rr&)r r!rZ__all__rCr?r)rrrr r%r+r.r:r@rErFrIrKrrrrrrrrZs.  >(K)