ó
ØÆ÷Xc           @` 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 e j d d k  r” d	 d
 l m Z n d d
 l m Z d „  Z e e d e ƒ d d d d „ Z e e d e ƒ d S(   s>   
unixccompiler - can handle very long argument lists for ar.

i    (   t   divisiont   absolute_importt   print_functionN(   t   DistutilsExecErrort   CompileError(   t   *(   t   replace_method(   t   get_exceptioni   i   (   t   logc         C` sÈ  |  j  } | d d k rj d | k r5 | j d ƒ n  d | k rQ | j d ƒ n  | d g 7} | |  _  n  d t j k rCd d l m } d j t j d j ƒ  ƒ }	 d j | d ƒ d j ƒ  ƒ }
 d j |  j  ƒ } |	 | k r| j |
 |	 ƒ } | j ƒ  |  _  n  d j |  j	 ƒ } |	 | k rC| j ƒ  |	 j ƒ  |  _	 qCn  d	 t j
 j |  j  d ƒ | f } y/ |  j |  j  | | d
 | g | d | ƒWn, t k
 rÃt t ƒ  ƒ } t | ƒ ‚ n Xd S(   s9   Compile a single source files with a Unix-style compiler.i    t   aCCs   -Aes   -Aas   -AAt   OPT(   t   get_config_varst    s   %s: %ss   -ot   displayN(   t   compiler_sot   removet   ost   environt   distutils.sysconfigR   t   joint   splitt   replacet	   linker_sot   patht   basenamet   spawnR   t   strR   R   (   t   selft   objt   srct   extt   cc_argst   extra_postargst   pp_optst   ccompR   t   optt   gcv_optt   ccomp_st   llink_sR   t   msg(    (    s<   /tmp/pip-build-X4mzal/numpy/numpy/distutils/unixccompiler.pyt   UnixCCompiler__compile   s4    	#t   _compilec   
      C` s”  |  j  | | ƒ \ } } |  j | d | ƒ} |  j | | ƒ r€y t j | ƒ Wn t t f k
 ri n X|  j t j j	 | ƒ ƒ | |  j
 } xk | rý | 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
 ryt t ƒ  ƒ }	 t |	 ƒ ‚ q}Xqn t j d | ƒ d S(	   sŒ  
    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

    t
   output_diri2   s    %s: adding %d object files to %si    R   s   %s:@ %ss   skipping %s (up-to-date)N(   t   _fix_object_argst   library_filenamet
   _need_linkR   t   unlinkt   IOErrort   OSErrort   mkpathR   t   dirnamet   objectsR   t   archivert   lenR   t   ranlibR   R   R   t   LibErrorR   t   debug(
   R   R3   t   output_libnameR*   R8   t   target_langt   output_filenamet   tmp_objectsR   R'   (    (    s<   /tmp/pip-build-X4mzal/numpy/numpy/distutils/unixccompiler.pyt   UnixCCompiler_create_static_lib9   s8    	

	
t   create_static_lib(   t   __doc__t
   __future__R    R   R   R   t   distutils.errorsR   R   t   distutils.unixccompilert   numpy.distutils.ccompilerR   t   numpy.distutils.compatR   t   syst   version_infot    R   t   numpy.distutilsR(   t   UnixCCompilert   NoneR=   (    (    (    s<   /tmp/pip-build-X4mzal/numpy/numpy/distutils/unixccompiler.pyt   <module>   s   
	"B	