ryMaIc @sdZddlZddlZddlZddddgZd0Zd1ZdZdddZ ddZ ddZ da ddZ ddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,dZd-dZd.dZd/dZdS(2uShared OS X support functions.iNucompiler_fixupucustomize_config_varsucustomize_compileruget_platform_osxuCFLAGSuLDFLAGSuCPPFLAGSu BASECFLAGSu BLDSHAREDuLDSHAREDuCCuCXXu PY_CFLAGSu PY_LDFLAGSu PY_CPPFLAGSuPY_CORE_CFLAGSu_OSX_SUPPORT_INITIAL_cCs|dkrtjd}n|jtj}tjj|\}}tjdksdtj dkr}|dkr}|d}ntjj |sx9|D]1}tjj ||}tjj |r|SqWdS|SdS(uTries 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. uPATHuwin32uos2u.exeN( uNoneuosuenvironusplitupathsepupathusplitextusysuplatformunameuisfileujoin(u executableupathupathsubaseuextupuf((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_find_executables *  u_find_executablecCsddl}yddl}|j}Wn.tk rXtdtjfd}YnX|j|F}d||jf}tj |s|j j dj SdSWdQXdS(u0Output from successful command execution or NoneiNu/tmp/_osx_support.%suw+bu%s 2>/dev/null >'%s'uutf-8(u contextlibutempfileuNamedTemporaryFileu ImportErroruopenuosugetpiduclosingunameusystemureadudecodeustripuNone(u commandstringu contextlibutempfileufpucmd((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu _read_output7s   u _read_outputcCs#t|p"td|fp"dS(u0Find a build tool on current path or using xcrunu/usr/bin/xcrun -find %su(u_find_executableu _read_output(utoolname((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_find_build_toolJs u_find_build_toolcCstdkrdaytd}Wntk r6YqXztjd|j}Wd|jX|dk rdj|j dj dddaqntS(u*Return the OS X system version as a stringuu0/System/Library/CoreServices/SystemVersion.plistu=ProductUserVisibleVersion\s*(.*?)Nu.ii( u_SYSTEM_VERSIONuNoneuopenuIOErrorureusearchureaducloseujoinugroupusplit(ufum((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_get_system_versionSs     1u_get_system_versioncCs4x-t|D]}|jtr ||=q q WdS(u-Remove original unmodified values for testingN(ulistu startswithu_INITPRE(u _config_varsuk((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_remove_original_valuesqsu_remove_original_valuescCsM|j|d}||kr?t||kr?||t|su-_supports_universal_builds..u.ui i(i iF(u_get_system_versionutupleusplitu ValueErrorubooluFalse(u osx_version((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_supports_universal_buildss & u_supports_universal_buildscCs>dtjkr|S|djd}}t|sFtd}nXtjj|jdrtd|j ddf}d|krtd}qn|st d n||kr:xxt D]m}||kr|tjkr||j}|d kr |n|d |d/dev/nullu'u'"'"'u-arch\s+ppc\w*\su N( uosuenvironureusearchuNoneusystemureplaceu_UNIVERSAL_CONFIG_VARSusubu_save_modified_value(u _config_varsustatusucvuflags((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_remove_unsupported_archss   u_remove_unsupported_archscCsdtjkrtjd}xmtD]b}||kr#d||kr#||}tjdd|}|d|}t|||q#q#Wn|S(u2Allow override of all archs with ARCHFLAGS env varu ARCHFLAGSu-archu -arch\s+\w+\su (uosuenvironu_UNIVERSAL_CONFIG_VARSureusubu_save_modified_value(u _config_varsuarchucvuflags((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_override_all_archss   u_override_all_archscCs|jdd}tjd|}|dk r|jd}tjj|sx^tD]S}||krX|tj krX||}tj dd|}t |||qXqXWqn|S(u+Remove references to any SDKs not availableuCFLAGSuu-isysroot\s+(\S+)iu-isysroot\s+\S+(?:\s|$)u N( ugetureusearchuNoneugroupuosupathuexistsu_UNIVERSAL_CONFIG_VARSuenvironusubu_save_modified_value(u _config_varsucflagsumusdkucvuflags((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyu_check_for_unavailable_sdks    u_check_for_unavailable_sdkc Csd }}t|}ts,d }}nd|k}d|k}|sYdtjkrx@y$|jd}|||d=Wq\tk rPYq\Xq\ndtjkr| r|tjdj}n|rx@y$|jd}|||d=Wqtk rPYqXqnd }d|krG|jd}||d}n,d|krs|jd}||d}n|rtj j | rddl m }|jd||jd n|S( ue 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. u-archu -isysrootu ARCHFLAGSiii(ulogu4Compiling with an SDK that doesn't seem to exist: %su$Please check your Xcode installationFTN(uFalseulistu_supports_universal_buildsuTrueuosuenvironuindexu ValueErrorusplituNoneupathuisdiru distutilsuloguwarn(u compiler_soucc_argsu stripArchu stripSysrootuindexusysrootuidxulog((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyucompiler_fixup0sF             cCs.tst|nt|t||S(uCustomize 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 (u_supports_universal_buildsu_remove_universal_flagsu_override_all_archsu_check_for_unavailable_sdk(u _config_vars((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyucustomize_config_varsps     cCs"t|t|t||S(uCustomize compiler path and configuration variables. This customization is performed when the first extension module build is requested in distutils.sysconfig.customize_compiler). (u_find_appropriate_compileru_remove_unsupported_archsu_override_all_archs(u _config_vars((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyucustomize_compilers   cCs|jdd}tp|}|p*|}|r|}d}|jtd|jdd}|ddkrQd|jkrQd}tjd |}ttt|}t |d kr|d }q|dkrd}q|dkrd}q|dkrd}q|dkr&d}q|dkr;d}qt d|fq|d krxt j dkrd}qq|dkrt j d krd}qd }qn|||fS(!u Filter values for get_platform()uMACOSX_DEPLOYMENT_TARGETuumacosxuCFLAGSu.u10.4.u-archufatu -arch\s+(\S+)iiui386uppcux86_64uintelufat3uppc64ufat64u universalu%Don't know machine value for archs=%rii uPowerPCuPower_Macintosh(ui386uppc(ui386ux86_64(ui386uppcux86_64(uppc64ux86_64(ui386uppcuppc64ux86_64l(uPowerPCuPower_Macintoshl( ugetu_get_system_versionu_INITPREustripureufindallutupleusortedusetulenu ValueErrorusysumaxsize(u _config_varsuosnameureleaseumachineumacveru macreleaseucflagsuarchs((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyuget_platform_osxsF                   ( uCFLAGSuLDFLAGSuCPPFLAGSu BASECFLAGSu BLDSHAREDuLDSHAREDuCCuCXXu PY_CFLAGSu PY_LDFLAGSu PY_CPPFLAGSuPY_CORE_CFLAGS(u BLDSHAREDuLDSHAREDuCCuCXX(u__doc__uosureusysu__all__u_UNIVERSAL_CONFIG_VARSu_COMPILER_CONFIG_VARSu_INITPREuNoneu_find_executableu _read_outputu_find_build_toolu_SYSTEM_VERSIONu_get_system_versionu_remove_original_valuesu_save_modified_valueu_supports_universal_buildsu_find_appropriate_compileru_remove_universal_flagsu_remove_unsupported_archsu_override_all_archsu_check_for_unavailable_sdkucompiler_fixupucustomize_config_varsucustomize_compileruget_platform_osx(((u1/opt/alt/python33/lib64/python3.3/_osx_support.pyus<           >  (   @ )