grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026 ”qc«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}|jtjƒ}tjj|ƒ\}}tjdkrh|dkrh|d}tjj|ƒ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/python35/lib64/python3.5/_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 ƒSdSWdQRXdS)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 r6YnbXztjd|jƒƒ}Wd|jƒX|dk r˜dj|jdƒj dƒdd…ƒatS)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     +r@cCs1x*t|ƒD]}|jtƒr ||=q WdS)z-Remove original unmodified values for testingN)ÚlistÚ startswithÚ_INITPRE)Ú _config_varsÚkr#r#r$Ú_remove_original_valuesqsrFcCsJ|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 &  rScCs5dtjkr|S|djƒd}}t|ƒsFtdƒ}nXtjj|ƒjdƒržtd|j ddƒfƒ}|ržd|kržtdƒ}|s°t d ƒ‚||kr1xrt D]j}||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}xgtD]_}||kr#d||kr#||}tjdd|ƒ}|d|}t|||ƒq#W|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¬xXtD]P}||krX|tjkrX||}tj dd|ƒ}t |||ƒqXW|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šx>y$|jdƒ}|||d…=Wq\tk r•PYq\Xq\WdtjkrÇ| rÇ|tjdjƒ}|rx>y$|jdƒ}|||d…=WqÐtk r PYqÐXqÐWd}d|kr@|jdƒ}||d}n)d|kri|jdƒ}||d}|r¯tjj|ƒ r¯d d l m }|j d |ƒ|j d ƒ|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|ƒt|ƒ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ƒ‚nN|dkrËt j d$krõd}n*|d%krõt j d&krïd}nd}|||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                ) rrrr r r r r rrrr)r r r r )Ú__doc__rr;rÚ__all__r^rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$Ús<           >  (   @ )