관리-도구
편집 파일: unixccompiler.cpython-39.pyc
a ����ۅ�g�;����������������������@���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 <�g�d�ZdZd Z dZ dZdZd�Z �ZZeZejdkr�dZ��fdd�Zd)dd�Zdd��Zd*dd�Zd+dd�Zdd ��Zd!d"��Zd#d$��Zd%d&��Zd,d'd(�Z���ZS�)-� 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����|||�\}}}t�d�}|r6||v�r6|�|��|||fS�)z'Remove standard library path from rpathZLIBDIR)�super� _fix_lib_argsr����get_config_var�remove)�self� libraries�library_dirs�runtime_library_dirs�libdir�� __class__���//usr/lib64/python3.9/distutils/unixccompiler.pyr���U���s����� zUnixCCompiler._fix_lib_argsc�������������� ���C���s����|���d�||�}|\}}}t||�} |�j| �} |r>| �d|g��|rN|| d�d�<�|r\| �|��| �|��|�js~|d�u�s~t||�r�|r�|��tj � |���z|��| ��W�n,�ty��}�zt |��W�Y�d�}~n d�}~0�0�d�S�)N�-or���)Z_fix_compile_argsr���r����extend�append�forcer����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���sr���|�j�}tjdkr t�|||��}z |��||�|d|g�|���W�n,�tyl�}�zt|��W�Y�d�}~n d�}~0�0�d�S�)Nr���r&���)r����sys�platform�_osx_support�compiler_fixupr.���r���r���) r����obj�src�extZcc_argsr1���r4���r���r5���r$���r$���r%����_compilex���s���� �� zUnixCCompiler._compiler���c�������������� ���C���s����|���||�\}}|�j||d�}|��||�r�|��tj�|���|��|�j|g�|�|�j ���|�j r�z|��|�j |g���W�q��ty��}�zt|��W�Y�d�}~q�d�}~0�0�nt �d|��d�S�)N)� output_dir�skipping %s (up-to-date))�_fix_object_args�library_filename� _need_linkr*���r+���r,���r-���r.���r����objectsr���r���r ���r����debug)r���rD���Zoutput_libnamer?���rE����target_lang�output_filenamer5���r$���r$���r%����create_static_lib����s$�������� zUnixCCompiler.create_static_libc�������������� ���C���s���|���||�\}}|��|||�}|\}}}t|�|||�}t|ttd��f�sPtd��|d�urftj� ||�}|�� ||��r�||�j�|�d|g�}| r�dg|d�d�<�| r�| |d�d�<�|r�|�|��|�� tj�|���z�|tjkr�|�jd�d���}n|�jd�d���}| dk�rr|�j�rrd}tj�|d��dk�r@d}d||�v��r@|d7�}�q&tj�||��d k�r\d}nd}|�j|�|||�<�tjd k�r�t�||�}|��||���W�n.�t�y��}�zt|��W�Y�d�}~n d�}~0�0�nt�d|��d�S�)Nz%'output_dir' must be a string or Noner&���z-gr���zc++�env�����=Z ld_so_aixr���r@���)rA���r���r���� isinstance�str�type� TypeErrorr+���r,����joinrC���rD���r'���r*���r-���r���Z EXECUTABLEr���r���r����basenamer7���r8���r9���r:���r.���r���r ���r���rE���)r���Ztarget_descrD���rG���r?���r���r���r ���Zexport_symbolsrE���r0���r1���Z build_temprF���r2���Zlib_optsZld_argsZlinker�i�offsetr5���r$���r$���r%����link����sZ����� ��� zUnixCCompiler.linkc�����������������C���s���d|�S�)N�-Lr$���)r����dirr$���r$���r%����library_dir_option����s����z UnixCCompiler.library_dir_optionc��������������������s���t���fdd�dD���S�)Nc�����������������3���s���|�]}|��v�V��qd�S�)Nr$���)�.0�name�� compiler_namer$���r%���� <genexpr>���������z(UnixCCompiler._is_gcc.<locals>.<genexpr>)Zgcczg++Zclang)�any)r���r[���r$���rZ���r%����_is_gcc����s����zUnixCCompiler._is_gccc�����������������C���s����t�j�t�d��}tjd�d��dkr,d|�S�tjd�d��dkrFd|�S�tjd�d��d krz|��|�rnd d|�gS�dd|�gS�|��|�r�t�d�d kr�d|�S�d|�S�nd|�S�d�S�)N�CCr���r���rU�������Zfreebsdz-Wl,-rpath=����zhp-uxz-Wl,+sz+sZGNULDZyesz-Wl,--enable-new-dtags,-Rz-Wl,-Rz-R)r+���r,���rQ���r���r���r7���r8���r_���)r���rV���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�}tjdkr|t�d�}t�d|�} | d�u�rrt�t�d ��} n | � d �} |D��] }t j�||�}t j�||�} t j�||�}t j�||�}tjdk�rL|� d�s�|� d��rL|� d ��sLt j�| |d d���|�}t j�| |d d���|�} t j�| |d d���|�}t j�| |d d���|�}t j�| ��rb| ��S�t j�|��rx|��S�t j�|��r�|��S�t j�|�r�|��S�q�d�S�)N�shared)Zlib_type�dylib� xcode_stub�staticr���ZCFLAGSz-isysroot\s*(\S+)r`���rJ���z/System/z/usr/z/usr/local/)rB���r7���r8���r���r����re�searchr9���Z_default_sysroot�groupr+���r,���rP���� startswith�exists)r����dirsrd���rE���Zshared_fZdylib_fZxcode_stub_fZstatic_fZcflags�mZsysrootrV���rf���rg���ri���rh���r$���r$���r%����find_library_file��sF���� ��� zUnixCCompiler.find_library_file)NNNNN)Nr���N) NNNNNr���NNNN)r���)�__name__� __module__�__qualname__Z compiler_typeZexecutablesr7���r8���Zsrc_extensionsZ obj_extensionZstatic_lib_extensionZshared_lib_extensionZdylib_lib_extensionZxcode_stub_lib_extensionZstatic_lib_formatZshared_lib_formatZdylib_lib_formatZxcode_stub_lib_formatZ exe_extensionr���r6���r>���rH���rT���rW���r_���rc���re���rq���� __classcell__r$���r$���r"���r%���r ���-���sN���� ��� �� ����� B*r ���)�__doc__r+���r7���rj���Z distutilsr���Zdistutils.dep_utilr���Zdistutils.ccompilerr���r���r���Zdistutils.errorsr���r���r ���r ���r���r8���r9���r ���r$���r$���r$���r%����<module>���s���