• File: _osx_support.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/_osx_support.cpython-37.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 10.05 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

MjL@sdZddlZddlZddlZddddgZdZdZd	Zd&d
dZdd
Z	ddZ
daddZddZ
ddZddZddZddZddZddZd d!Zd"dZd#dZd$dZd%dZdS)'zShared OS X support functions.Ncompiler_fixupcustomize_config_varscustomize_compilerget_platform_osx)
CFLAGSZLDFLAGSZCPPFLAGSZ
BASECFLAGS	BLDSHAREDLDSHAREDCCCXXZ	PY_CFLAGSZ
PY_LDFLAGSZPY_CPPFLAGSZPY_CORE_CFLAGSZPY_CORE_LDFLAGS)rrr	r
Z_OSX_SUPPORT_INITIAL_cCs|dkrtjd}|tj}tj|\}}tjdkrH|dkrH|d}tj|sx*|D]"}tj	||}tj|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)
executablerpathsbaseZextpfr1/opt/alt/python37/lib64/python3.7/_osx_support.py_find_executables

rc	Csddl}yddl}|}Wn(tk
rDtdtfd}YnX||0}d||jf}t	|s||
dSdSQRXdS)z0Output from successful command execution or NonerNz/tmp/_osx_support.%szw+bz%s 2>/dev/null >'%s'zutf-8)
contextlibtempfileZNamedTemporaryFileImportErroropenrgetpidclosingnamesystemreaddecodestrip)Z
commandstringrrfpcmdrrr_read_output7sr+cCst|ptd|fpdS)z0Find a build tool on current path or using xcrunz/usr/bin/xcrun -find %s)rr+)Ztoolnamerrr_find_build_toolJsr-cCsxtdkrtdaytd}Wntk
r,YnHXztd|}Wd|X|dk	rtd|d	dddatS)z*Return the OS X system version as a stringNr,z0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>.)
_SYSTEM_VERSIONr!OSErrorresearchr&closergroupr)rmrrr_get_system_versionSs

r8cCs&x t|D]}|tr
||=q
WdS)z-Remove original unmodified values for testingN)list
startswith_INITPRE)_config_varskrrr_remove_original_valuesqs
r>cCs8||d}||kr,t||kr,||t|<|||<dS)z@Save modified and original unmodified value of configuration varr,N)getr;)r<cvZnewvalueZoldvaluerrr_save_modified_valuexsrAcCsTt}|r@ytdd|dD}Wntk
r>d}YnX|rPt|dkSdS)z=Returns True if universal builds are supported on this systemcss|]}t|VqdS)N)int).0irrr	<genexpr>sz-_supports_universal_builds.<locals>.<genexpr>r.r,)
F)r8tupler
ValueErrorbool)Zosx_versionrrr_supports_universal_buildss
rKcCsdtjkr|S|dd}}t|s4td}n<tj|drptd|	ddf}|rpd|krptd}|s|t
d	||krxTtD]L}||kr|tjkr||}|d
kr|n|d|d<t||d
|qW|S)
z7Find appropriate C compiler for extension module buildsr	rZclangZgccz'%s' --version'z'"'"'zllvm-gcczCannot locate working compilerr
z++ )rr
rrr-rbasenamer:r+replaceSystemError_COMPILER_CONFIG_VARSrAr)r<ZccZoldccdatar@Zcv_splitrrr_find_appropriate_compilers(


rScCsZxTtD]L}||kr|tjkr||}tjdd|tjd}tdd|}t|||qW|S)z5Remove all universal build arguments from config varsz
-arch\s+\w+\srM)flagsz-isysroot\s*\S+)_UNIVERSAL_CONFIG_VARSrr
r3subASCIIrA)r<r@rTrrr_remove_universal_flagss
rXcCsdtjkr|Std|ddk	rtd|dddf}|rx@tD]8}||krH|tjkrH||}tdd	|}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/nullrLz'"'"'z-arch\s+ppc\w*\srM)	rr
r3r4r%rOrUrVrA)r<Zstatusr@rTrrr_remove_unsupported_archss
	
rYcCshdtjkrdtjd}xNtD]F}||krd||kr||}tdd|}|d|}t|||qW|S)z2Allow override of all archs with ARCHFLAGS env var	ARCHFLAGSz-archz
-arch\s+\w+\srM)rr
rUr3rVrA)r<Zarchr@rTrrr_override_all_archss


r[cCs||dd}td|}|dk	rx|d}tj|sxx@tD]8}||kr<|tjkr<||}t	dd|}t
|||q<W|S)z+Remove references to any SDKs not availablerr,z-isysroot\s*(\S+)Nr/z-isysroot\s*\S+(?:\s|$)rM)r?r3r4r6rrexistsrUr
rVrA)r<cflagsr7Zsdkr@rTrrr_check_for_unavailable_sdks

r^c
Csd}}t|}ts d}}nd|k}tdd|D}|sHdtjkrx8y|d}|||d=WqJtk
r|PYqJXqJWdtjkr|s|tjd}|rxNdd	t|D}|sP|d
}||dkr|||d=q|||d=qWd
}|}dd	t|D}|s,|}dd	t|D}xB|D]:}||dkrT||d}Pn||t	dd
}Pq2W|rtj
|sd
dlm
}	|	d||	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-archcss|]}|dr|VqdS)z	-isysrootN)r:)rCargrrrrECsz!compiler_fixup.<locals>.<genexpr>rZr0cSsg|]\}}|dr|qS)z	-isysroot)r:)rCrDxrrr
<listcomp>Usz"compiler_fixup.<locals>.<listcomp>rz	-isysrootr/NcSsg|]\}}|dr|qS)z	-isysroot)r:)rCrDr`rrrraescSsg|]\}}|dr|qS)z	-isysroot)r:)rCrDr`rrrrahs)logz4Compiling with an SDK that doesn't seem to exist: %sz$Please check your Xcode installation)r9rKanyrr
indexrIr	enumeratelenrisdirZ	distutilsrbwarn)
Zcompiler_soZcc_argsZ	stripArchZstripSysrootrdindicesZsysrootZargvaridxrbrrrr0sT	



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
    )rKrXr[r^)r<rrrr{s
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).
    )rSrYr[)r<rrrrs	cCs||dd}tp|}|p|}|rr|}d}|td|dd}|ry$tdd|ddd	D}Wqtk
rd
}YqXnd
}|dkr6d|kr6d
}td|}tt	t
|}t|dkr|d}nZ|dkrd
}nL|dkrd}n>|dkrd}n.|dkrd}n|dkr&d}ntd|fn<|dkrRtj
dkrrd}n |dkrrtj
dkrnd}nd}|||fS) z Filter values for get_platform()ZMACOSX_DEPLOYMENT_TARGETr,Zmacosxrcss|]}t|VqdS)N)rB)rCrDrrrrEsz#get_platform_osx.<locals>.<genexpr>r.rr0)rFr)rFrGz-archZfatz
-arch\s+(\S+)r/)i386ppc)rkx86_64Zintel)rkrlrmZfat3)ppc64rmZfat64)rkrlrnrmZ	universalz%Don't know machine value for archs=%rrklrm)ZPowerPCZPower_Macintoshrnrl)r?r8r;rHrrIr(r3findallsortedsetrfrmaxsize)r<ZosnamereleasemachineZmacverZ
macreleaser]ZarchsrrrrsP


$





)N)__doc__rr3r__all__rUrQr;rr+r-r1r8r>rArKrSrXrYr[r^rrrrrrrr<module>s6
>(K)