B
    ôàn\9  ã               @   s²   d Z ddlmZmZmZ ddlZddlmZmZ ddl	T ddl
mZ ddlmZ ddlmZ ejd d	k rxd
dlmZ nddlmZ dd„ Zeedeƒ ddd„Zeedeƒ dS )z>
unixccompiler - can handle very long argument lists for ar.

é    )ÚdivisionÚabsolute_importÚprint_functionN)ÚDistutilsExecErrorÚCompileError)Ú*)Úreplace_method)Úget_exception)Ú_commandline_dep_stringé   é   )Úlogc          	   C   sœ  | j }|d dkrFd|kr$| d¡ d|kr6| d¡ |dg7 }|| _ dtjkrÖddlm} d tjd  ¡ ¡}	d |dƒd  ¡ ¡}
d | j ¡}|	|kr°| |
|	¡}| ¡ | _ d | j	¡}|	|krÖ| ¡ |	 ¡  | _	d	tj
 | j d ¡|f }t| d
dƒrdd|d g}ng }y*| j| j | |d|g | | |d W n( tk
rd   ttƒ ƒ}t|ƒ‚Y nX |r˜t|d dƒ}| t|||ƒ¡ W dQ R X dS )z9Compile a single source files with a Unix-style compiler.r   ZaCCz-Aez-Aaz-AAZOPT)Úget_config_varsú z%s: %sZ_auto_dependsFz-MMDz-MFz.dz-o)ÚdisplayÚaN)Zcompiler_soÚremoveÚosÚenvironZdistutils.sysconfigr   ÚjoinÚsplitÚreplaceZ	linker_soÚpathÚbasenameÚgetattrÚspawnr   Ústrr	   r   ÚopenÚwriter
   )ÚselfÚobjÚsrcZextZcc_argsZextra_postargsZpp_optsZccompr   ZoptZgcv_optZccomp_sZllink_sr   ZdepsÚmsgÚf© r$   ú<lib/python3.7/site-packages/numpy/distutils/unixccompiler.pyÚUnixCCompiler__compile   s@    





r&   Ú_compilec       
   	   C   sD  |   ||¡\}}| j||d}|  ||¡r4yt |¡ W n ttfk
rR   Y nX |  tj 	|¡¡ || j
 }xZ|rÊ|dd… }|dd… }dtj | jd ¡t|ƒ|f }| j| j|g | |d qrW | jr@dtj | jd ¡|f }y| j| j|g |d W n( tk
r0   ttƒ ƒ}	t|	ƒ‚Y nX nt d|¡ dS )	aŒ  
    Build a static library in a separate sub-process.

    Parameters
    ----------
    objects : list or tuple of str
        List of paths to object files used to build the static library.
    output_libname : str
        The library name as an absolute or relative (if `output_dir` is used)
        path.
    output_dir : str, optional
        The path to the output directory. Default is None, in which case
        the ``output_dir`` attribute of the UnixCCompiler instance.
    debug : bool, optional
        This parameter is not used.
    target_lang : str, optional
        This parameter is not used.

    Returns
    -------
    None

    )Ú
output_dirNé2   z %s: adding %d object files to %sr   )r   z%s:@ %szskipping %s (up-to-date))Z_fix_object_argsZlibrary_filenameZ
_need_linkr   ÚunlinkÚIOErrorÚOSErrorZmkpathr   ÚdirnameÚobjectsr   ZarchiverÚlenr   Zranlibr   r   r	   ZLibErrorr   Údebug)
r   r.   Zoutput_libnamer(   r0   Ztarget_langZoutput_filenameZtmp_objectsr   r"   r$   r$   r%   ÚUnixCCompiler_create_static_libG   s8    

r1   Zcreate_static_lib)Nr   N)Ú__doc__Z
__future__r   r   r   r   Zdistutils.errorsr   r   Zdistutils.unixccompilerZnumpy.distutils.ccompilerr   Znumpy.distutils.compatr	   Znumpy.distutils.misc_utilr
   ÚsysÚversion_infoÚ r   Znumpy.distutilsr&   ZUnixCCompilerr1   r$   r$   r$   r%   Ú<module>   s   /
B