Edit File: unixccompiler.cpython-36.pyc
3 48e�:������������������@���s����d�Z�ddlZddlZddlZddlmZ�ddlmZ�ddlm Z m Z mZ�ddlm Z mZmZmZ�ddlmZ�ejdkr~ddlZG�d d ��d e �ZdS�)a9��distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library search directories specified with -Ldir * compile handled by 'cc' (or similar) executable with -c option: compiles .c to .o * link static library handled by 'ar' command (possibly with 'ranlib') * link shared library handled by 'cc -shared' �����N)� sysconfig)�newer)� CCompiler�gen_preprocess_options�gen_lib_options)�DistutilsExecError�CompileError�LibError� LinkError)�log�darwinc������������ �������s����e�Zd�ZdZddgdgdgddgdgddgdd�Zejdd��d krNd ged <�ddd dddgZdZdZ dZ dZdZd�Z �ZZeZejdkr�dZ��fdd�Zd.dd�Zdd��Zd/d d!�Zd0d"d#�Zd$d%��Zd&d'��Zd(d)��Zd*d+��Zd1d,d-�Z���ZS�)2� UnixCCompilerZunixNZccz-shared�arz-cr)�preprocessor�compiler�compiler_so�compiler_cxx� linker_so� linker_exe�archiver�ranlib����r���r���z.cz.Cz.ccz.cxxz.cppz.mz.oz.az.soz.dylibz.tbdzlib%s%s�cygwinz.exec����������������s@���t���j|||�\}}}tjd�}|r6||kr6|j|��|||fS�)z'Remove standard library path from rpath�LIBDIR)�super� _fix_lib_argsr����get_config_var�remove)�self� libraries�library_dirs�runtime_library_dirsZlibdir)� __class__���//usr/lib64/python3.6/distutils/unixccompiler.pyr���U���s���� zUnixCCompiler._fix_lib_argsc�������������C���s����|�j�d�||�}|\}}}t||�} |�j| �} |r>| jd|g��|rN|| d�d�<�|r\| j|��| j|��|�js~|d�ks~t||�r�|r�|�jtj j |���y|�j| ��W�n*�tk r��}�zt |��W�Y�d�d�}~X�nX�d�S�)Nz-or���)Z_fix_compile_argsr���r����extend�appendZforcer����mkpath�os�path�dirname�spawnr���r���)r����sourceZoutput_fileZmacrosZinclude_dirs� extra_preargs�extra_postargs� fixed_args�ignore�pp_optsZpp_args�msgr#���r#���r$���� preprocess^���s$���� zUnixCCompiler.preprocessc������� ������C���sp���|�j�}tjdkr tj|||��}y |�j||�|d|g�|���W�n*�tk rj�}�zt|��W�Y�d�d�}~X�nX�d�S�)Nr���z-o)r����sys�platform�_osx_support�compiler_fixupr+���r���r���) r����obj�srcZextZcc_argsr.���r1���r���r2���r#���r#���r$����_compilex���s���� zUnixCCompiler._compiler���c�������������C���s����|�j�||�\}}|�j||d�}|�j||�r�|�jtjj|���|�j|�j|g�|�|�j ���|�j r�y|�j|�j |g���W�q��tk r��}�zt|��W�Y�d�d�}~X�q�X�nt jd|��d�S�)N)� output_dirzskipping %s (up-to-date))�_fix_object_args�library_filename� _need_linkr'���r(���r)���r*���r+���r����objectsr���r���r ���r����debug)r���r?���Zoutput_libnamer;���r@����target_lang�output_filenamer2���r#���r#���r$����create_static_lib����s����zUnixCCompiler.create_static_libc�������������C���s���|�j�||�\}}|�j|||�}|\}}}t|�|||�}t|ttd��f�sPtd��|d�k rftjj ||�}|�j ||��r�||�j�|�d|g�}| r�dg|d�d�<�| r�| |d�d�<�|r�|j|��|�j tjj|���y�|tjkr�|�jd�d���}n|�jd�d���}| dk�rR|�j�rRd}tjj|d��dk�rDd}xd||�k�rB|d7�}�q(W�|�j|�||<�tjd k�rjtj||�}|�j||���W�n,�tk �r��}�zt|��W�Y�d�d�}~X�nX�ntjd |��d�S�)Nz%'output_dir' must be a string or Nonez-oz-gr���zc++�env�����=r���zskipping %s (up-to-date))r<���r���r���� isinstance�str�type� TypeErrorr(���r)����joinr>���r?���r%���r'���r*���r���Z EXECUTABLEr���r���r����basenamer4���r5���r6���r7���r+���r���r ���r���r@���)r���Ztarget_descr?���rB���r;���r���r ���r!���Zexport_symbolsr@���r-���r.���Z build_temprA���r/���Zlib_optsZld_argsZlinker�ir2���r#���r#���r$����link����sH���� zUnixCCompiler.linkc�������������C���s���d|�S�)Nz-Lr#���)r����dirr#���r#���r$����library_dir_option����s����z UnixCCompiler.library_dir_optionc�������������C���s���d|kpd|kS�)N�gcczg++r#���)r���Z compiler_namer#���r#���r$����_is_gcc����s����zUnixCCompiler._is_gccc�������������C���s����t�jjtjd��}tjd�d��dkr,d|�S�tjd�d��dkrFd|�S�tjd�d��d krz|�j|�rnd d|�gS�dd|�gS�tjd�d��dks�tjd�d��d kr�d|gS�|�j|�r�tjd�dkr�d|�S�d|�S�nd|�S�d�S�)N�CCr���r���z-L����Zfreebsdz-Wl,-rpath=����zhp-uxz-Wl,+sz+sZirix646Zosf1V5z-rpath�GNULD�yesz-Wl,--enable-new-dtags,-Rz-Wl,-Rz-R)r(���r)���rL���r���r���r4���r5���rR���)r���rO���r���r#���r#���r$����runtime_library_dir_option����s ���� $ z(UnixCCompiler.runtime_library_dir_optionc�������������C���s���d|�S�)Nz-lr#���)r����libr#���r#���r$����library_option ��s����zUnixCCompiler.library_optionc�������������C���s���|�j�|dd�}|�j�|dd�}|�j�|dd�}|�j�|dd�}tjdkrptjd�}tjd|�} | d�krfd } n | jd �} �x|D��]}tj j ||�}tj j ||�} tj j ||�}tj j ||�}tjdko�|jd�s�|jd�o�|jd ���rBtj j | |d d���|�}tj j | |d d���|�} tj j | |d d���|�}tj j | |d d���|�}tj j| ��rT| S�tj j|��rf|S�tj j|��rx|S�tj j|�rx|S�qxW�d�S�)N�shared)Zlib_type�dylib� xcode_stub�staticr����CFLAGSz-isysroot\s+(\S+)�/rE���z/System/z/usr/z/usr/local/) r=���r4���r5���r���r����re�search�groupr(���r)���rK���� startswith�exists)r����dirsrY���r@���Zshared_fZdylib_fZxcode_stub_fZstatic_fZcflags�mZsysrootrO���r[���r\���r^���r]���r#���r#���r$����find_library_file��s>���� zUnixCCompiler.find_library_file)NNNNN)Nr���N) NNNNNr���NNNN)r���)�__name__� __module__�__qualname__Z compiler_typeZexecutablesr4���r5���Zsrc_extensionsZ obj_extensionZstatic_lib_extensionZshared_lib_extensionZdylib_lib_extensionZxcode_stub_lib_extensionZstatic_lib_formatZshared_lib_formatZdylib_lib_formatZxcode_stub_lib_formatZ exe_extensionr���r3���r:���rC���rN���rP���rR���rX���rZ���rh���� __classcell__r#���r#���)r"���r$���r ���-���sF��� � ��� 6,r ���)�__doc__r(���r4���ra���Z distutilsr���Zdistutils.dep_utilr���Zdistutils.ccompilerr���r���r���Zdistutils.errorsr���r���r ���r ���r���r5���r6���r ���r#���r#���r#���r$����<module>���s���