ó
È!7]c           @` 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 „  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_exception(   t   _commandline_dep_stringi   i   (   t   logc      	   C` s8  |  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 } t |  d
 t ƒ rŽd d | d g } n g  } y3 |  j |  j  | | d | g | | d | ƒWn, t k
 rõt t ƒ  ƒ } t | ƒ ‚ n X| r4t | d d ƒ   } | j t | | | ƒ ƒ Wd QXn  d 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: %st   _auto_dependss   -MMDs   -MFs   .ds   -ot   displayt   aN(   t   compiler_sot   removet   ost   environt   distutils.sysconfigR   t   joint   splitt   replacet	   linker_sot   patht   basenamet   getattrt   Falset   spawnR   t   strR   R   t   opent   writeR   (   t   selft   objt   srct   extt   cc_argst   extra_postargst   pp_optst   ccompR   t   optt   gcv_optt   ccomp_st   llink_sR   t   depst   msgt   f(    (    s<   lib/python2.7/site-packages/numpy/distutils/unixccompiler.pyt   UnixCCompiler__compile   s@    	#!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"   R<   t   output_libnameR3   RA   t   target_langt   output_filenamet   tmp_objectsR   R/   (    (    s<   lib/python2.7/site-packages/numpy/distutils/unixccompiler.pyt   UnixCCompiler_create_static_libG   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   numpy.distutils.misc_utilR   t   syst   version_infot    R	   t   numpy.distutilsR1   t   UnixCCompilert   NoneRF   (    (    (    s<   lib/python2.7/site-packages/numpy/distutils/unixccompiler.pyt   <module>   s   
	/B	