Your IP : 3.147.49.19


Current Path : /opt/alt/python310/lib64/python3.10/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/distutils/__pycache__/ccompiler.cpython-310.opt-2.pyc

o

6��f:��@s�	ddlZddlZddlZddlTddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZddlmZGd	d
�d
�ZdZddd
�Zdddddd�Zdd�Zddd�Zdd�Zdd�ZdS)�N)�*)�spawn)�	move_file)�mkpath)�newer_group)�split_quoted�execute)�logc@sbeZdZ	dZdZdZdZdZdZdZ	dZ
dddddd�Zgd�Zdqdd	�Z
d
d�Zdd
�Zdd�Zdd�Zdrdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Z drd0d1�Z!d2d3�Z"d4d5�Z#d6d7�Z$d8d9�Z%		dsd:d;�Z&			dtd<d=�Z'd>d?�Z(		dud@dA�Z)dBZ*dCZ+dDZ,										dvdEdF�Z-										dvdGdH�Z.										dvdIdJ�Z/								dwdKdL�Z0dMdN�Z1dOdP�Z2dQdR�Z3		dxdSdT�Z4dydUdV�Z5dzdXdY�Z6dzdZd[�Z7dzd\d]�Z8	^	Wd{d_d`�Z9d|dbdc�Z:ddde�Z;dfdg�Z<d}dhdi�Z=djdk�Z>dldm�Z?d~dodp�Z@dS)�	CCompilerN�c�c++�objc)�.cz.ccz.cppz.cxxz.m)rr
rrcCsb||_||_||_d|_g|_g|_g|_g|_g|_g|_	|j
��D]}|�||j
|�q#dS�N)
�dry_run�force�verbose�
output_dir�macros�include_dirs�	libraries�library_dirs�runtime_library_dirs�objects�executables�keys�set_executable)�selfrrr�key�r�:/opt/alt/python310/lib64/python3.10/distutils/ccompiler.py�__init__Us�zCCompiler.__init__cKs>	|D]}||jvrtd||jjf��|�|||�qdS)Nz$unknown executable '%s' for class %s)r�
ValueError�	__class__�__name__r)r�kwargsrrrr �set_executablesys

��zCCompiler.set_executablescCs.t|t�rt||t|��dSt|||�dSr)�
isinstance�str�setattrr)rr�valuerrr r�s
zCCompiler.set_executablecCs0d}|jD]}|d|kr|S|d7}qdS)Nr�)r)r�name�i�defnrrr �_find_macro�s

zCCompiler._find_macrocCsb	|D]+}t|t�r$t|�dvr$t|dt�s|ddur$t|dt�s.td|dd��qdS)N)r+�r+rzinvalid macro definition '%s': z.must be tuple (string,), (string, string), or z(string, None))r'�tuple�lenr(�	TypeError)rZdefinitionsr.rrr �_check_macro_definitions�s 
������z"CCompiler._check_macro_definitionscCs0	|�|�}|dur|j|=|j�||f�dSr�r/r�append)rr,r*r-rrr �define_macro�s

zCCompiler.define_macrocCs2	|�|�}|dur|j|=|f}|j�|�dSrr5)rr,r-Zundefnrrr �undefine_macro�s

zCCompiler.undefine_macrocC�	|j�|�dSr)rr6�r�dirrrr �add_include_dir��zCCompiler.add_include_dircC�	|dd�|_dSr�r�r�dirsrrr �set_include_dirs�szCCompiler.set_include_dirscCr9r)rr6)r�libnamerrr �add_library�s
zCCompiler.add_librarycCr>r)r)rZlibnamesrrr �
set_libraries��zCCompiler.set_librariescCr9r)rr6r:rrr �add_library_dirr=zCCompiler.add_library_dircCr>r)rr@rrr �set_library_dirsszCCompiler.set_library_dirscCr9r)rr6r:rrr �add_runtime_library_dirsz!CCompiler.add_runtime_library_dircCr>r)rr@rrr �set_runtime_library_dirsrFz"CCompiler.set_runtime_library_dirscCr9r)rr6)r�objectrrr �add_link_object r=zCCompiler.add_link_objectcCr>r)r)rrrrr �set_link_objects(rFzCCompiler.set_link_objectscCs	|dur	|j}n	t|t�std��|dur|j}nt|t�r'||jp$g}ntd��|dur3|j}nt|ttf�rDt|�|jpAg}ntd��|durNg}|j|d|d�}t	||�}i}	t
t|��D]!}
||
}||
}tj
�|�d}
|�tj
�|��||
f|	|<qc|||||	fS)N�%'output_dir' must be a string or None�/'macros' (if supplied) must be a list of tuples�6'include_dirs' (if supplied) must be a list of stringsr)�	strip_dirrr+)rr'r(r3r�listrr1�object_filenames�gen_preprocess_options�ranger2�os�path�splitextr�dirname)rZoutdirrZincdirs�sources�dependsZextrar�pp_opts�buildr-�src�obj�extrrr �_setup_compile6s>

��
zCCompiler._setup_compilecCs0|dg}|rdg|dd�<|r||dd�<|S)Nz-cz-grr)rr\�debugZbefore�cc_argsrrr �_get_cc_argsas
zCCompiler._get_cc_argscCs�	|dur	|j}n	t|t�std��|dur|j}nt|t�r'||jp$g}ntd��|dur3|j}nt|ttf�rDt|�|jpAg}ntd��|||fS)NrNrOrP)rr'r(r3rrRrr1)rrrrrrr �_fix_compile_argsjs$	

�
zCCompiler._fix_compile_argscCs	|j||d�}|ifS)N)r)rS)rrZrr[rrrr �
_prep_compile�szCCompiler._prep_compilecCsP	t|ttf�std��t|�}|dur|j}||fSt|t�s$td��||fS)Nz,'objects' must be a list or tuple of stringsrN)r'rRr1r3rr()rrrrrr �_fix_object_args�s
�zCCompiler._fix_object_argscCs�	|dur	|j}nt|ttf�rt|�|jpg}ntd��|dur&|j}nt|ttf�r7t|�|jp4g}ntd��|durC|j}nt|ttf�rTt|�|jpQg}ntd��|||fS)Nz3'libraries' (if supplied) must be a list of stringsz6'library_dirs' (if supplied) must be a list of stringsz>'runtime_library_dirs' (if supplied) must be a list of strings)rr'rRr1r3rr)rrrrrrr �
_fix_lib_args�s.���
zCCompiler._fix_lib_argscCs2	|jrdS|jrt||dd�}|St||�}|S)NT�newer)Zmissing)rrr)rr�output_filerirrr �
_need_link�s
�zCCompiler._need_linkc		Cs|	t|t�s	|g}d}t|j�}|D])}tj�|�\}}|j�|�}z|j�	|�}||kr1|}|}Wqt
y;Yqw|Sr)r'rRr2�language_orderrVrWrX�language_map�get�indexr")	rrZZlangro�source�baser`ZextlangZextindexrrr �detect_language�s$

��zCCompiler.detect_languagecC�	dSrr)rrprjrr�
extra_preargs�extra_postargsrrr �
preprocess�s	zCCompiler.preprocessc		Cst	|�||||||�\}}	}}
}|�|
||�}|	D]}
z||
\}}Wn	ty,Yqw|�|
|||||
�q|	Sr)rard�KeyError�_compile)rrZrrrrbrtrur[rr\r]rcr_r^r`rrr �compile�s3���zCCompiler.compilecCrsrr)rr_r^r`rcrur\rrr rxC�zCCompiler._compilecCrsrr)rr�output_libnamerrb�target_langrrr �create_static_libIszCCompiler.create_static_libZ
shared_objectZshared_library�
executablecC�	t�r��NotImplementedError)rZtarget_descr�output_filenamerrrr�export_symbolsrbrtru�
build_tempr|rrr �linkis+zCCompiler.linkc

Cs2|�tj||j|dd�|||||||	|
||�
dS)N�shared)�lib_type)r�r
�SHARED_LIBRARY�library_filename)
rrr{rrrrr�rbrtrur�r|rrr �link_shared_lib�s

�zCCompiler.link_shared_libc

Cs(|�tj|||||||||	|
||�
dSr)r�r
�
SHARED_OBJECT)
rrr�rrrrr�rbrtrur�r|rrr �link_shared_object�s

�zCCompiler.link_shared_objectcCs.|�tj||�|�||||d|||	d|
�
dSr)r�r
�
EXECUTABLE�executable_filename)rrZoutput_prognamerrrrrbrtrur|rrr �link_executable�s



�zCCompiler.link_executablecCrrr�r:rrr �library_dir_option�rzzCCompiler.library_dir_optioncCrrr�r:rrr �runtime_library_dir_option�rzz$CCompiler.runtime_library_dir_optioncCrrr�)r�librrr �library_option�rzzCCompiler.library_optionc	Cs�	ddl}|durg}|durg}|durg}|durg}|jd|dd�\}}t�|d�}	z|D]	}
|	�d|
�q0|	�d|�W|	��n|	��wz
|j|g|d�}Wn
ty`Yd	Swz|j|d
||d�WdSt	t
fyyYd	Sw)NrrT)�text�wz#include "%s"
z=int main (int argc, char **argv) {
    %s();
    return 0;
}
r?Fza.out)rr)�tempfileZmkstemprV�fdopen�write�closeryZCompileErrorr�Z	LinkErrorr3)r�funcnameZincludesrrrr��fdZfname�fZinclrrrr �has_function�sB�����zCCompiler.has_functioncCrrr�)rrAr�rbrrr �find_library_file$szCCompiler.find_library_file�cCs�|durd}g}|D]>}tj�|�\}}tj�|�d}|tj�|�d�}||jvr3td||f��|r;tj�|�}|�tj�	|||j
��q
|S)Nr�r+z"unknown file type '%s' (from '%s'))rVrWrX�
splitdrive�isabs�src_extensionsZUnknownFileError�basenamer6�join�
obj_extension)rZsource_filenamesrQrZ	obj_namesZsrc_namerqr`rrr rSOs"

��zCCompiler.object_filenamescCs$|rtj�|�}tj�|||j�Sr)rVrWr�r��shared_lib_extension�rr�rQrrrr �shared_object_filename`sz CCompiler.shared_object_filenamecCs(|rtj�|�}tj�|||jpd�S)Nr�)rVrWr�r��
exe_extensionr�rrr r�fszCCompiler.executable_filename�staticc
Cs`|dvrtd��t||d�}t||d�}tj�|�\}}|||f}	|r(d}tj�|||	�S)N)r�r�ZdylibZ
xcode_stubz?'lib_type' must be "static", "shared", "dylib", or "xcode_stub"Z_lib_formatZ_lib_extensionr�)r"�getattrrVrW�splitr�)
rrCr�rQrZfmtr`r;rq�filenamerrr r�ls�zCCompiler.library_filenamer+cCst�|�dSr)r	rb)r�msg�levelrrr �announceszCCompiler.announcecCs ddlm}|rt|�dSdS)Nr)�DEBUG)Zdistutils.debugr��print)rr�r�rrr �debug_print�s�zCCompiler.debug_printcCstj�d|�dS)Nzwarning: %s
)�sys�stderrr�)rr�rrr �warn��zCCompiler.warncCst||||j�dSr)rr)r�func�argsr�r�rrr r�r�zCCompiler.executecCst||jd�dS�N)r)rr)r�cmdrrr r�szCCompiler.spawncCst|||jd�Sr�)rr)rr^Zdstrrr r�szCCompiler.move_file�cCst|||jd�dSr�)rr)rr,�moderrr r�r�zCCompiler.mkpath)rrrr)NNNNN)NNNrNNN)NrN)
NNNNNrNNNN)NNNNrNNN)NNNN)r)rr�)r�rr�)r+)Nr+)r�)Ar$�
__module__�__qualname__Z
compiler_typer�r�Zstatic_lib_extensionr�Zstatic_lib_formatZshared_lib_formatr�rmrlr!r&rr/r4r7r8r<rBrDrErGrHrIrJrLrMrardrerfrgrhrkrrrvryrxr}r�r�r�r�r�r�r�r�r�r�r�r�rSr�r�r�r�r�r�rrrrrrrr r
s��
$ 

+	
 "

�

�D
�
�A
�
�
�
�
,
+


�

r
))zcygwin.*�unix)�posixr�)�nt�msvccCsX	|durtj}|durtj}tD]\}}t�||�dus%t�||�dur)|SqdS)Nr�)rVr,r��platform�_default_compilers�re�match)Zosnamer��pattern�compilerrrr �get_default_compiler�s	�r�)Z
unixccompilerZ
UnixCCompilerzstandard UNIX-style compiler)Z
_msvccompilerZMSVCCompilerzMicrosoft Visual C++)�cygwinccompilerZCygwinCCompilerz'Cygwin port of GNU C Compiler for Win32)r�ZMingw32CCompilerz(Mingw32 port of GNU C Compiler for Win32)ZbcppcompilerZBCPPCompilerzBorland C++ Compiler)r�r��cygwinZmingw32ZbcppcCsZ	ddlm}g}t��D]}|�d|dt|df�q
|��||�}|�d�dS)Nr)�FancyGetoptz	compiler=r0zList of available compilers:)Zdistutils.fancy_getoptr��compiler_classrr6�sortZ
print_help)r�Z	compilersr�Zpretty_printerrrr �show_compilers�s
�r�cCs�	|durtj}z|durt|�}t|\}}}Wnty2d|}|dur.|d|}t|��wzd|}t|�tj|}	t	|	�|}
Wnt
yUtd|��tyctd||f��w|
d||�S)Nz5don't know how to compile C/C++ code on platform '%s'z with '%s' compilerz
distutils.z4can't compile C/C++ code: unable to load module '%s'zBcan't compile C/C++ code: unable to find class '%s' in module '%s')rVr,r�r�rwZDistutilsPlatformError�
__import__r��modules�vars�ImportErrorZDistutilsModuleError)Zplatr�rrrZmodule_name�
class_nameZlong_descriptionr��module�klassrrr �new_compiler�s@
�
�����r�cCs�	g}|D]G}t|t�rdt|�krdksntd|��t|�dkr/|�d|d�qt|�dkrL|ddurE|�d|d�q|�d|�q|D]	}|�d|�qO|S)	Nr+r0zPbad macro definition '%s': each element of 'macros' list must be a 1- or 2-tuplez-U%srz-D%sz-D%s=%sz-I%s)r'r1r2r3r6)rrr\Zmacror;rrr rTs&$���rTcCs�	g}|D]
}|�|�|��q|D]}|�|�}t|t�r#||}q|�|�q|D]+}tj�|�\}}	|rN|�|g|	�}
|
rF|�|
�q+|�	d|�q+|�|�
|��q+|S)Nz6no library file corresponding to '%s' found (skipping))r6r�r�r'rRrVrWr�r�r�r�)r�rrrZlib_optsr;�optr�Zlib_dirZlib_nameZlib_filerrr �gen_lib_options8s(


�r�)NN)NNrrr)r�rVr�Zdistutils.errorsZdistutils.spawnrZdistutils.file_utilrZdistutils.dir_utilrZdistutils.dep_utilrZdistutils.utilrrZ	distutilsr	r
r�r�r�r�r�rTr�rrrr �<module>s:
�
--

?>