
;>"^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	 Td d l
 m Z d d l m Z d d l m Z e j d d	 k  r d
 d l m Z n d d l m Z d d   Z e e d e  d d 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 ra d | k r2 | j d  d | k rK | j d  | d g 7} | |  _  d t j k r1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 r1| j   |	 j   |  _	 d	 t j
 j |  j  d  | f } t |  d
 d  r|d d | d g } n g  } y3 |  j |  j  | | d | g | | d | Wn- t k
 rt t    } t |   Yn X| r!t | d d    } | j t | | |   Wd QRXd S)z9Compile a single source files with a Unix-style compiler.r   aCCz-Aez-Aaz-AAOPT)get_config_vars z%s: %s_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extcc_argsextra_postargspp_optsccompr   optgcv_optccomp_sllink_sr   depsmsgf r4   O/home/birch/.local/lib/python3.5/site-packages/numpy/distutils/unixccompiler.pyUnixCCompiler__compile   s@    		#!r6   _compilec       
      C   s  |  j  | |  \ } } |  j | d | } |  j | |  ry t j |  Wn t t f k
 rj Yn X|  j t j j	 |   | |  j
 } xw | r
| d d  } | d d  } d t j j |  j d  t |  | f } |  j |  j | g | d | q W|  j rd t j j |  j d  | f } y! |  j |  j | g d | Wqt k
 rt t    }	 t |	   YqXn 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_dirN2   z %s: adding %d object files to %sr   r   z%s:@ %szskipping %s (up-to-date))_fix_object_argslibrary_filename
_need_linkr   unlinkIOErrorOSErrormkpathr   dirnameobjectsr   archiverlenr!   ranlibr   r"   r	   LibErrorr   debug)
r%   rB   output_libnamer8   rG   target_langoutput_filenametmp_objectsr   r2   r4   r4   r5   UnixCCompiler_create_static_libG   s8    		
rL   create_static_lib)__doc__
__future__r   r   r   r   distutils.errorsr   r   distutils.unixccompilerZnumpy.distutils.ccompilerr   numpy.distutils.compatr	   numpy.distutils.misc_utilr
   sysversion_info r   numpy.distutilsr6   UnixCCompilerrL   r4   r4   r4   r5   <module>   s   
/B	