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

MjM@sdZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZddlm
Z
mZddlmZddlmZddlmZdd	Zd
dZdd
ZddZdddZdddZGddde
ZdS)adistutils._msvccompiler

Contains MSVCCompiler, an implementation of the abstract CCompiler class
for Microsoft Visual Studio 2015.

The module is compatible with VS 2015 and later. You can find legacy support
for older versions in distutils.msvc9compiler and distutils.msvccompiler.
N)DistutilsExecErrorDistutilsPlatformErrorCompileErrorLibError	LinkError)	CCompilergen_lib_options)log)get_platform)countcCsytjtjdtjtjBd}Wntk
r<tddSXd}d}|xtD]}yt	||\}}}Wntk
rPYnX|rT|tj
krTtj
|rTytt|}Wnttfk
rwTYnX|dkrT||krT||}}qTWWdQRX||fS)Nz'Software\Microsoft\VisualStudio\SxS\VC7)accesszVisual C++ is not registered)NNr)winregZ	OpenKeyExHKEY_LOCAL_MACHINEZKEY_READZKEY_WOW64_32KEYOSErrorr	debugrZ	EnumValueZREG_SZospathisdirintfloat
ValueError	TypeError)keybest_versionbest_dirivZvc_dirZvtversionr</opt/alt/python37/lib64/python3.7/distutils/_msvccompiler.py_find_vc2015s0
r!c
Csddl}tjdptjd}|s(dSy8tjtj|dddd	d
ddd
dddg	ddd}Wntj	t
tfk
r|dSXtj|ddd}tj|rd|fSdS)aJReturns "15, path" based on the result of invoking vswhere.exe
    If no install is found, returns "None, None"

    The version is returned to avoid unnecessarily changing the function
    result. It may be ignored when the path is not None.

    If vswhere.exe is not available, by definition, VS 2017 is not
    installed.
    rNzProgramFiles(x86)ZProgramFiles)NNzMicrosoft Visual StudioZ	Installerzvswhere.exez-latestz-prereleasez	-requiresz1Microsoft.VisualStudio.Component.VC.Tools.x86.x64z	-propertyZinstallationPathz	-products*mbcsstrict)encodingerrorsZVCZ	AuxiliaryZBuild)
jsonrenvironget
subprocesscheck_outputrjoinstripCalledProcessErrorrUnicodeDecodeErrorr)r(rootrrrr _find_vc2017:s&
r2cCs\t\}}|st\}}|s*tddStj|d}tj|sTtd|dS|dfS)Nz$No suitable Visual C++ version found)NNz
vcvarsall.batz%s cannot be found)r2r!r	rrrr-isfile)	plat_spec_rr	vcvarsallrrr _find_vcvarsall\s


r7c
CstdrddtjDSt|\}}|s6tdy&tjd||tj	dj
ddd	}Wn@tjk
r}z t
|jtd
|jWdd}~XYnXdddd
|DD}|S)NZDISTUTILS_USE_SDKcSsi|]\}}||qSr)lower).0rvaluerrr 
<dictcomp>psz_get_vc_env.<locals>.<dictcomp>zUnable to find vcvarsall.batzcmd /u /c "{}" {} && set)stderrzutf-16lereplace)r&zError executing {}cSs$i|]\}}}|r|r||qSr)r8)r9rr5r:rrr r;scss|]}|dVqdS)=N)	partition)r9linerrr 	<genexpr>sz_get_vc_env.<locals>.<genexpr>)rgetenvr)itemsr7rr+r,formatZSTDOUTdecoder/r	erroroutputcmd
splitlines)r4r6r5outexcenvrrr _get_vc_envns$


rMcCsN|stdtj}x2|D]*}tjtj||}tj|r|SqW|S)atReturn path to an MSVC executable program.

    Tries to find the program in several places: first, one of the
    MSVC program search paths from the registry; next, the directories
    in the PATH environment variable.  If any of those work, return an
    absolute path that is known to exist.  If none of them work, just
    return the original program name, 'exe'.
    r)rrBsplitpathseprr-abspathr3)Zexepathspfnrrr 	_find_exes	
rTZx86Z	x86_amd64)Zwin32z	win-amd64c
seZdZdZdZiZdgZdddgZdgZdgZ	eeee	Z
d	Zd
ZdZ
dZd
ZZdZd(ddZd)ddZd*ddZd+ddZd,ddZd-ddZfddZd d!Zd"d#Zd$d%Zd.d&d'ZZS)/MSVCCompilerzwConcrete class that implements an interface to Microsoft Visual C++,
       as defined by the CCompiler abstract class.Zmsvcz.cz.ccz.cppz.cxxz.rcz.mcz.resz.objz.libz.dllz%s%sz.exercCs t||||d|_d|_dS)NF)r__init__	plat_nameinitialized)selfverboseZdry_runZforcerrr rVszMSVCCompiler.__init__NcCs|dkrt}|tkr(tdttt|}t|}|sDtd|dd|_|jt	j
}td||_td||_
td||_td||_td	||_td
||_x2|ddt	j
D]}|r||t	jqWx2|ddt	j
D]}|r||t	jqWd|_d
dddddg|_d
dddddg|_d
ddg}d
dddg}|d |_|d!|_|d"|_|d#|_||_||_tj df|jtj df|jtj df|jtj!df|jtj!df|jtj!df|jtj"df|jtj"df|jtj"df|ji	|_#d|_$dS)$Nz--plat-name must be one of {}z7Unable to find a compatible Visual Studio installation.rzcl.exezlink.exezlib.exezrc.exezmc.exezmt.exeZincludelibz/nologoz/Oxz/W3z/GLz/DNDEBUGz/MDz/Odz/MDdz/Ziz/D_DEBUGz/INCREMENTAL:NOz/LTCGz/DEBUG:FULL/MANIFEST:EMBED,ID=1/DLL/MANIFEST:EMBED,ID=2/MANIFESTUAC:NOFT)r])r])r^r_r`)r^r_r`)%r
PLAT_TO_VCVARSrrDtuplerMr*_pathsrNrrOrTcclinkerr\rcmcZmtZadd_include_dirrstripsepZadd_library_dirZpreprocess_optionscompile_optionscompile_options_debugZldflags_exeZldflags_exe_debugZldflags_sharedZldflags_shared_debugZldflags_staticZldflags_static_debugrZ
EXECUTABLEZ
SHARED_OBJECTZSHARED_LIBRARY_ldflagsrX)rYrWr4Zvc_envrQdirldflagsZ
ldflags_debugrrr 
initializesX




zMSVCCompiler.initializer[csTfddjDfddjjDp4dfdd}tt||S)Ncsi|]}j|qSr)
obj_extension)r9ext)rYrr r;sz1MSVCCompiler.object_filenames.<locals>.<dictcomp>csi|]}j|qSr)
res_extension)r9rq)rYrr r;sr[cstj|\}}r"tj|}n2tj|\}}|tjjtjjfrT|dd}ytj||St	k
rt
d|YnXdS)NzDon't know how to compile {})rrsplitextbasename
splitdrive
startswithrialtsepr-LookupErrorrrD)rRbaserqr5)ext_map
output_dir	strip_dirrr 
make_out_path#sz4MSVCCompiler.object_filenames.<locals>.make_out_path)src_extensions_rc_extensions_mc_extensionslistmap)rYZsource_filenamesr}r|r~r)r{r|rYr}r object_filenamess
zMSVCCompiler.object_filenamesc	Cs|js||||||||}	|	\}}
}}}|p6g}
|
d|rT|
|jn|
|jd}x|
D]}y||\}}Wntk
rwlYnX|rtj	
|}||jkrd|}nD||jkrd|}d}n*||j
krB|}d|}y||jg|||gWqltk
r<}zt|Wdd}~XYqlXqln||jkrtj	|}tj	|}y\||jd|d||gtj	tj	|\}}tj	||d	}||jd||gWqltk
r}zt|Wdd}~XYqlXqlntd
|||jg|
|}|r$|d|||d|||y||Wqltk
r}zt|Wdd}~XYqlXqlW|
S)
Nz/cFz/Tcz/TpTz/foz-hz-rz.rcz"Don't know how to compile {} to {}z/EHscz/Fo)rXroZ_setup_compileappendextendrkrjKeyErrorrrrP
_c_extensions_cpp_extensionsrspawnrfrrrdirnamergrtrur-rDrd)rYZsourcesr|ZmacrosZinclude_dirsr
extra_preargsextra_postargsZdependsZcompile_infoobjectsZpp_optsZbuildZcompile_optsZadd_cpp_optsobjsrcrqZ	input_optZ
output_optmsgZh_dirZrc_dirrzr5Zrc_fileargsrrr compile9sn








zMSVCCompiler.compilec	
Cs|js||||\}}|j||d}|||r|d|g}|rJy,td|jd||	|jg|Wqt
k
r}zt|Wdd}~XYqXntd|dS)N)r|z/OUT:zExecuting "%s" %s zskipping %s (up-to-date))rXro_fix_object_argslibrary_filename
_need_linkr	rr\r-rrr)	rYrZoutput_libnamer|rtarget_langoutput_filenameZlib_argsrrrr create_static_libszMSVCCompiler.create_static_libc
Cs|js||||\}}||||}|\}}}|rL|dt|t||||}|dk	rptj	||}|
||r|j||	f}dd|pgD}||||d|g}tj|d}|dk	rtj
tj|\}}tj	|||}|d||
r|
|dd<|r.||tjtj|}||y,td|jd	|||jg|Wn,tk
r}zt|Wdd}~XYnXntd	|dS)
Nz5I don't know what to do with 'runtime_library_dirs': cSsg|]}d|qS)z/EXPORT:r)r9Zsymrrr 
<listcomp>sz%MSVCCompiler.link.<locals>.<listcomp>z/OUT:rz/IMPLIB:zExecuting "%s" %srzskipping %s (up-to-date))rXrorZ
_fix_lib_argswarnstrrrrr-rrlrrtrurrrrPZmkpathr	rrerrr)rYZtarget_descrrr|Z	librariesZlibrary_dirsZruntime_library_dirsZexport_symbolsrrrZ
build_temprZ
fixed_argsZlib_optsrnZexport_optsZld_argsZdll_nameZdll_extZimplib_filerrrr linksL



zMSVCCompiler.linkc	s4td}z|jtjd<t|S|tjd<XdS)Nr)rrBrcr)superr)rYrHZold_path)	__class__rr rs

zMSVCCompiler.spawncCsd|S)Nz	/LIBPATH:r)rYrmrrr library_dir_optionszMSVCCompiler.library_dir_optioncCstddS)Nz:don't know how to set runtime library search path for MSVC)r)rYrmrrr runtime_library_dir_optionsz'MSVCCompiler.runtime_library_dir_optioncCs
||S)N)r)rYr\rrr library_optionszMSVCCompiler.library_optioncCs`|r|d|g}n|g}xB|D]6}x0|D](}tj|||}tj|r(|Sq(WqWdSdS)NZ_d)rrr-rr3)rYdirsr\rZ	try_namesrmnameZlibfilerrr find_library_files

zMSVCCompiler.find_library_file)rrr)N)rr[)NNNrNNN)NrN)
NNNNNrNNNN)r)__name__
__module____qualname____doc__Z
compiler_typeZexecutablesrrrrrrrrpZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionrVrorrrrrrrrr
__classcell__rr)rr rUsL


P

[

8rU)N)rrZshutilstatr+rZdistutils.errorsrrrrrZdistutils.ccompilerrrZ	distutilsr	Zdistutils.utilr
	itertoolsrr!r2r7rMrTrarUrrrr <module>s$"