Edit File: ccompiler.cpython-36.opt-2.pyc
3 � \7�������������������@���s����d�dl�Z�d�dlZd�dlZd�dlT�d�dlmZ�d�dlmZ�d�dlm Z �d�dl mZmZ�d�dl mZmZ�d�dlmZ�G�d d ��d �Zd,Zd-dd�Zd.d/d0d1d2d �Zd!d"��Zd3d#d$�Zd%d&��Zd'd(��ZdS�)4�����N)�*)�spawn)� move_file)�mkpath)�newer_pairwise�newer_group)�split_quoted�execute)�logc������������ ���@���s���e�Zd�ZdZdZdZdZdZdZdZ dZ dddddd�ZdddgZdpdd�Z d d ��Zdd��Zd d��Zdd��Zdqdd�Zdd��Zdd��Zdd��Zdd��Zdd��Zdd��Zdd ��Zd!d"��Zd#d$��Zd%d&��Zd'd(��Zd)d*��Zd+d,��Zd-d.��Z drd/d0�Z!d1d2��Z"d3d4��Z#d5d6��Z$d7d8��Z%dsd9d:�Z&dtd;d<�Z'd=d>��Z(dud?d@�Z)dAZ*dBZ+dCZ,dvdDdE�Z-dwdFdG�Z.dxdHdI�Z/dydJdK�Z0dLdM��Z1dNdO��Z2dPdQ��Z3dzdRdS�Z4d{dTdU�Z5d|dWdX�Z6d}dYdZ�Z7d~d[d\�Z8dd^d_�Z9d�dadb�Z:dcdd��Z;dedf��Z<d�dgdh�Z=didj��Z>dkdl��Z?d�dndo�Z@dS�)�� CCompilerN�czc++Zobjc)z.cz.ccz.cppz.cxxz.mr���c�������������C���sf���||�_�||�_||�_d�|�_g�|�_g�|�_g�|�_g�|�_g�|�_g�|�_ x$|�j j��D�]}|�j||�j |���qHW�d�S�)N) �dry_run�force�verbose� output_dir�macros�include_dirs� libraries�library_dirs�runtime_library_dirs�objects�executables�keys�set_executable)�selfr���r ���r����key��r����+/usr/lib64/python3.6/distutils/ccompiler.py�__init__U���s����zCCompiler.__init__c�������������K���s@���x:|D�]2}||�j�kr(td||�jjf���|�j|||���qW�d�S�)Nz$unknown executable '%s' for class %s)r���� ValueError� __class__�__name__r���)r����kwargsr���r���r���r����set_executablesy���s ���� zCCompiler.set_executablesc�������������C���s,���t�|t�rt|�|t|���nt|�||��d�S�)N)� isinstance�str�setattrr���)r���r����valuer���r���r���r�������s���� zCCompiler.set_executablec�������������C���s0���d}x&|�j�D�]}|d�|kr |S�|d7�}qW�d�S�)Nr�������)r���)r����name�i�defnr���r���r����_find_macro����s����zCCompiler._find_macroc�������������C���sd���x^|D�]V}t�|t�oFt|�dkoFt�|d�t�s:|d�d�koFt�|d�t�std|�d�d���qW�d�S�)Nr(�������r���zinvalid macro definition '%s': z.must be tuple (string,), (string, string), or z(string, None))r(���r-���)r$����tuple�lenr%���� TypeError)r���Zdefinitionsr+���r���r���r����_check_macro_definitions����s���� z"CCompiler._check_macro_definitionsc�������������C���s.���|�j�|�}|d�k r|�j|=�|�jj||f��d�S�)N)r,���r����append)r���r)���r'���r*���r���r���r����define_macro����s���� zCCompiler.define_macroc�������������C���s0���|�j�|�}|d�k r|�j|=�|f}|�jj|��d�S�)N)r,���r���r2���)r���r)���r*���Zundefnr���r���r����undefine_macro����s ���� zCCompiler.undefine_macroc�������������C���s���|�j�j|��d�S�)N)r���r2���)r����dirr���r���r����add_include_dir����s����zCCompiler.add_include_dirc�������������C���s���|d�d���|�_�d�S�)N)r���)r����dirsr���r���r����set_include_dirs����s����zCCompiler.set_include_dirsc�������������C���s���|�j�j|��d�S�)N)r���r2���)r����libnamer���r���r����add_library����s����zCCompiler.add_libraryc�������������C���s���|d�d���|�_�d�S�)N)r���)r���Zlibnamesr���r���r���� set_libraries����s����zCCompiler.set_librariesc�������������C���s���|�j�j|��d�S�)N)r���r2���)r���r5���r���r���r����add_library_dir��s����zCCompiler.add_library_dirc�������������C���s���|d�d���|�_�d�S�)N)r���)r���r7���r���r���r����set_library_dirs��s����zCCompiler.set_library_dirsc�������������C���s���|�j�j|��d�S�)N)r���r2���)r���r5���r���r���r����add_runtime_library_dir��s����z!CCompiler.add_runtime_library_dirc�������������C���s���|d�d���|�_�d�S�)N)r���)r���r7���r���r���r����set_runtime_library_dirs��s����z"CCompiler.set_runtime_library_dirsc�������������C���s���|�j�j|��d�S�)N)r���r2���)r����objectr���r���r����add_link_object ��s����zCCompiler.add_link_objectc�������������C���s���|d�d���|�_�d�S�)N)r���)r���r���r���r���r����set_link_objects(��s����zCCompiler.set_link_objectsc�������������C���s��|d�kr|�j�}nt|t�s"td��|d�kr2|�j}n"t|t�rL||�jpFg��}ntd��|d�krd|�j}n*t|ttf�r�t|�|�jp�g��}ntd��|d�kr�g�}|�j|d|d�}t ||�}i�} xRt t|��D�]B} || �}|| �}tj j|�d�} |�jtj j|���|| f| |<�q�W�||||| fS�)Nz%'output_dir' must be a string or Nonez/'macros' (if supplied) must be a list of tuplesz6'include_dirs' (if supplied) must be a list of stringsr���)� strip_dirr���r(���)r���r$���r%���r0���r����listr���r.����object_filenames�gen_preprocess_options�ranger/����os�path�splitextr����dirname)r���Zoutdirr���Zincdirs�sources�dependsZextrar����pp_opts�buildr*����src�obj�extr���r���r����_setup_compile6��s8���� zCCompiler._setup_compilec�������������C���s0���|dg�}|rdg|d�d�<�|r,||d�d�<�|S�)Nz-cz-gr���r���)r���rN����debugZbefore�cc_argsr���r���r����_get_cc_argsa��s���� zCCompiler._get_cc_argsc�������������C���s����|d�kr|�j�}nt|t�s"td��|d�kr2|�j}n"t|t�rL||�jpFg��}ntd��|d�krd|�j}n*t|ttf�r�t|�|�jp�g��}ntd��|||fS�)Nz%'output_dir' must be a string or Nonez/'macros' (if supplied) must be a list of tuplesz6'include_dirs' (if supplied) must be a list of strings)r���r$���r%���r0���r���rD���r���r.���)r���r���r���r���r���r���r����_fix_compile_argsj��s ���� zCCompiler._fix_compile_argsc�������������C���s���|�j�||d�}|i�fS�)N)r���)rE���)r���rL���r���rM���r���r���r���r���� _prep_compile���s���� zCCompiler._prep_compilec�������������C���sH���t�|ttf�std��t|�}|d�kr.|�j}nt�|t�s@td��||fS�)Nz,'objects' must be a list or tuple of stringsz%'output_dir' must be a string or None)r$���rD���r.���r0���r���r%���)r���r���r���r���r���r����_fix_object_args���s���� zCCompiler._fix_object_argsc�������������C���s����|d�kr|�j�}n*t|ttf�r2t|�|�j�p,g��}ntd��|d�krJ|�j}n*t|ttf�rlt|�|�jpfg��}ntd��|d�kr�|�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)r���r$���rD���r.���r0���r���r���)r���r���r���r���r���r���r���� _fix_lib_args���s&����zCCompiler._fix_lib_argsc�������������C���s2���|�j�r dS�|�jr t||dd�}n t||�}|S�d�S�)NT�newer)Zmissing)r���r ���r���)r���r����output_filer[���r���r���r���� _need_link���s���� zCCompiler._need_linkc������� ������C���s����t�|t�s|g}d�}t|�j�}x^|D�]V}tjj|�\}}|�jj|�}y |�jj |�}||k�rb|}|}W�q$�t k rx���Y�q$X�q$W�|S�)N)r$���rD���r/����language_orderrH���rI���rJ����language_map�get�indexr���) r���rL���Zlangra����source�baserR���ZextlangZextindexr���r���r����detect_language���s���� zCCompiler.detect_languagec�������������C���s���d�S�)Nr���)r���rb���r\���r���r���� extra_preargs�extra_postargsr���r���r���� preprocess���s����zCCompiler.preprocessc �������������C���sz���|�j�||||||�\}} }} }|�j| ||�}xH| D�]@} y|| �\}}W�n�tk r\���w2Y�nX�|�j| ||||| ��q2W�| S�)N)rS���rV����KeyError�_compile)r���rL���r���r���r���rT���re���rf���rM���r���rN���rO���rU���rQ���rP���rR���r���r���r����compile���s����6 zCCompiler.compilec�������������C���s���d�S�)Nr���)r���rQ���rP���rR���rU���rf���rN���r���r���r���ri���C��s����zCCompiler._compilec�������������C���s���d�S�)Nr���)r���r����output_libnamer���rT����target_langr���r���r����create_static_libI��s����zCCompiler.create_static_libZ shared_objectZshared_library� executablec�������������C���s���t��d�S�)N)�NotImplementedError)r���Ztarget_descr����output_filenamer���r���r���r����export_symbolsrT���re���rf���� build_temprl���r���r���r����linki��s����9zCCompiler.linkc ������� ������C���s2���|�j�tj||�j|dd�||||||| | ||� �d�S�)N�shared)�lib_type)rs���r����SHARED_LIBRARY�library_filename) r���r���rk���r���r���r���r���rq���rT���re���rf���rr���rl���r���r���r����link_shared_lib���s���� zCCompiler.link_shared_libc ������� ������C���s(���|�j�tj||||||||| | ||� �d�S�)N)rs���r���� SHARED_OBJECT) r���r���rp���r���r���r���r���rq���rT���re���rf���rr���rl���r���r���r����link_shared_object���s ���� zCCompiler.link_shared_objectc�������������C���s.���|�j�tj||�j|�||||d�||| d�| � �d�S�)N)rs���r���� EXECUTABLE�executable_filename)r���r���Zoutput_prognamer���r���r���r���rT���re���rf���rl���r���r���r����link_executable���s���� zCCompiler.link_executablec�������������C���s���t��d�S�)N)ro���)r���r5���r���r���r����library_dir_option���s����zCCompiler.library_dir_optionc�������������C���s���t��d�S�)N)ro���)r���r5���r���r���r����runtime_library_dir_option���s����z$CCompiler.runtime_library_dir_optionc�������������C���s���t��d�S�)N)ro���)r����libr���r���r����library_option���s����zCCompiler.library_optionc�������������C���s����dd�l�}|d�krg�}|d�kr g�}|d�kr,g�}|d�kr8g�}|jd|dd�\}}tj|d�} z.x|D�]} | jd| ���q`W�| jd|���W�d�| j���X�y|�j|g|d�}W�n�tk r����d S�X�y|�j|d ||d��W�n�t t fk r����d S�X�dS�)Nr���z.cT)�text�wz#include "%s" z+main (int argc, char **argv) { %s(); } )r���Fza.out)r���r���)�tempfileZmkstemprH����fdopen�write�closerj���ZCompileErrorr}���Z LinkErrorr0���)r����funcnameZincludesr���r���r���r�����fdZfname�fZinclr���r���r���r����has_function���s8���� zCCompiler.has_functionc�������������C���s���t��d�S�)N)ro���)r���r7���r����rT���r���r���r����find_library_file#��s����zCCompiler.find_library_file��c�������������C���s����|d�krd}g�}x�|D�]|}t�jj|�\}}t�jj|�d�}|t�jj|�d���}||�jkrhtd||f���|rxt�jj|�}|jt�jj |||�j ����qW�|S�)Nr����r(���z"unknown file type '%s' (from '%s'))rH���rI���rJ���� splitdrive�isabs�src_extensionsZUnknownFileError�basenamer2����join� obj_extension)r���Zsource_filenamesrC���r���Z obj_namesZsrc_namerc���rR���r���r���r���rE���N��s���� zCCompiler.object_filenamesc�������������C���s$���|rt�jj|�}t�jj|||�j��S�)N)rH���rI���r����r�����shared_lib_extension)r���r����rC���r���r���r���r����shared_object_filename_��s����z CCompiler.shared_object_filenamec�������������C���s(���|rt�jj|�}t�jj|||�jp"d��S�)Nr����)rH���rI���r����r����� exe_extension)r���r����rC���r���r���r���r���r|���e��s����zCCompiler.executable_filename�staticc������� ������C���s`���|d krt�d��t|�|d��}t|�|d��}tjj|�\}}|||f�} |rPd}tjj||| �S�) Nr����rt����dylib� xcode_stubz?'lib_type' must be "static", "shared", "dylib", or "xcode_stub"Z_lib_formatZ_lib_extensionr����)r����rt���r����r����)r����getattrrH���rI����splitr����) r���r9���ru���rC���r���ZfmtrR���r5���rc����filenamer���r���r���rw���k��s����zCCompiler.library_filenamer(���c�������������C���s���t�j|��d�S�)N)r ���rT���)r����msg�levelr���r���r����announce~��s����zCCompiler.announcec�������������C���s���ddl�m}�|rt|��d�S�)Nr���)�DEBUG)Zdistutils.debugr�����print)r���r����r����r���r���r����debug_print���s����zCCompiler.debug_printc�������������C���s���t�jjd|���d�S�)Nzwarning: %s )�sys�stderrr����)r���r����r���r���r����warn���s����zCCompiler.warnc�������������C���s���t�||||�j��d�S�)N)r ���r ���)r����func�argsr����r����r���r���r���r ������s����zCCompiler.executec�������������C���s���t�||�jd��d�S�)N)r ���)r���r ���)r����cmdr���r���r���r������s����zCCompiler.spawnc�������������C���s���t�|||�jd�S�)N)r ���)r���r ���)r���rP����dstr���r���r���r������s����zCCompiler.move_file���c�������������C���s���t�|||�jd��d�S�)N)r ���)r���r ���)r���r)����moder���r���r���r������s����zCCompiler.mkpath)r���r���r���)N)N)NNNNN)NNNr���NNN)Nr���N) NNNNNr���NNNN) NNNNNr���NNNN) NNNNNr���NNNN)NNNNr���NNN)NNNN)r���)r���r����)r���r����)r���r����)r����r���r����)r(���)Nr(���)r����)Ar!���� __module__�__qualname__Z compiler_typer����r����Zstatic_lib_extensionr����Zstatic_lib_formatZshared_lib_formatr����r_���r^���r���r#���r���r,���r1���r3���r4���r6���r8���r:���r;���r<���r=���r>���r?���rA���rB���rS���rV���rW���rX���rY���rZ���r]���rd���rg���rj���ri���rm���ry���rv���r{���rs���rx���rz���r}���r~���r���r����r����r����rE���r����r|���rw���r����r����r����r ���r���r���r���r���r���r���r���r������s���� $ + " � �� B� ��������� 4��������� ��������� ������� � * + � r����cygwin.*�unix�posix�nt�msvcc�������������C���sV���|�d�krt�j}�|d�krtj}x4tD�],\}}tj||�d�k sJtj||��d�k r"|S�q"W�dS�)Nr����)rH���r)���r�����platform�_default_compilers�re�match)�osnamer�����pattern�compilerr���r���r����get_default_compiler���s���� r����� unixccompiler� UnixCCompiler�standard UNIX-style compiler� _msvccompiler�MSVCCompiler�Microsoft Visual C++�cygwinccompiler�CygwinCCompiler�'Cygwin port of GNU C Compiler for Win32�Mingw32CCompiler�(Mingw32 port of GNU C Compiler for Win32�bcppcompiler�BCPPCompiler�Borland C++ Compiler)r����r�����cygwinZmingw32Zbcppc��������������C���s\���ddl�m}��g�}x,tj��D�] }|jd|�d�t|�d�f��qW�|j���|�|�}|jd��d�S�)Nr���)�FancyGetoptz compiler=r-���zList of available compilers:)Zdistutils.fancy_getoptr�����compiler_classr���r2����sortZ print_help)r����Z compilersr����Zpretty_printerr���r���r����show_compilers���s����r����c�������������C���s����|�d�krt�j}�y"|d�kr t|��}t|�\}}}W�n8�tk rh���d|��}|d�k r\|d|��}t|��Y�nX�y*d|�}t|��tj|�} t | �|�} W�nB�t k r����td|���Y�n$�tk r����td||f���Y�nX�| 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')rH���r)���r����r����rh���ZDistutilsPlatformError� __import__r�����modules�vars�ImportErrorZDistutilsModuleError)Zplatr����r���r ���r���Zmodule_name� class_nameZlong_descriptionr�����module�klassr���r���r����new_compiler���s2���� r����c�������������C���s����g�}x�|�D�]�}t�|t�o2dt|���ko.dkn��s@td|���t|�dkr`|jd|d����q t|�dkr |d�d�kr�|jd|d����q |jd|���q W�x|D�]}|jd|���q�W�|S�) Nr(���r-���zPbad macro definition '%s': each element of 'macros' list must be a 1- or 2-tuplez-U%sr���z-D%sz-D%s=%sz-I%s)r$���r.���r/���r0���r2���)r���r���rN���Zmacror5���r���r���r���rF��� ��s���� & rF���c�������������C���s����g�}x|D�]}|j�|�j|���q W�x4|D�],}|�j|�}t|t�rJ||�}q(|j�|��q(W�x^|D�]V}tjj|�\}} |r�|�j|g| �} | r�|j�| ��q�|�j d|���q^|j�|�j |���q^W�|S�)Nz6no library file corresponding to '%s' found (skipping))r2���r~���r���r$���rD���rH���rI���r����r����r����r����)r����r���r���r���Zlib_optsr5����optr����Zlib_dirZlib_nameZlib_filer���r���r����gen_lib_options7��s$���� r�����r����r�����r����r�����r����r����)r����r����r����)NN)r����r����r����)r����r����r����)r����r����r����)r����r����r����)r����r����r����)NNr���r���r���)r����rH���r����Zdistutils.errorsZdistutils.spawnr���Zdistutils.file_utilr���Zdistutils.dir_utilr���Zdistutils.dep_utilr���r���Zdistutils.utilr���r ���Z distutilsr ���r���r����r����r����r����r����rF���r����r���r���r���r����<module>���sB������������ ����� --