MINI MINI MANI MO

Path : /usr/lib64/python3.6/__pycache__/
File Upload :
Current File : //usr/lib64/python3.6/__pycache__/_osx_support.cpython-36.pyc

3


 \J
@sdZddlZddlZddlZddddgZd1Zd2ZdZd3ddZddZ	ddZ
daddZddZ
dd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-dZd.dZd/dZd0dZdS)4zShared OS X support functions.Ncompiler_fixupcustomize_config_varscustomize_compilerget_platform_osxCFLAGSLDFLAGSCPPFLAGS
BASECFLAGS	BLDSHAREDLDSHAREDCCCXX	PY_CFLAGS
PY_LDFLAGSPY_CPPFLAGSPY_CORE_CFLAGSPY_CORE_LDFLAGSZ_OSX_SUPPORT_INITIAL_cCs|dkrtjd}|jtj}tjj|\}}tjdkrH|dkrH|d}tjj|sx*|D]"}tjj	||}tjj|rZ|SqZWdS|SdS)zTries 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.
    NPATHZwin32z.exe)
osenvironsplitpathseppathsplitextsysplatformisfilejoin)
executablerpathsbaseZextpfr#$/usr/lib64/python3.6/_osx_support.py_find_executables

r%cCsddl}yddl}|j}Wn(tk
rDtdtjfd}YnX|j|0}d||jf}tj	|s||j
jdjSdSQRXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8)
contextlibtempfileZNamedTemporaryFileImportErroropenrgetpidclosingnamesystemreaddecodestrip)Z
commandstringr&r'fpcmdr#r#r$_read_output7sr3cCst|ptd|fpdS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s)r%r3)Ztoolnamer#r#r$_find_build_toolJsr5cCsxtdkrtdaytd}Wntk
r,YnHXztjd|j}Wd|jX|dk	rtdj|jdj	dddatS)z*Return the OS X system version as a stringNr4z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>.)
_SYSTEM_VERSIONr)OSErrorresearchr.closergroupr)r"mr#r#r$_get_system_versionSs

r@cCs&x t|D]}|jtr
||=q
WdS)z-Remove original unmodified values for testingN)list
startswith_INITPRE)_config_varskr#r#r$_remove_original_valuesqs
rFcCs8|j|d}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr4N)getrC)rDcvZnewvalueZoldvaluer#r#r$_save_modified_valuexsrIcCsTt}|r@ytdd|jdD}Wntk
r>d}YnX|rPt|dkSdS)	z=Returns True if universal builds are supported on this systemcss|]}t|VqdS)N)int).0ir#r#r$	<genexpr>sz-_supports_universal_builds.<locals>.<genexpr>r6r4
F)rNrO)r@tupler
ValueErrorbool)Zosx_versionr#r#r$_supports_universal_buildss
rScCsdtjkr|S|djd}}t|s4td}n<tjj|jdrptd|j	ddf}|rpd|krptd}|s|t
d	||krxTtD]L}||kr|tjkr||j}|d
kr|n|d|d<t||dj
|qW|S)
z7Find appropriate C compiler for extension module buildsrrZclanggccz'%s' --version'z'"'"'zllvm-gcczCannot locate working compilerr
z++ )rrrr%r5rbasenamerBr3replaceSystemError_COMPILER_CONFIG_VARSrIr)rDZccZoldccdatarHZcv_splitr#r#r$_find_appropriate_compilers(


r\cCsZxTtD]L}||kr|tjkr||}tjdd|tjd}tjdd|}t|||qW|S)z5Remove all universal build arguments from config varsz
-arch\s+\w+\srV)flagsz-isysroot [^ 	]*)_UNIVERSAL_CONFIG_VARSrrr;subASCIIrI)rDrHr]r#r#r$_remove_universal_flagss
racCsdtjkr|Stjd|ddk	rtjd|djddf}|rx@tD]8}||krH|tjkrH||}tjdd	|}t|||qHW|S)
z-Remove any unsupported archs from config varsrz-arch\s+ppcrNzNecho 'int main{};' | '%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/nullrUz'"'"'z-arch\s+ppc\w*\srV)	rrr;r<r-rXr^r_rI)rDZstatusrHr]r#r#r$_remove_unsupported_archss
	
rbcCshdtjkrdtjd}xNtD]F}||krd||kr||}tjdd|}|d|}t|||qW|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	rx|jd}tjj|sxx@tD]8}||kr<|tjkr<||}tj	dd|}t
|||q<W|S)z+Remove references to any SDKs not availablerr4z-isysroot\s+(\S+)Nr7z-isysroot\s+\S+(?:\s|$)rV)rGr;r<r>rrexistsr^rr_rI)rDcflagsr?ZsdkrHr]r#r#r$_check_for_unavailable_sdks

rgcCsXd}}t|}ts d}}nd|k}d|k}|s>dtjkrxx8y|jd}|||d=Wq@tk
rrPYq@Xq@Wdtjkr|r|tjdj}|rx8y|jd}|||d=Wqtk
rPYqXqWd}d|kr|jd}||d}n d|kr|jd}||d}|rTtjj|rTd	d
l	m
}|jd||jd|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)rArSrrindexrQrrisdirZ	distutilsrhwarn)Zcompiler_soZcc_argsZ	stripArchZstripSysrootriZsysrootidxrhr#r#r$r0sF	






cCs"tst|t|t||S)aCustomize 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
cCst|t|t||S)zCustomize 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$rs	c
Cs||jdd}tp|}|p|}|rr|}d}|jtd|jdd}|ry$tdd|jddd	D}Wqtk
rd}YqXnd}|dkod|jkr6d
}tjd|}tt	t
|}t|dkr|d}n\|dkrd
}nN|d krd}n>|d!krd}n.|d"krd}n|d#kr&d}ntd|fn<|dkrRtj
d$krrd}n |d%krrtj
d&krnd}nd}|||fS)'z Filter values for get_platform()MACOSX_DEPLOYMENT_TARGETr4Zmacosxrcss|]}t|VqdS)N)rJ)rKrLr#r#r$rMsz#get_platform_osx.<locals>.<genexpr>r6rr8rNrOz-archZfatz
-arch\s+(\S+)r7i386ppcx86_64ZintelZfat3ppc64Zfat64Z	universalz%Don't know machine value for archs=%r PowerPCPower_Macintosh)rNr)rNr)rNrO)rnro)rnrp)rnrorp)rqrp)rnrorqrpl)rsrtl)rGr@rCrPrrQr0r;findallsortedsetlenrmaxsize)rDosnamereleasemachineZmacverZ
macreleaserfZarchsr#r#r$rsP


$






)
rrrr	r
rrr
rrrrr)r
rrr
)N)__doc__rr;r__all__r^rZrCr%r3r5r9r@rFrIrSr\rarbrdrgrrrrr#r#r#r$<module>s<
>(@)

OHA YOOOO