3
ßL]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$|jdƒ d|kr6|jdƒ |dg7 }|| _ dtjkrÖddlm} djtjd jƒ ƒ}	dj|dƒd jƒ ƒ}
dj| j ƒ}|	|kr°|j|
|	ƒ}|jƒ | _ dj| j	ƒ}|	|krÖ|jƒ |	jƒ  | _	d	tj
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ƒ�}|jt|||ƒƒ W dQ R X dS )z9Compile a single source files with a Unix-style compiler.r   ZaCCz-Aez-Aaz-AAÚOPT)Úget_config_varsú z%s: %sZ_auto_dependsFz-MMDz-MFz.dz-o)ÚdisplayÚaN)Úcompiler_soÚremoveÚosÚenvironÚdistutils.sysconfigr   ÚjoinÚsplitÚreplaceÚ	linker_soÚpathÚbasenameÚgetattrÚspawnr   Ústrr	   r   ÚopenÚwriter
   )ÚselfÚobjÚsrcÚextZcc_argsZextra_postargsZpp_optsZccompr   ÚoptZgcv_optZccomp_sZllink_sr   ÚdepsÚmsgÚf© r+   ú@/tmp/pip-install-q_7g0qgj/Numpy/numpy/distutils/unixccompiler.pyÚUnixCCompiler__compile   s@    





r-   Ú_compilec       
      C   sD  | j ||ƒ\}}| j||d�}| j||ƒ�r4ytj|ƒ W n ttfk
rR   Y nX | jtjj	|ƒƒ || j
 }xZ|rÊ|dd… }|dd… }dtjj| jd ƒt|ƒ|f }| j| j|g | |d� qrW | j�r@dtjj| jd ƒ|f }y| j| j|g |d� W n( tk
�r0   ttƒ ƒ}	t|	ƒ‚Y nX ntj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ÚOSErrorÚmkpathr   ÚdirnameÚobjectsr   ÚarchiverÚlenr   Zranlibr   r    r	   ÚLibErrorr   Údebug)
r#   r6   Zoutput_libnamer/   r:   Ztarget_langZoutput_filenameZtmp_objectsr   r)   r+   r+   r,   ÚUnixCCompiler_create_static_libG   s8    

r;   Zcreate_static_lib)Nr   N)Ú__doc__Ú
__future__r   r   r   r   Ú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UnixCCompilerr;   r+   r+   r+   r,   Ú<module>   s   /
B