a
    �¥»a  ã                   @   sŽ   d Z ddlZddlZddlZddlmZmZmZ ddlm	Z	 ddl
mZ ddlmZ 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.

é    N)ÚCompileErrorÚDistutilsExecErrorÚLibError)ÚUnixCCompiler)Úreplace_method)Ú_commandline_dep_string)Úlogc              
   C   sä  | j }|d dkrFd|v r$| d¡ d|v r6| d¡ |dg7 }|| _ dtjv rÖddlm} d tjd  ¡ ¡}	d |dƒd  ¡ ¡}
d | j ¡}|	|vr°| |
|	¡}| ¡ | _ d | j	¡}|	|vrÖ| ¡ |	 ¡  | _	d	tj
 | j d ¡|f }t| d
dƒ�rdd|d g}ng }z*| j| j | |d|g | | |d� W n8 t�yt } zt|ƒ}t|ƒd‚W Y d}~n
d}~0 0 |�ràtjdk�ržt ddd|d g¡ t|d dƒ�"}| t|||ƒ¡ W d  ƒ n1 �sÖ0    Y  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©ÚdisplayNZzosZchtagz-tcZIBM1047Úa)Úcompiler_soÚremoveÚosÚenvironÚ	sysconfigr
   ÚjoinÚsplitÚreplaceÚ	linker_soÚpathÚbasenameÚgetattrÚspawnr   Ústrr   ÚsysÚplatformÚ
subprocessÚcheck_outputÚopenÚwriter   )ÚselfÚobjÚsrcÚextZcc_argsZextra_postargsZpp_optsZccompr
   ÚoptZgcv_optZccomp_sZllink_sr   ÚdepsÚeÚmsgÚf© r,   úW/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/numpy/distutils/unixccompiler.pyÚUnixCCompiler__compile   sJ    




ÿÿ
 r.   Ú_compilec              
   C   sN  |   ||¡\}}| j||d�}|  ||¡�r>zt |¡ W n ttfyP   Y n0 |  tj 	|¡¡ || j
 }|rÆ|dd… }|dd… }dtj | jd ¡t|ƒ|f }| j| j|g | |d� qn| j�rJdtj | jd ¡|f }z| j| j|g |d� W n8 t�y: }	 zt|	ƒ}
t|
ƒd‚W Y d}	~	n
d}	~	0 0 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ÚOSErrorÚmkpathr   ÚdirnameÚobjectsr   ÚarchiverÚlenr   Zranlibr   r   r   r   Údebug)r#   r7   Zoutput_libnamer0   r:   Ztarget_langZoutput_filenameZtmp_objectsr   r)   r*   r,   r,   r-   ÚUnixCCompiler_create_static_libH   sB    ÿ
þÿÿÿ
"r;   Zcreate_static_lib)Nr   N)Ú__doc__r   r   r   Údistutils.errorsr   r   r   Zdistutils.unixccompilerr   Znumpy.distutils.ccompilerr   Znumpy.distutils.misc_utilr   Znumpy.distutilsr   r.   r;   r,   r,   r,   r-   Ú<module>   s   5 ÿ
Cÿ