Your IP : 52.14.223.136


Current Path : /opt/alt/python39/lib64/python3.9/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/distutils/__pycache__/ccompiler.cpython-39.opt-2.pyc

a

R�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
@s�eZdZdZdZdZdZdZdZdZ	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 dsd0d1�Z!d2d3�Z"d4d5�Z#d6d7�Z$d8d9�Z%dtd:d;�Z&dud<d=�Z'd>d?�Z(dvd@dA�Z)dBZ*dCZ+dDZ,dwdEdF�Z-dxdGdH�Z.dydIdJ�Z/dzdKdL�Z0dMdN�Z1dOdP�Z2dQdR�Z3d{dSdT�Z4d|dUdV�Z5d}dXdY�Z6d~dZd[�Z7dd\d]�Z8d�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
|�qFdS�N)
�dry_run�force�verbose�
output_dir�macros�include_dirs�	libraries�library_dirs�runtime_library_dirs�objects�executables�keys�set_executable)�selfrrr�key�r�8/opt/alt/python39/lib64/python3.9/distutils/ccompiler.py�__init__UszCCompiler.__init__cKs<|D]2}||jvr&td||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|��nt|||�dSr)�
isinstance�str�setattrr)rr�valuerrr r�s
zCCompiler.set_executablecCs0d}|jD] }|d|kr"|S|d7}q
dS)Nr�)r)r�name�i�defnrrr �_find_macro�s

zCCompiler._find_macrocCs`|D]V}t|t�rFt|�dvrFt|dt�s8|ddurFt|dt�std|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_definitionscCs.|�|�}|dur|j|=|j�||f�dSr�r/r�append)rr,r*r-rrr �define_macro�s	
zCCompiler.define_macrocCs0|�|�}|dur|j|=|f}|j�|�dSrr5)rr,r-Zundefnrrr �undefine_macro�s

zCCompiler.undefine_macrocCs|j�|�dSr)rr6�r�dirrrr �add_include_dir�szCCompiler.add_include_dircCs|dd�|_dSr�r�r�dirsrrr �set_include_dirs�szCCompiler.set_include_dirscCs|j�|�dSr)rr6)r�libnamerrr �add_library�szCCompiler.add_librarycCs|dd�|_dSr)r)rZlibnamesrrr �
set_libraries�szCCompiler.set_librariescCs|j�|�dSr)rr6r9rrr �add_library_dirszCCompiler.add_library_dircCs|dd�|_dSr)rr=rrr �set_library_dirsszCCompiler.set_library_dirscCs|j�|�dSr)rr6r9rrr �add_runtime_library_dirsz!CCompiler.add_runtime_library_dircCs|dd�|_dSr)rr=rrr �set_runtime_library_dirssz"CCompiler.set_runtime_library_dirscCs|j�|�dSr)rr6)r�objectrrr �add_link_object szCCompiler.add_link_objectcCs|dd�|_dSr)r)rrrrr �set_link_objects(szCCompiler.set_link_objectscCs|dur|j}nt|t�s"td��|dur2|j}n"t|t�rL||jpFg}ntd��|durd|j}n*t|ttf�r�t|�|jp�g}ntd��|dur�g}|j|d|d�}t	||�}i}	t
t|��D]B}
||
}||
}tj
�|�d}
|�tj
�|��||
f|	|<q�|||||	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)rrX�debugZbefore�cc_argsrrr �_get_cc_argsas
zCCompiler._get_cc_argscCs�|dur|j}nt|t�s"td��|dur2|j}n"t|t�rL||jpFg}ntd��|durd|j}n*t|ttf�r�t|�|jp�g}ntd��|||fS)NrJrKrL)rr'r(r3rrNrr1)rrrrrrr �_fix_compile_argsjs"


�zCCompiler._fix_compile_argscCs|j||d�}|ifS)N)r)rO)rrVrrWrrrr �
_prep_compile�s	zCCompiler._prep_compilecCsHt|ttf�std��t|�}|dur.|j}nt|t�s@td��||fS)Nz,'objects' must be a list or tuple of stringsrJ)r'rNr1r3rr()rrrrrr �_fix_object_args�s
zCCompiler._fix_object_argscCs�|dur|j}n*t|ttf�r2t|�|jp,g}ntd��|durJ|j}n*t|ttf�rlt|�|jpfg}ntd��|dur�|j}n*t|ttf�r�t|�|jp�g}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'rNr1r3rr)rrrrrrr �
_fix_lib_args�s,���zCCompiler._fix_lib_argscCs2|jr
dS|jr t||dd�}n
t||�}|SdS)NT�newer)Zmissing)rrr)rr�output_filererrr �
_need_link�s
zCCompiler._need_linkc		Cs|t|t�s|g}d}t|j�}|D]T}tj�|�\}}|j�|�}z |j�	|�}||kr`|}|}Wq"t
ytYq"0q"|Sr)r'rNr2�language_orderrRrSrT�language_map�get�indexr")	rrVZlangrk�source�baser\ZextlangZextindexrrr �detect_language�s

zCCompiler.detect_languagecCsdSrr)rrlrfrr�
extra_preargs�extra_postargsrrr �
preprocess�szCCompiler.preprocessc		Csv|�||||||�\}}	}}
}|�|
||�}|	D]@}
z||
\}}WntyZYq0Yn0|�|
|||||
�q0|	Sr)r]r`�KeyError�_compile)rrVrrrr^rorprWrrXrYr_r[rZr\rrr �compile�s6��
zCCompiler.compilecCsdSrr)rr[rZr\r_rprXrrr rsCszCCompiler._compilecCsdSrr)rr�output_libnamerr^�target_langrrr �create_static_libIszCCompiler.create_static_libZ
shared_objectZshared_library�
executablecCst�dSr��NotImplementedError)rZtarget_descr�output_filenamerrrr�export_symbolsr^rorp�
build_temprvrrr �linkis9zCCompiler.linkc

Cs2|�tj||j|dd�|||||||	|
||�
dS)N�shared)�lib_type)r~r
�SHARED_LIBRARY�library_filename)
rrrurrrrr|r^rorpr}rvrrr �link_shared_lib�s
�zCCompiler.link_shared_libc

Cs(|�tj|||||||||	|
||�
dSr)r~r
�
SHARED_OBJECT)
rrr{rrrrr|r^rorpr}rvrrr �link_shared_object�s
�zCCompiler.link_shared_objectcCs.|�tj||�|�||||d|||	d|
�
dSr)r~r
�
EXECUTABLE�executable_filename)rrZoutput_prognamerrrrr^rorprvrrr �link_executable�s



�zCCompiler.link_executablecCst�dSrryr9rrr �library_dir_option�szCCompiler.library_dir_optioncCst�dSrryr9rrr �runtime_library_dir_option�sz$CCompiler.runtime_library_dir_optioncCst�dSrry)r�librrr �library_option�szCCompiler.library_optionc	Cs�ddl}|durg}|dur g}|dur,g}|dur8g}|jd|dd�\}}t�|d�}	z2|D]}
|	�d|
�q^|	�d|�W|	��n
|	��0z|j|g|d�}Wnty�Yd	S0z|j|d
||d�Wnt	t
fy�Yd	S0dS)NrrT)�text�wz#include "%s"
z=int main (int argc, char **argv) {
    %s();
    return 0;
}
r<Fza.out)rr)�tempfileZmkstemprR�fdopen�write�closertZCompileErrorr�Z	LinkErrorr3)r�funcnameZincludesrrrr��fdZfname�fZinclrrrr �has_function�s<	��
zCCompiler.has_functioncCst�dSrry)rr>r�r^rrr �find_library_file$szCCompiler.find_library_file�cCs�|durd}g}|D]|}tj�|�\}}tj�|�d}|tj�|�d�}||jvrftd||f��|rvtj�|�}|�tj�	|||j
��q|S)Nr�r+z"unknown file type '%s' (from '%s'))rRrSrT�
splitdrive�isabs�src_extensionsZUnknownFileError�basenamer6�join�
obj_extension)rZsource_filenamesrMrZ	obj_namesZsrc_namermr\rrr rOOs"

��zCCompiler.object_filenamescCs$|rtj�|�}tj�|||j�Sr)rRrSr�r��shared_lib_extension�rr�rMrrrr �shared_object_filename`sz CCompiler.shared_object_filenamecCs(|rtj�|�}tj�|||jp"d�S)Nr�)rRrSr�r��
exe_extensionr�rrr r�fszCCompiler.executable_filename�staticc
Cs`|dvrtd��t||d�}t||d�}tj�|�\}}|||f}	|rPd}tj�|||	�S)N)r�rZdylibZ
xcode_stubz?'lib_type' must be "static", "shared", "dylib", or "xcode_stub"Z_lib_formatZ_lib_extensionr�)r"�getattrrRrS�splitr�)
rr@r�rMrZfmtr\r:rm�filenamerrr r�ls�zCCompiler.library_filenamer+cCst�|�dSr)r	r^)r�msg�levelrrr �announceszCCompiler.announcecCsddlm}|rt|�dS)Nr)�DEBUG)Zdistutils.debugr��print)rr�r�rrr �debug_print�szCCompiler.debug_printcCstj�d|�dS)Nzwarning: %s
)�sys�stderrr�)rr�rrr �warn�szCCompiler.warncCst||||j�dSr)rr)r�func�argsr�r�rrr r�szCCompiler.executecCst||jd�dS�N)r)rr)r�cmdrrr r�szCCompiler.spawncCst|||jd�Sr�)rr)rrZZdstrrr r�szCCompiler.move_file�cCst|||jd�dSr�)rr)rr,�moderrr r�szCCompiler.mkpath)rrr)N)N)NNNNN)NNNrNNN)NrN)
NNNNNrNNNN)
NNNNNrNNNN)
NNNNNrNNNN)NNNNrNNN)NNNN)r)rr�)rr�)rr�)r�rr�)r+)Nr+)r�)Ar$�
__module__�__qualname__Z
compiler_typer�r�Zstatic_lib_extensionr�Zstatic_lib_formatZshared_lib_formatr�rirhr!r&rr/r4r7r8r;r?rArBrCrDrErFrHrIr]r`rarbrcrdrgrnrqrtrsrwr�r�r�r~r�r�r�r�r�r�r�r�rOr�r�r�r�r�r�rrrrrrrr r
s��
$ 

+	 
"
�

�
D�
�
A�
�
�
�
,
+


�


r
))zcygwin.*�unix)�posixr�)�nt�msvccCsV|durtj}|durtj}tD]0\}}t�||�dusHt�||�dur |Sq dS)Nr�)rRr,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��cygwinZmingw32ZbcppcCsXddlm}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"|dur t|�}t|\}}}Wn6tyfd|}|durZ|d|}t|��Yn0z*d|}t|�tj|}	t	|	�|}
Wn>t
y�td|��Yn"ty�td||f��Yn0|
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')rRr,r�r�rrZDistutilsPlatformError�
__import__r��modules�vars�ImportErrorZDistutilsModuleError)Zplatr�rrrZmodule_name�
class_nameZlong_descriptionr��module�klassrrr �new_compiler�s:
����
r�cCs�g}|D]�}t|t�r0dt|�kr.dks<ntd|��t|�dkr\|�d|d�qt|�dkr|ddur�|�d|d�q|�d|�q|D]}|�d|�q�|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)rrrXZmacror:rrr rPs"$��rPcCs�g}|D]}|�|�|��q|D],}|�|�}t|t�rD||}q"|�|�q"|D]V}tj�|�\}}	|r�|�|g|	�}
|
r�|�|
�q�|�	d|�qT|�|�
|��qT|S)Nz6no library file corresponding to '%s' found (skipping))r6r�r�r'rNrRrSr�r�r�r�)r�rrrZlib_optsr:�optr�Zlib_dirZlib_nameZlib_filerrr �gen_lib_options8s&


�r�)NN)NNrrr)r�rRr�Zdistutils.errorsZdistutils.spawnrZdistutils.file_utilrZdistutils.dir_utilrZdistutils.dep_utilrZdistutils.utilrrZ	distutilsr	r
r�r�r�r�r�rPr�rrrr �<module>s6
�
--

?>